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

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 05:20:00 PDT 2021


shchenz added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:56
 
-void ObjDumper::printAsStringList(StringRef StringContent) {
+void ObjDumper::printAsStringList(StringRef StringContent, uint8_t BeginByte) {
   const uint8_t *StrContent = StringContent.bytes_begin();
----------------
Can we add a comment about why we need to set start at `StrContent + StringSizeFieldLength`? 

Also can we add a line at the beginning of the string table to show the size of the string table?


================
Comment at: llvm/tools/llvm-readobj/ObjDumper.cpp:68
     }
     W.startLine() << format("[%6tx] ", CurrentWord - StrContent);
     printAsPrintable(W.startLine(), CurrentWord, WordSize);
----------------
The output is shown as hexadecimal data, but there is no "0x" prefix for the data, we should add the prefix or use decimal data?


================
Comment at: llvm/tools/llvm-readobj/ObjDumper.h:113
 
-  void printAsStringList(StringRef StringContent);
+  void printAsStringList(StringRef StringContent, uint8_t BeginByte = 0);
 
----------------
Maybe a more meaningful name would be `StringSizeFieldLength`?


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