204 kamil@chieftec /tmp/dumper $ cat test.c #include #include #include #include #include #include void handler(int sig) { printf("Hello from signal handler, captured=%s\n", signalname(sig)); _exit(0); } int main(int argc, char **argv) { int status; pid_t child, wpid; volatile int *trigger; trigger = (int *)(intptr_t)argc; child = fork(); if (child == 0) { signal(SIGSEGV, handler); *trigger = 0x0; _exit(1); } wpid = waitpid(child, &status, 0); assert(wpid == child); assert(WIFEXITED(status)); assert(WEXITSTATUS(status) == 0); return 0; } 205 kamil@chieftec /tmp/dumper $ file a.out.core a.out.core: cannot open `a.out.core' (No such file or directory) 206 kamil@chieftec /tmp/dumper $ gcc -g -O0 test.c 207 kamil@chieftec /tmp/dumper $ ./a.out Hello from signal handler, captured=SEGV 208 kamil@chieftec /tmp/dumper $ file a.out.core a.out.core: cannot open `a.out.core' (No such file or directory) 209 kamil@chieftec /tmp/dumper $ /public/picotrace/coredumper/coredumper -i ./a.out Hello from signal handler, captured=SEGV 210 kamil@chieftec /tmp/dumper $ file a.out.core a.out.core: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), NetBSD-style, from 'a.out', pid=2587, uid=1000, gid=100, nlwps=1, lwp=1 (signal 11/code 1) 211 kamil@chieftec /tmp/dumper $ lldb -c ./a.out.core ./a.out (lldb) target create "./a.out" --core "./a.out.core" Core file '/tmp/dumper/a.out.core' (x86_64) was loaded. (lldb) bt * thread #1, stop reason = signal SIGSEGV * frame #0: 0x0000000000400bd4 a.out`main(argc=1, argv=0x00007f7fffffe778) at test.c:28 frame #1: 0x0000000000400a9d a.out`___start + 280 (lldb) list 17 { 18 int status; 19 pid_t child, wpid; 20 volatile int *trigger; 21 22 trigger = (int *)(intptr_t)argc; 23 24 child = fork(); 25 if (child == 0) { 26 signal(SIGSEGV, handler); (lldb) 27 28 *trigger = 0x0; 29 30 _exit(1); 31 } 32 33 wpid = waitpid(child, &status, 0); 34 assert(wpid == child); 35 assert(WIFEXITED(status)); 36 assert(WEXITSTATUS(status) == 0); (lldb)