Re: Line number at segfault
Jens.Toerring_at_physik.fu-berlin.de
Date: 05/19/04
- Next message: Karl Pech: "Re: problems with udp-client-program"
- Previous message: Francis: "Re: Line number at segfault"
- In reply to: Francis: "Re: Line number at segfault"
- Next in thread: Web Surfer: "Re: Line number at segfault"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 May 2004 15:40:35 GMT
Francis <fDONTSPAMgudin@nerreallydontim.net> wrote:
> Le 19-05-2004, Russell Shaw <rjshawN_o@s_pam.netspace.net.au> a écrit :
>> I'm using gcc 3.3.3 on debian.
>>
>> Is there any way to make the segfault of a C program
>> print out the file and line number it happened at?
If you can't load the core file into your debugger you can install
a signal handler for SIGSEGV and then use the backtrace() and
backtrace_symbols_fd( ) functions (see the info pages for libc)
to stderr (i.e. file descriptor 2). But of course you need to have
to program compiled with the '-g' option, otherwise all you can
get is a list of addresses, but no line numbers. And also note
that optimization can mess up the results.
Regards, Jens
-- \ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de \__________________________ http://www.toerring.de
- Next message: Karl Pech: "Re: problems with udp-client-program"
- Previous message: Francis: "Re: Line number at segfault"
- In reply to: Francis: "Re: Line number at segfault"
- Next in thread: Web Surfer: "Re: Line number at segfault"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|