[dwarfdump] Skip 'stripped' sections
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 26 Sep 2017 14:22:35 +0000 (14:22 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 26 Sep 2017 14:22:35 +0000 (14:22 +0000)
commit8af2387b91cfcc1ac152f55307b86d76bbd55170
tree7e7a74bf28f3aec26d8e50a6a2483491d8b50dc0
parentdac6fd41704ba16c39584183895079032e7bb99a
[dwarfdump] Skip 'stripped' sections

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.

Differential revision: https://reviews.llvm.org/D38135

llvm-svn: 314208
llvm/include/llvm/Object/MachO.h
llvm/include/llvm/Object/ObjectFile.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/Object/ObjectFile.cpp
llvm/test/tools/llvm-dwarfdump/X86/Inputs/empty.dSYM [new file with mode: 0644]
llvm/test/tools/llvm-dwarfdump/X86/stripped.test [new file with mode: 0644]