[PATCH] D105522: [llvm-readobj][XCOFF] Fix the error dumping for the first item of StringTable.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 01:51:10 PDT 2021


jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM, with a couple of minor fixes.



================
Comment at: llvm/test/tools/llvm-readobj/XCOFF/string-table.yaml:28
+
+## The string table contians more than one entry.
+# RUN: yaml2obj --docnum=3 %s -o %t3
----------------
I'd put this test case first, then the single-byte case (because it's testing an edge case), and the empty case last.


================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:463-464
   StringRef StrTable = Obj.getStringTable();
-  printAsStringList(StrTable);
+  // Print strings from byte 4, since the first three bytes contain the length
+  // (in bytes) of the string table (including the length field).
+  printAsStringList(StrTable, 4);
----------------
Careful of off-by-one errors! Byte 0 is the first byte...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105522/new/

https://reviews.llvm.org/D105522



More information about the llvm-commits mailing list