[PATCH] D131709: [libunwind][AIX] Implement _Unwind_FindEnclosingFunction() using traceback table on AIX

Xing Xue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 10:50:26 PDT 2022


xingxue marked 3 inline comments as done.
xingxue added inline comments.


================
Comment at: libunwind/src/UnwindLevel1-gcc-ext.c:92
+  // traceback table.
+  uint32_t *p = (uint32_t *)pc;
+
----------------
compnerd wrote:
> Should we use `uintptr_t` here instead of `uint32_t`?
`p` is for searching for word `0` from instruction `pc` and the length of PowerPC instructions is one word (32-bit) regardless of whether it is in 32-bit or 64-bit mode, so we need to use `uint32_t`.


================
Comment at: libunwind/src/UnwindLevel1-gcc-ext.c:93
+  uint32_t *p = (uint32_t *)pc;
+
+  // Keep looking forward until a word of 0 is found. The traceback
----------------
compnerd wrote:
> Should we protect against `_Unwind_FindEnclosingFunction(NULL)`?
Good idea, thanks!


================
Comment at: libunwind/src/UnwindLevel1-gcc-ext.c:110
+    return (void *)((uintptr_t)TBTable - *p - sizeof(uint32_t));
+  else
+    return NULL;
----------------
compnerd wrote:
> Just drop the `else`, we return a value if the traceback table has offsets or we will return NULL.
Removed `else` as suggested, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131709



More information about the llvm-commits mailing list