Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Crash log
@ 2003-09-22 20:46 Robin Rowe
  2003-09-23  5:03 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Rowe @ 2003-09-22 20:46 UTC (permalink / raw)
  To: gdb

Hi. This isn't really a gdb question, but I don't know where else to ask.

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? Is it ok to
write this log from my signal catcher, or should it first fork?

Is there some kind of useful state info (assuming the program contains no
debugging info) that I can write to a log file at the time of death? Can I
get an instruction pointer that I can relate back to the original souce
somehow to determine what line of code crashed?

Thanks!

Robin
---------------------------------------------------------------------------
Robin.Rowe@MovieEditor.com   Hollywood, California
www.CinePaint.org   Free motion picture and still image editing software


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Crash log
  2003-09-22 20:46 Crash log Robin Rowe
@ 2003-09-23  5:03 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2003-09-23  5:03 UTC (permalink / raw)
  To: Robin Rowe; +Cc: gdb

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-23  5:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-22 20:46 Crash log Robin Rowe
2003-09-23  5:03 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox