This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB 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]

Re: Crash log


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]