This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfutil] Add accelerator tables to dwarfutil
ClosedPublic

Authored by avl on Dec 8 2022, 8:39 AM.

Details

Summary

This patch allows llvm-dwarfutil to utilize accelerator tables
generation code from DWARFLinker. It adds command line option:

--build-accelerator [none,DWARF]
                        Build accelerator tables(default: none)
  =none - Do not build accelerators
  =DWARF - Build accelerator tables according to the resulting DWARF version
       DWARFv4: .debug_pubnames and .debug_pubtypes
       DWARFv5: .debug_names

Diff Detail

Event Timeline

avl created this revision.Dec 8 2022, 8:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 8:39 AM
avl requested review of this revision.Dec 8 2022, 8:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 8:39 AM
Herald added a subscriber: MaskRay. · View Herald Transcript

So all debuggers ignore .debug_pubnames and .debug_pubtypes so I don't see any reasons to add them to any binaries. Even if llvm-dwarfutil creates full versions of these accelerator tables, no debuggers will use them. So I am wondering if we should just not emit them. That being said, LLDB _will_ use the Apple accelerator tables (.apple_XXX) if we can generate them. I created the Apple accelerator tables many years ago and the .debug_names were influenced by the Apple tables when they were added to the DWARF specification. So at least LLDB knows it can trust the Apple accelerator tables if they are there. And everyone can trust the .debug_names section. So I would suggest we emit either .debug_names all the time, even for DWARF4 and earlier or emit apple accelerator tables instead of the older .debug_pubXXX sections.

avl added a comment.Dec 9 2022, 3:55 AM

yes, we can use .debug_names always(and add using pubnames or apple_XXX when it becomes necessary). will update the patch accordingly.

avl updated this revision to Diff 483738.Dec 17 2022, 4:04 AM

addressed comment: use .debug_names for all DWARF versions.

JDevlieghere added inline comments.Jan 4 2023, 10:48 AM
llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
385–395

Do we still need a list here? I presume this is a remnant of having the debug_pub{names,types} which could co-exist. It seems unlikely that without those we'll ever need more than one concurrent accelerator table type.

This would also make it easier to improve the warning below (line 377) and specify what type of accelerator table the input will be replaced by.

avl added inline comments.Jan 4 2023, 12:58 PM
llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
385–395

Usage of list of accelerator tables was introduced not only for debug_pub{names,type} tables. It would be useful if/when additional tables like .gdb_index and/or .debug_cu_index would be implemented. So it looks it would be good to preserve this interface.

if the warning on 377 line looks unclear, how about replacing it with something like this :

Accelerator tables Table1, Table2 will be replaced with Table3, Table 4?

JDevlieghere accepted this revision.Jan 4 2023, 1:00 PM

LGTM

llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
385–395

Ok. I don't feel strongly about the warning, but I think if it's easy to be explicit about the tables that we're generating, that'd be nice.

This revision is now accepted and ready to land.Jan 4 2023, 1:00 PM
clayborg accepted this revision.Jan 4 2023, 5:01 PM
This revision was landed with ongoing or failed builds.Jan 16 2023, 5:49 AM
This revision was automatically updated to reflect the committed changes.
llvm/test/tools/llvm-dwarfutil/ELF/X86/warning-pubtypes.test