This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
#include <stddef.h> #include <signal.h> #include <stdio.h> #include <unistd.h> #include <execinfo.h>
void handler (int signum) { void *trace[50]; int depth = backtrace (trace, 50), i; char **str;
str = backtrace_symbols (trace, depth); for (i = 0; i < depth; i++) printf ("%s\n", str[i]);
_exit (1); }
int main (void) { int * foo = NULL;
signal (SIGSEGV, handler);
*foo = 42; return 0; }
$ gcc a.c -m64 -g && ./a.out ./a.out [0x40060e] /lib/libc.so.6 [0x2aeb0d8c2110] ./a.out [0x40067b] /lib/libc.so.6(__libc_start_main+0xda) [0x2aeb0d8af4ca] ./a.out [0x40052a]
$ gcc a.c -m32 -g && ./a.out ./a.out [0x80484a3] [0xffffe500] /lib32/libc.so.6(__libc_start_main+0xd3) [0xf7e0cea3] ./a.out [0x80483d1]
Thanks for your help, FX
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |