From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32163 invoked by alias); 23 Sep 2003 05:03:34 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 32156 invoked from network); 23 Sep 2003 05:03:33 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 23 Sep 2003 05:03:33 -0000 Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.22) id 1A1fKW-0004Hc-T0; Tue, 23 Sep 2003 01:03:17 -0400 Date: Tue, 23 Sep 2003 05:03:00 -0000 Message-Id: From: Eli Zaretskii To: "Robin Rowe" CC: gdb@sources.redhat.com In-reply-to: <0ca201c3814a$8e899490$0200a8c0@tbird> (rower@MovieEditor.com) Subject: Re: Crash log Reply-to: Eli Zaretskii References: <0ca201c3814a$8e899490$0200a8c0@tbird> X-SW-Source: 2003-09/txt/msg00289.txt.bz2 > From: "Robin Rowe" > 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.