[libcxx-commits] [PATCH] D114818: [libunwind] Fix unwind_leaffunction test

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 30 13:09:49 PST 2021


ldionne created this revision.
ldionne added reviewers: danielkiss, leonardchan.
Herald added a project: libunwind.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libunwind.
ldionne requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The test was broken because the leaf function was made into a non-leaf
function. This commit uses __builtin_trap() to crash the program without
calling another function. This patch is in response to comments on
https://reviews.llvm.org/D114385.


Repository:
  rG LLVM Github Monorepo

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
@@ -38,12 +38,15 @@
   _Exit(-1);
 }
 
+// This function must crash without calling any other function, since
+// it must be a leaf function.
 __attribute__((noinline)) void crashing_leaf_func(void) {
-  raise(SIGSEGV);
+  __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.390804.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211130/7cf986bf/attachment-0001.bin>


More information about the libcxx-commits mailing list