Hi All When I try to catch SIGTERM and generate a core file the call stack is corrupted on FreeBSD. Yes I know that I do not have to catch the signal, a core is generated by default. But the reason is that I need to do more at SIGTERM. Example 1 In gdb backtrace, why is monitorSignalHandlerBUS listed? it is never called! test1.c --------- cut here ------- #include <stdio.h> #include <signal.h> static void monitorSignalHandlerBUS(int signo) { printf("monitorSignalHandlerBUS\n"); fflush(stdout); } static void monitorSignalHandlerTERM(int signo) { printf("monitorSignalHandlerTERM\n"); fflush(stdout); abort(); } int main(int argc, char **argv) { signal(SIGBUS, monitorSignalHandlerBUS); signal(SIGTERM, monitorSignalHandlerTERM); kill(getpid(), SIGTERM); } --------- cut here ------- is compiled on FreeBSD >cc -g test1.c -o test1 >./test1 monitorSignalHandlerTERM Abort (core dumped) >gdb test1 test1.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... Core was generated by `test1'. Program terminated with signal 6, Aborted. Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x280c237b in kill () from /lib/libc.so.5 (gdb) bt #0 0x280c237b in kill () from /lib/libc.so.5 #1 0x280b7422 in raise () from /lib/libc.so.5 #2 0x28129c1b in abort () from /lib/libc.so.5 #3 0x080486a8 in monitorSignalHandlerTERM (signo=15) at test1.c:15 #4 0xbfbfff94 in ?? () #5 0x0000000f in ?? () #6 0x00000000 in ?? () #7 0xbfbfe9d0 in ?? () #8 0x00000002 in ?? () #9 0x0804867c in monitorSignalHandlerBUS () at test1.c:9 #10 0x080485a5 in _start () #11 0x00000001 in ?? () (gdb) Example 2 In gdb backtrace, what is frame_dummy ? test2.c --------- cut here ------- #include <signal.h> static void SignalHandler(int signo) { abort(); } int main(int argc, char **argv) { signal(SIGTERM, SignalHandler); kill(getpid(), SIGTERM); } --------- cut here ------- is compiled on FreeBSD >cc -g test2.c -o test2 >./test2 Abort (core dumped) >gdb test2 test2.core GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... Core was generated by `test2'. Program terminated with signal 6, Aborted. Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x280c237b in kill () from /lib/libc.so.5 (gdb) bt #0 0x280c237b in kill () from /lib/libc.so.5 #1 0x280b7422 in raise () from /lib/libc.so.5 #2 0x28129c1b in abort () from /lib/libc.so.5 #3 0x080485cf in SignalHandler (signo=15) at test2.c:6 #4 0xbfbfff94 in ?? () #5 0x0000000f in ?? () #6 0x00000000 in ?? () #7 0xbfbfe9d0 in ?? () #8 0x00000002 in ?? () #9 0x080485c4 in frame_dummy () #10 0x08048519 in _start () #11 0x00000001 in ?? () (gdb) _______________________________________________________________________________________________________________ This e-mail communication (and any attachment/s) may contain confidential or privileged information and is intended only for the individual(s) or entity named above and to others who have been specifically authorized to receive it. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please notify the sender that you have received this e-mail in error by reply e-mail, and delete the e-mail subsequently. Thank you. _________________________________________________________________________________________________________________ Ce message (ainsi que le(s) fichier/s), transmis par courriel, peut contenir des renseignements confidentiels ou protégés et est destiné à l’usage exclusif du destinataire ci-dessus. Toute autre personne est par les présentes avisée qu’il est strictement interdit de le diffuser, le distribuer ou le reproduire. Si vous l’avez reçu par inadvertance, veuillez nous en aviser et détruire ce message. Merci. _________________________________________________________________________________________________________________
_______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"