collecting "oobs" message for user applications (WAS: Re: stack trace without core)



On Jun 22, 3:50 pm, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:
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

Sorry I didn't clarify this: It's okay for the main process to be
killed; however, it's core may be gigabytes huge, and I only want a
small "stack trace."

Really, I want some kind of "oobs!" message, like the one the kernel
dumps. I guess a signal handler can just copy the stack into a "core"
file, but then, how do you prevent gdb from complaining "this is not a
core file?"

Thank you so much for your responses.

Reza.

.



Relevant Pages

  • Re: Questions on ATTACHXs ETXR exit routine
    ... From that I it appears that the IRB is sharing the stack ... the system requires the ETXR to restore the regs. ... I'm using the ETXR for cleanup and to inform the originating task ... that a child has terminated. ...
    (bit.listserv.ibm-main)
  • Re: A filter driver with bus enumeration capabilities: aka serenum.
    ... Since your filter is not the power policy owner for the stack, it cannot ensure that when the child is powered up that the parent stack is also powered up....BUT...for serial that does not really matter b/c once you send the create to the serial stack from the child stack, serial will stay powered on until it has been closed. ... mark yourself as a filter, ...
    (microsoft.public.development.device.drivers)
  • Re: Scheme Virtual Machine
    ... Minimal c/c++ made core for the executable file everything else in the ... I had a similar idea in mind when writing my Implementation of scheme ... The VM uses a stack to pass arguments. ... executes an if operation with a 'then' and an 'else' branch. ...
    (comp.lang.scheme)
  • Re: Questions on ATTACHXs ETXR exit routine
    ... From that I it appears that the IRB is sharing the stack ... the system requires the ETXR to restore the regs. ... I'm using the ETXR for cleanup and to inform the originating task ... :>that a child has terminated. ...
    (bit.listserv.ibm-main)
  • RE: Weird one
    ... Solaris isn't Linux and there are a lot of potential differences under the ... There are a couple of ways that you can write and control the stack, ... On a multi-core /smp Linux box, does each CPU have its own stack or does ... Meaning if Thread A from the same process is on core 1, ...
    (comp.databases.informix)