Getting the registers of the program in a signal handler

2006-07-02 Thread Gilad Ben-Yossef
Howdie list, I'm trying to build the be-old, end-all exception signal signal handler for SIGSEGV, SIGILL, SIGFPE and their ilk. One thing that will be useful to do in such a handler is dump the state of the CPU registers when and where the program segfauled etc. Sadly, despite zealous code

Re: Getting the registers of the program in a signal handler

2006-07-02 Thread Muli Ben-Yehuda
On Sun, Jul 02, 2006 at 02:12:39PM +0300, Gilad Ben-Yossef wrote: Howdie list, I'm trying to build the be-old, end-all exception signal signal handler for SIGSEGV, SIGILL, SIGFPE and their ilk. One thing that will be useful to do in such a handler is dump the state of the CPU registers

Re: Getting the registers of the program in a signal handler

2006-07-02 Thread Ami Chayun
The only way I know of is becoming a registered debugger with ptrace, and using the uber ability: ptrace(( __ptrace_request )PTRACE_GETREGS, pid, 0, regs) If the program is not being debugged externally, you can try to attach inside the handler, if you succeed, getting the registers. Hope

Re: Getting the registers of the program in a signal handler

2006-07-02 Thread Gilad Ben-Yossef
Muli Ben-Yehuda wrote: On Sun, Jul 02, 2006 at 02:12:39PM +0300, Gilad Ben-Yossef wrote: I'm trying to build the be-old, end-all exception signal signal handler for SIGSEGV, SIGILL, SIGFPE and their ilk. One thing that will be useful to do in such a handler is dump the state of the CPU

Re: Getting the registers of the program in a signal handler

2006-07-02 Thread Amos Shapira
On 02/07/06, Gilad Ben-Yossef [EMAIL PROTECTED] wrote: Muli Ben-Yehuda wrote: On Sun, Jul 02, 2006 at 02:12:39PM +0300, Gilad Ben-Yossef wrote: I'm trying to build the be-old, end-all exception signal signal handler for SIGSEGV, SIGILL, SIGFPE and their ilk. One thing that will be useful to do