This is an archive of the discontinued LLVM Phabricator instance.

[dwarfdump] Skip 'stripped' sections
ClosedPublic

Authored by JDevlieghere on Sep 21 2017, 7:49 AM.

Details

Summary

When dsymutil generates the companion file, its strips all unnecessary
sections by omitting their body and setting the offset in their
corresponding load command to zero.

One such section is the .eh_frame section, as it contains runtime
information rather than debug information and is part of the __TEXT
segment. When reading this section, we would just read the number of
bytes specified in the load command, starting from offset 0 (i.e. the
beginning of the file).

Rather than trying to parse this obviously invalid section, dwarfdump
now skips this.

PS: The same thing occurs for tools like objdump when trying to dump or
disassemble stripped sections in the __TEXT segment. I will address this
in a separate patch.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Sep 21 2017, 7:49 AM
aprantl added inline comments.Sep 21 2017, 9:37 AM
lib/Object/MachOObjectFile.cpp
1931 ↗(On Diff #116188)

Can you add a big comment that contains the information explaining what/why this happens similar to what you wrote in the introduction of this review?

  • Add comment which explains the zero offset.
JDevlieghere marked an inline comment as done.Sep 22 2017, 3:48 AM
aprantl accepted this revision.Sep 25 2017, 9:04 AM
aprantl added inline comments.
lib/Object/MachOObjectFile.cpp
1932 ↗(On Diff #116323)

s/its/it/

1932 ↗(On Diff #116323)

I think it might be better to move the comment into the header so doxygen can pick it up.

This revision is now accepted and ready to land.Sep 25 2017, 9:04 AM
This revision was automatically updated to reflect the committed changes.