diff --git a/tests/bt.c b/tests/bt.c index daed52f5..d73eeeed 100644 --- a/tests/bt.c +++ b/tests/bt.c @@ -15,6 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include +#include #include #include #include @@ -66,9 +67,23 @@ foo (void) printf ("[%d] ip=%p\n", i, buffer[i]); } +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; }