diff options
author | Fangrui Song <i@maskray.me> | 2024-09-25 10:32:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 10:32:40 -0700 |
commit | abe0dd195a3b2630afdc5c1c233eb2a068b2d72f (patch) | |
tree | 17b462f55d4e185ade83d93325fc90f0f48b9b99 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 3c348bf5435896bea70f613d9bdcc542201075b4 (diff) | |
download | llvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.zip llvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.tar.gz llvm-abe0dd195a3b2630afdc5c1c233eb2a068b2d72f.tar.bz2 |
[llvm-objdump] Print ... even if a data mapping symbol is active
Swap `!DisassembleZeroes` and `if (DumpARMELFData)` conditions so that
in the false DisassembleZeroes case (default), `...` will be printed for
long consecutive zeroes, even when a data mapping symbol is active.
This is especially useful for certain lld tests that insert a huge
padding within a code section. Without `...` the output will be huge.
Pull Request: https://github.com/llvm/llvm-project/pull/109553
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index b69d14b..8073c89 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2244,27 +2244,28 @@ disassembleObject(ObjectFile &Obj, const ObjectFile &DbgObj, return false; }; + // When -z or --disassemble-zeroes are given we always dissasemble + // them. Otherwise we might want to skip zero bytes we see. + if (!DisassembleZeroes) { + uint64_t MaxOffset = End - Index; + // For --reloc: print zero blocks patched by relocations, so that + // relocations can be shown in the dump. + if (InlineRelocs && RelCur != RelEnd) + MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index, + MaxOffset); + + if (size_t N = + countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) { + FOS << "\t\t..." << '\n'; + Index += N; + continue; + } + } + if (DumpARMELFData) { Size = dumpARMELFData(SectionAddr, Index, End, Obj, Bytes, MappingSymbols, *DT->SubtargetInfo, FOS); } else { - // When -z or --disassemble-zeroes are given we always dissasemble - // them. Otherwise we might want to skip zero bytes we see. - if (!DisassembleZeroes) { - uint64_t MaxOffset = End - Index; - // For --reloc: print zero blocks patched by relocations, so that - // relocations can be shown in the dump. - if (InlineRelocs && RelCur != RelEnd) - MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index, - MaxOffset); - - if (size_t N = - countSkippableZeroBytes(Bytes.slice(Index, MaxOffset))) { - FOS << "\t\t..." << '\n'; - Index += N; - continue; - } - } if (DumpTracebackTableForXCOFFFunction && doesXCOFFTracebackTableBegin(Bytes.slice(Index, 4))) { |