Re: stack trace without core
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Fri, 22 Jun 2007 15:50:18 -0700
On Jun 22, 11:33 am, RezaRob <Reza...@xxxxxxxxx> wrote:
On Jun 22, 7:04 am, Jasen <j...@xxxxxxxxxxx> wrote:
On 2007-06-22, RezaRob <Reza...@xxxxxxxxx> wrote:
Is there a way to generate a brief view of the stack without dumping
entire core?
attach gdb to the process?
This isn't an option because it's in "production mode" and only in the
event of an exception I need a stack trace.
The simplest solution is to 'fork' and have the child call 'abort' to
generate a core dump. There are more complex solutions.
If you dynamically link and keep symbols, you can 'fork' and have the
child dump its stack directly. The idea is to call
'__builtin_return_address' and then call 'dladdr' on the address you
get back.
Note that if you have a real exception, you can't rely on anything
working because your process environment might be corrupt. For
example, after you 'fork', you should probably set all fatal signal
handlers to their default in the child. (You don't want to invoke your
own stack dump routine if the stack dump routine faults!)
DS
.
- Follow-Ups:
- References:
- stack trace without core
- From: RezaRob
- Re: stack trace without core
- From: Jasen
- Re: stack trace without core
- From: RezaRob
- stack trace without core
- Prev by Date: Re: My way to check if a progam is already running
- Next by Date: Re: stack trace without core
- Previous by thread: Re: stack trace without core
- Next by thread: collecting "oobs" message for user applications (WAS: Re: stack trace without core)
- Index(es):
Relevant Pages
|