[PATCH] D114818: [libunwind] Fix unwind_leaffunction test
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 3 11:21:44 PST 2021
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf178a05f2204: [libunwind] Fix unwind_leaffunction test (authored by leonardchan).
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.391682.patch
Type: text/x-patch
Size: 824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211203/1f17dce7/attachment.bin>
More information about the llvm-commits
mailing list