[llvm-readobj] Fix bugs with unrecognized types in switch statements
authorRyan Prichard <rprichard@google.com>
Fri, 26 Oct 2018 23:01:54 +0000 (23:01 +0000)
committerRyan Prichard <rprichard@google.com>
Fri, 26 Oct 2018 23:01:54 +0000 (23:01 +0000)
commit0c20b5be7cf7039dc307f135318d537a187d3cc3
tree167b99af0b6cd98540e131b67bdc2122a2eae5bb
parent20d5a867937c1db29b22b754ee86caae2c68eca9
[llvm-readobj] Fix bugs with unrecognized types in switch statements

Summary:
Add missing breaks. Several functions used nested switch statements,
where the outer switch branches based on the architecture, and the inner
switch handles architecture-specific types. If the type isn't
architecture-specific, break out to the generic types rather than fall
through.

getElfPtType: For GNU-style output, llvm-readobj prints
"<unknown>: 0xnnnnnnnn" for an unrecognized segment type, unless the
architecture is EM_ARM, EM_MIPS, or EM_MIPS_RS3_LE, in which case it
prints "". This behavior appears accidental, so instead, always print
the "<unknown>: 0xnnnnnnnn" string.

Reviewers: pcc, grimar

Reviewed By: grimar

Subscribers: sdardis, javed.absar, arichardson, kristof.beyls, atanasyan, llvm-commits

Differential Revision: https://reviews.llvm.org/D53730

llvm-svn: 345436
llvm/tools/llvm-readobj/ELFDumper.cpp