This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo/llvm-objdump] - Print "ZERO terminator" for terminator entries when dumping .eh_frame.
ClosedPublic

Authored by grimar on May 23 2020, 9:17 AM.

Details

Summary

A CIE with the Length == 0 is a terminator:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

And GNU objdump recognizes them and prints the following for such entries:

"00000000 ZERO terminator"

This patch teaches llvm-objdump to do the same. I had to update tests to use
"CHECK-NEXT" too.

(Note: it looks perhaps not right that printing is done inside the DebugInfo library,
I'd expect to see the change in the llvm-objdump's code somewhere instead,
but that is how it done atm).

Diff Detail

Event Timeline

grimar created this revision.May 23 2020, 9:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2020, 9:17 AM
MaskRay added inline comments.May 23 2020, 11:15 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
307

typo: section

308

binutils-gdb/binutils/dwarf.c:display_debug_frames displays ZERO terminator for both .eh_frame and .debug_frame. We can be consistent here.

grimar marked an inline comment as done.May 25 2020, 1:36 AM
grimar added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
308

This is something I am not sure in. I've not found in DWARF5 specification anything that says the length can be 0 for .debug_frame (e,g http://www.dwarfstd.org/doc/DWARF5.pdf, p174).

Being consistent is perhaps OK here, but it doesn't seem that .debug_frame is supposed to have a terminator? Probably we should not print "ZERO terminator" for .debug_frame (at least in this patch) then.

MaskRay accepted this revision.May 25 2020, 9:51 AM

Thanks!

llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
308

OK

This revision is now accepted and ready to land.May 25 2020, 9:51 AM
This revision was automatically updated to reflect the committed changes.
jhenderson added inline comments.May 27 2020, 1:10 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
307

Looks like this typo was never fixed?

grimar marked an inline comment as done.May 27 2020, 2:23 AM
grimar added inline comments.
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
307