mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-29 02:07:39 +01:00
Fix up a little so it's silent by default.
(Logical change 1.259)
This commit is contained in:
parent
3b57368f67
commit
f789a1e1d1
1 changed files with 13 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* libunwind - a platform-independent unwind library
|
/* 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>
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
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
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
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. */
|
frame while still returning to the parent frame. */
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -33,6 +33,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
#define panic(args...) \
|
#define panic(args...) \
|
||||||
{ fprintf (stderr, args); exit (-1); }
|
{ fprintf (stderr, args); exit (-1); }
|
||||||
|
|
||||||
|
int verbose;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sighandler (int signal)
|
sighandler (int signal)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +42,7 @@ sighandler (int signal)
|
||||||
unw_word_t ip;
|
unw_word_t ip;
|
||||||
unw_context_t uc;
|
unw_context_t uc;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
printf ("caught signal %d\n", signal);
|
printf ("caught signal %d\n", signal);
|
||||||
|
|
||||||
unw_getcontext (&uc);
|
unw_getcontext (&uc);
|
||||||
|
@ -81,13 +84,19 @@ doit (volatile char *p)
|
||||||
|
|
||||||
ch = *p; /* trigger SIGSEGV */
|
ch = *p; /* trigger SIGSEGV */
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
printf ("doit: finishing execution!\n");
|
printf ("doit: finishing execution!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
if (argc > 1)
|
||||||
|
verbose = 1;
|
||||||
|
|
||||||
signal (SIGSEGV, sighandler);
|
signal (SIGSEGV, sighandler);
|
||||||
doit (0);
|
doit (0);
|
||||||
|
if (verbose)
|
||||||
|
printf ("SUCCESS\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue