[PATCH] D114385: [libunwind] Fix testing with sanitizers enabled

Daniel Kiss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 30 08:47:28 PST 2021


danielkiss added inline comments.


================
Comment at: libunwind/test/unwind_leaffunction.pass.cpp:41-43
 __attribute__((noinline)) void crashing_leaf_func(void) {
-  *faultyPointer = 0;
+  raise(SIGSEGV);
 }
----------------
danielkiss wrote:
> ldionne wrote:
> > danielkiss wrote:
> > > adding a call here turns the leaf function into a not-leaf function which changes the intention of this test.
> > > 
> > Ugh, that's a good point. I'm not sure how to trigger `SIGSEGV` without invoking a function nor invoking undefined behavior. Do you have a suggestion?
> > 
> > Would using `__builtin_trap()` do any kind of good?
> `__builtin_trap()` looks good from codegen / unwind info point of view.
> 
> it generates SIGILL on X86, while SIGSEGV on Aarch64 but with the below change it should work.
>  
> ```
> int main(int, char**) {
>   signal(SIGSEGV, signal_handler);
>   signal(SIGILL, signal_handler);
> ```
mybad, it is SIGTRAP on linux/aarch64. 
  signal(SIGTRAP, signal_handler);
  signal(SIGILL, signal_handler);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114385



More information about the llvm-commits mailing list