[PATCH] D26283: [ELF] - Partial support of --gdb-index command line option (Part 3).

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 10:14:03 PST 2016


On Wed, Dec 7, 2016 at 9:36 AM Greg Clayton via Phabricator <
reviews at reviews.llvm.org> wrote:

> clayborg added a comment.
>
> In https://reviews.llvm.org/D26283#615621, @grimar wrote:
>
> > In https://reviews.llvm.org/D26283#615115, @clayborg wrote:
> >
> > > Seems like the GdbIndex isn't specific to ELF. I know the file started
> off here and that some of the template classes you use are using ELF
> defines, but they don't really need to be in the ELF plug-in.
> > >
> > > Would we want to move this functionality to the
> lib/DebugInfo/Dwarf/DWARFGdbIndex.cpp file so that other file formats like
> mach-o and COFF could create the gdb index section and be able to emit it?
> This code accesses existing DWARF sections and then creates the .gdb-index
> section contents.
> >
> >
> > If so I am not sure what is better ?
> >
> > 1. Do that before landing this+https://reviews.llvm.org/D25821.
> > 2. Continue with landing above for ELF, complete and test functionality
> and then move it to lib/Debuginfo/Dwarf/* ?.
>
>
> Not sure either. Probably fine to land it here with this change then
> migrate it.
>
> > I would also create separate file for this like
> lib/DebugInfo/Dwarf/DWARFGdbIndexBuilder.cpp as DWARFGdbIndex.cpp is a
> parser and probably
> >  better not to mix them.
>
> If it is the same stuff, I don't see a problem with the class being able
> to parse and generate the gdb index. You would probably share a lot of the
> same data structures and it would be a shame to duplicate those.
>
>
>
> ================
> Comment at: ELF/GdbIndex.cpp:100-101
> +  const bool IsLE = ELFT::TargetEndianness == llvm::support::little;
> +  StringRef Data[] = {Dwarf->getGnuPubNamesSection(),
> +                      Dwarf->getGnuPubTypesSection()};
> +
> ----------------
> What happens if there is no pubnames or pubtypes? Do we want a separate
> path that actually manually goes through the DWARF and generates the
> correct info when these sections are missing?
>
> Does the GDB index really live only on the pubnames and pubtypes?


Yep. Well, /gnu/_pubnames/pubtypes


> How useful is the GDB index if it doesn't include static functions and
> private types?
>

gnu pubnames/pubtypes does include static functions and private types. Eric
may have more history here - but I think it was something to do with
pubnames/pubtypes being underspecified as to what it should contain, so it
was hard to rely on it (or maybe it was also that it didn't have these
things you mention)

eg:
namespace {
struct foo {
};
}

static void f1(foo) {
}

void f2() {
  f1(foo());
}

GCC:
.debug_gnu_pubnames contents:
length = 0x00000039 version = 0x0002 unit_offset = 0x00000000 unit_size =
0x0000005a
Offset     Linkage  Kind     Name
0x00000018 EXTERNAL TYPE     "(anonymous namespace)"
0x0000002d EXTERNAL FUNCTION "f2"
0x0000003f STATIC   FUNCTION "f1"

.debug_gnu_pubtypes contents:
length = 0x0000004e version = 0x0002 unit_offset = 0x00000000 unit_size =
0x0000005a
Offset     Linkage  Kind     Name
0x0000001d EXTERNAL TYPE     "(anonymous namespace)::foo"
0x0000001d EXTERNAL TYPE     "(anonymous namespace)::foo"

LLVM:
.debug_gnu_pubnames contents:
length = 0x00000039 version = 0x0002 unit_offset = 0x00000000 unit_size =
0x00000030
Offset     Linkage  Kind     Name
0x00000025 STATIC   FUNCTION "f1"
0x00000019 EXTERNAL FUNCTION "f2"
0x0000003c EXTERNAL TYPE     "(anonymous namespace)"

.debug_gnu_pubtypes contents:
length = 0x0000002e version = 0x0002 unit_offset = 0x00000000 unit_size =
0x00000030
Offset     Linkage  Kind     Name
0x0000003f EXTERNAL TYPE     "(anonymous namespace)::foo"


>
>
> https://reviews.llvm.org/D26283
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161207/af0ee0da/attachment.html>


More information about the llvm-commits mailing list