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

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 00:48:26 PDT 2021


Esme added inline comments.


================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:462
   DictScope DS(W, "StringTable");
   StringRef StrTable = Obj.getStringTable();
+  W.printNumber("Length (in bytes)", StrTable.size());
----------------
jhenderson wrote:
> What will happen if you try to call this when there is no string table? XCOFF32 doesn't require one as I understand it.
If there is no string table, we will get an empty string table, where the data pointer is nullptr and the size is zero.


================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:465
+  // Print strings from byte4, since the 0-3 bytes contain the length (in bytes)
+  // of the string table.
+  printAsStringList(StrTable, 4);
----------------
jhenderson wrote:
> I assume that the length includes the length field itself?
Yes, your comment is accurate. Thx!


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