Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Nov 2002 18:50:35 +0100
From:      Daniel Lundqvist <daniel@malarhojden.nu>
To:        freebsd-hackers@freebsd.org
Subject:   stacktrace for running program.
Message-ID:  <20021118175035.GA86600@malarhojden.nu>

next in thread | raw e-mail | index | archive | help
Hi,

I apologize if this is not the right list for this kind of questions,please
point me to a better one that is the case.

Now,what I want to do is to generate stack traces from a running program.
That is no problem with gcc's __builtin_frame_address function. But
I'm having problem getting that to work from a signal handler,in this case
for SIGSEGV.

Output from test program:

bash-2.05b$ ./dump 
looking up address 0x80488c4 in frame 0xbfbff6a8
looking up address 0xbfbfffac in frame 0xbfbff870
looking up address 0x8048621 in frame 0xbfbff8bc
ext Stack: handle_SEGV_ext 0xbfbfffac _start 
Abort trap (core dumped)

address is the return address of previous function called and frame is
the stack frame.

I generate the SEGV from main. But as you can see I can't get the address
of the function that generated the signal/exception/trap.
I tried looking into /sys/i386/i386/trap.c to look for hints on how to get
the adress where the fault happened,but I was kind of lost :)

So my question is,is it possible to find out the address where a fault occured
from userspace?

Please reply to me directly since I'm not on the list.

Thanks in advance,
Daniel Lundqvist

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021118175035.GA86600>