1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 08:37:38 +01:00

Fix up a little so it's silent by default.

(Logical change 1.259)
This commit is contained in:
hp.com!davidm 2004-08-31 13:59:10 +00:00
parent 3b57368f67
commit f789a1e1d1

View file

@ -1,5 +1,5 @@
/* libunwind - a platform-independent unwind library
Copyright (C) 2001-2003 Hewlett-Packard Co
Copyright (C) 2001-2004 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
Permission is hereby granted, free of charge, to any person obtaining
@ -21,7 +21,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/* This shows how to use the unwind interface to modify any ancestor
/* This test uses the unwind interface to modify the IP in an ancestor
frame while still returning to the parent frame. */
#include <signal.h>
@ -33,6 +33,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define panic(args...) \
{ fprintf (stderr, args); exit (-1); }
int verbose;
static void
sighandler (int signal)
{
@ -40,6 +42,7 @@ sighandler (int signal)
unw_word_t ip;
unw_context_t uc;
if (verbose)
printf ("caught signal %d\n", signal);
unw_getcontext (&uc);
@ -81,13 +84,19 @@ doit (volatile char *p)
ch = *p; /* trigger SIGSEGV */
if (verbose)
printf ("doit: finishing execution!\n");
}
int
main (int argc, char **argv)
{
if (argc > 1)
verbose = 1;
signal (SIGSEGV, sighandler);
doit (0);
if (verbose)
printf ("SUCCESS\n");
return 0;
}