This is the mail archive of the
mailing list for the GDB project.
Re: Crash log
- From: Eli Zaretskii <eliz at elta dot co dot il>
- To: "Robin Rowe" <rower at MovieEditor dot com>
- Cc: gdb at sources dot redhat dot com
- Date: 23 Sep 2003 08:05:13 +0200
- Subject: Re: Crash log
- References: <0ca201c3814a$8e899490$0200a8c0@tbird>
- Reply-to: Eli Zaretskii <eliz at elta dot co dot il>
> From: "Robin Rowe" <rower@MovieEditor.com>
> Date: Mon, 22 Sep 2003 13:46:08 -0700
> When a program catches a bad signal such as SIGSEGV I want to write a crash
> log entry before the program exits. Is there anything useful I can put in
> the log besides the name of the program and when it crashed?
Yes, you can put there the address of the faulting instruction. Use
the Posix `sigaction' rather than `signal' to install the signal
handler, and you will have access to the siginfo_t structure which
gives the address of the memory location that caused the fault and
other useful info.
Some systems have extensions to `signal' that allow the signal
handlers to access the same information.
> Is it ok to
> write this log from my signal catcher, or should it first fork?
It's probably okay in most cases to do this without forking, although
some calamities such as smashed stack might cause another fault in the
code that writes the data. But then fork will probably fail in that
case as well.