[PATCH] D142176: [libunwind] On Darwin, add a callback-based lookup scheme for JIT'd unwind info.

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 22:48:46 PST 2023


lhames added a comment.

Here's a potential testcase, for anyone who wants to try this out. You'll need to build LLVM, compiler-rt, and libunwind:

C++ source for testcase:

  int main(int argc, char *argv[]) {
    try {
      throw 42;
    } catch (int X) {
      return X;
    }
    return 0;
  }

This can be compiled and run under the `llvm-jitlink` test tool on Darwin with:

  % clang++ -c -o eh.o eh.cpp
  % DYLD_LIBRARY_PATH=/path/to/llvm-build/lib ORC_RT_DEBUG=1 llvm-jitlink -orc-runtime=/path/to/llvm-build/lib/clang/16/lib/darwin/liborc_rt_osx.a eh.o
  __unw_add/remove_find_dynamic_unwind_sections available. Using callback-based frame info lookup.
  ...

You can verify that the exception was caught and handled correctly by printing the return code:

  % echo $?
  42


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142176



More information about the llvm-commits mailing list