[PATCH] D114818: [libunwind] Fix unwind_leaffunction test
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 19:08:35 PST 2021
leonardchan updated this revision to Diff 391528.
leonardchan edited the summary of this revision.
Herald added subscribers: pengfei, kristof.beyls.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114818/new/
https://reviews.llvm.org/D114818
Files:
libunwind/test/unwind_leaffunction.pass.cpp
Index: libunwind/test/unwind_leaffunction.pass.cpp
===================================================================
--- libunwind/test/unwind_leaffunction.pass.cpp
+++ libunwind/test/unwind_leaffunction.pass.cpp
@@ -39,11 +39,17 @@
}
__attribute__((noinline)) void crashing_leaf_func(void) {
- raise(SIGSEGV);
+ // libunwind searches for the address before the return address which points
+ // to the trap instruction. NOP guarantees the trap instruction is not the
+ // first instruction of the function.
+ // We should keep this here for other unwinders that also decrement pc.
+ __asm__ __volatile__("nop");
+ __builtin_trap();
}
int main(int, char**) {
- signal(SIGSEGV, signal_handler);
+ signal(SIGTRAP, signal_handler);
+ signal(SIGILL, signal_handler);
crashing_leaf_func();
return -2;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114818.391528.patch
Type: text/x-patch
Size: 824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211203/15889f03/attachment.bin>
More information about the llvm-commits
mailing list