[PATCH] D114818: [libunwind] Fix unwind_leaffunction test

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 1 02:10:44 PST 2021


mstorsjo added a comment.

In D114818#3162717 <https://reviews.llvm.org/D114818#3162717>, @leonardchan wrote:

> Then the test passes, but it looks like unwinder skips past `func` (it jumps from `_Z18crashing_leaf_funcv` to `main`). Perhaps all this hints at an underlying issue in libunwind?

Is this a case where a function ends with a call instruction, and the return address points at the address after the call instruction, which would be the first instruction of the next function?

Can you provide disassembly of the linked binary (of the relevant functions) plus corresponding unwind info dumps (from e.g. llvm-dwarfdump)?

And/or, is this an issue where a tail call optimization makes the unwind stack entirely skip past a specific function in the stack?

What happens if you add e.g. a `__asm__ __volatile__("nop");` after the call to `__builtin_trap()`, and in `func()` where you call `crashing_leaf_func()`? That would add one extra instruction to the function (and should avoid any tail call optimizations) so that the return address (in the case of `func()`) or the program counter (in the case of the trap, if it points at the next instruction) points within the range of the current function, instead of pointing at the first instruction of the next function?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114818



More information about the llvm-commits mailing list