[PATCH] D23621: llvm-objdump: ELF: Handle code and data mix in all scenarios

khemant@codeaurora.org via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 14:47:33 PDT 2016


khemant added inline comments.

================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:1359
@@ +1358,3 @@
+              outs() << "\t";
+            }
+            Byte = Bytes.slice(Index)[0];
----------------
compnerd wrote:
> Cant this if be hoisted outside of the for loop?  `Index` should be `Start` at that point, and we can do this unconditionally as we know that `NumBytes` is zero prior to the for loop.
We cannot hoist this outside, because the byte stream is broken into 8 character byte sequences and then printer with printable characters. Then the carriage must return and then show the next offset and then start. Example:

      0:        00 7e 00 00 01 40 00 00         .~... at ..
       8:        89 42 00 00 cd 45 00 00         .B...E..
      10:        89 42 00 00 89 42 00 00         .B...B..
      18:        89 42 00 00 00 00 00 00         .B......

Hoisting it outside will only print first address, it will make finding a byte say 0x12 difficult.


Repository:
  rL LLVM

https://reviews.llvm.org/D23621





More information about the llvm-commits mailing list