diff options
author | mostang.com!davidm <mostang.com!davidm> | 2002-04-25 06:47:29 +0000 |
---|---|---|
committer | mostang.com!davidm <mostang.com!davidm> | 2002-04-25 06:47:29 +0000 |
commit | 72e98c4610ffd161fff52c327482a455bd0e5d8b (patch) | |
tree | 136d4b97bd5b49711b0935a5a3b4ebb9ad350843 /tests | |
parent | 4d37950b2c182e7bc1de517aa27c9d87a28d5183 (diff) | |
download | libunwind-72e98c4610ffd161fff52c327482a455bd0e5d8b.tar.gz |
(sighandler): New function.
(main): Install SIGTERM handler and send SIGTERM to self to test backtracing through
signal handler.
(Logical change 1.18)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bt.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -15,6 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include <execinfo.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <libunwind.h> @@ -67,8 +68,22 @@ foo (void) } int +sighandler (int signal, void *siginfo, struct sigcontext *sc) +{ + void *buffer[20]; + int n; + + printf ("sighandler: got signal %d @ %lx\n", signal, sc->sc_ip); + + do_backtrace(); +} + +int main (int argc, char **argv) { foo (); + + signal (SIGTERM, sighandler); + kill (getpid (), SIGTERM); return 0; } |