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

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 09:36:06 PST 2016


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? How useful is the GDB index if it doesn't include static functions and private types? 


https://reviews.llvm.org/D26283





More information about the llvm-commits mailing list