[PATCH] D114818: [libunwind] Fix unwind_leaffunction test
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 10:32:27 PST 2021
leonardchan added a comment.
> Interesting it works on Ubuntu20.04/Aarch64, I compile the code with ToT clang or gcc-10.
> could you share an objdump of main?
00000000002134ac <_Z18crashing_leaf_funcv>:
; _Z18crashing_leaf_funcv():
2134ac: 20 00 20 d4 brk #0x1
2134b0: c0 03 5f d6 ret
00000000002134b4 <main>:
; main():
2134b4: ff c3 00 d1 sub sp, sp, #48
2134b8: fd 7b 02 a9 stp x29, x30, [sp, #32]
2134bc: fd 83 00 91 add x29, sp, #32
2134c0: bf c3 1f b8 stur wzr, [x29, #-4]
2134c4: a0 83 1f b8 stur w0, [x29, #-8]
2134c8: e1 0b 00 f9 str x1, [sp, #16]
2134cc: a0 00 80 52 mov w0, #5
2134d0: 01 00 00 90 adrp x1, 0x213000 <main+0x1c>
2134d4: 21 80 11 91 add x1, x1, #1120
2134d8: e1 07 00 f9 str x1, [sp, #8]
2134dc: f9 0f 00 94 bl 0x2174c0 <signal at plt>
2134e0: e1 07 40 f9 ldr x1, [sp, #8]
2134e4: 80 00 80 52 mov w0, #4
2134e8: f6 0f 00 94 bl 0x2174c0 <signal at plt>
2134ec: f0 ff ff 97 bl 0x2134ac <_Z18crashing_leaf_funcv>
2134f0: 20 00 80 12 mov w0, #-2
2134f4: fd 7b 42 a9 ldp x29, x30, [sp, #32]
2134f8: ff c3 00 91 add sp, sp, #48
2134fc: c0 03 5f d6 ret
>> void func() {
>> crashing_leaf_func();
>> }
>>
>> 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?
>
> here `func` will tail call `crashing_leaf_func` so it is expected to not be visible during the unwind because the return address will point to somewhere in main.
Would this still be expected if I added another layer of function calls? That is:
void crashing_leaf_func() {
__builtin_trap();
}
void func() {
crashing_leaf_func();
}
void func2() {
func();
}
int main() {
signal(SIGTRAP, signal_handler);
signal(SIGILL, signal_handler);
func2();
return 2;
}
In this example, I hit `crashing_leaf_func`, `func2`, and `main`, missing only `func`.
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