[PATCH] D89049: [AIX][XCOFF] print out the traceback info

Xing Xue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 12:36:17 PDT 2023


xingxue added inline comments.


================
Comment at: llvm/lib/Object/XCOFFObjectFile.cpp:1479
     if (!ParmsTypeOrError) {
       Err = ParmsTypeOrError.takeError();
       return;
----------------
Wouldn't this dereference 0 if `!ParmsTypeOrError` is true?


================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:378
+  if (Remaining >= 8) {
+    while (Remaining > 0 && Bytes[Size - Remaining] == 0)
+      --Remaining;
----------------
If the remaining bytes are paddings, why do we differentiate if a padding is zero or not? Can we just print `...` or `... # Paddings` for paddings?


================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:352
+      PrintBytes(4 - Index % 4);
+      OS << "\t# Alignment padding for except info displacement";
+    }
----------------



================
Comment at: llvm/tools/llvm-objdump/XCOFFDump.cpp:356
+    PrintBytes(4);
+    OS << "\t# Except info displacement";
+    // Print another 4 bytes for 64 bit. The displacement (address) is 8 bytes
----------------



================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:1793
+            dumpTracebackTable(Bytes.slice(Index),
+                               SectionAddr + Index + VMAAdjustment, FOS, End,
+                               *STI, &Obj);
----------------
DiggerLin wrote:
> stephenpeckham wrote:
> > Programs are usually linked with a non-zero .text origin, so I think you need SectionAddr + End instead of End.  
> in the line 1629 ,End already includes the SectionAddr
> 
>  uint64_t End = std::min<uint64_t>(**SectionAddr + SectSize,** StopAddress);
> in the line 1629 ,End already includes the SectionAddr
> 
>  uint64_t End = std::min<uint64_t>(**SectionAddr + SectSize,** StopAddress);

@stephenpeckham's comment is still valid. Although `End` was initialized with `SectionAddr` added as you pointed out, `SectionAddr` was later subtracted from it in line 1649.
```
 End -= SectionAddr;
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89049



More information about the llvm-commits mailing list