This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Generate .debug_names section when it makes sense
ClosedPublic

Authored by labath on Jul 17 2018, 5:28 AM.

Details

Summary

This patch makes us generate the debug_names section in response to some
user-facing commands (previously it was only generated if explicitly
selected via the -accel-tables option).

My goal was to make this work for DWARF>=5 (as it's an official part of
that standard), and also, as an extension, for DWARF<5 if one is
explicitly tuning for lldb as a debugger (because it brings a large
performance improvement there).

This is slightly complicated by the fact that the debug_names tables are
incompatible with the DWARF v4 type units (they assume that the type
units are in the debug_info section), and unfortunately, right now we
generate DWARF v4-style type units even for -gdwarf-5. For this reason,
I disable all accelerator tables if the user requested type unit
generation. I do this even for apple tables, as they have the same
problem (in fact generating type units for apple targets makes us crash
even before we get around to emitting the accelerator tables).

Diff Detail

Event Timeline

labath created this revision.Jul 17 2018, 5:28 AM
This revision is now accepted and ready to land.Jul 17 2018, 7:29 AM

This is slightly complicated by the fact that the debug_names tables are
incompatible with the DWARF v4 type units (they assume that the type
units are in the debug_info section), and unfortunately, right now we
generate DWARF v4-style type units even for -gdwarf-5.

yeah, sorry, I am working on it. However the dumper has the v4 style embedded very deeply, and the refactoring is taking a long time.
(I mean, *emitting* v5 type units in .debug_info would be pretty easy; it's the dumper that's taking all the effort, and I'm unwilling to emit DWARF that we can't dump.)

probinson added inline comments.Jul 17 2018, 8:14 AM
test/DebugInfo/X86/string-offsets-table.ll
96

I take it there's another string to check here? Please add that check.

labath updated this revision to Diff 155895.Jul 17 2018, 8:42 AM

Updated the test to include the two extra strings that are used from the
debug_names table.

labath marked an inline comment as done.Jul 17 2018, 8:50 AM
labath added inline comments.
test/DebugInfo/X86/string-offsets-table.ll
96

Yes, there are two more strings now which are used in the debug_names section.

BTW, this reminded me: We currently put all debug_str strings into the debug_str_offsets table. However, the strings, which are only used from the debug_names section (which can be most of them in split-dwarf), don't need/use the debug_str_offsets indirection as the debug_names section contains an embedded mini-offset-table.

Do you think it would make sense/be valid DWARF to restrict the debug_str_offsets table only to those strings which actually are referenced via the DW_FORM_strx and likes (in a separate patch, of course)?

probinson added inline comments.Jul 17 2018, 10:38 AM
test/DebugInfo/X86/string-offsets-table.ll
96

Yes, debug_str_offsets should ideally have only those strings referenced via DW_FORM_strx etc.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.