Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: vijay nag <vijunag@gmail.com>
To: Paul Marquess <Paul.Marquess@owmobility.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: collecting data from a coring process
Date: Fri, 26 Aug 2016 12:01:00 -0000	[thread overview]
Message-ID: <CAKhyrx_9GnLTBDKkhW_y4QG+f3xV_SL-Vtg0WN+vU6UXnY-qLA@mail.gmail.com> (raw)
In-Reply-To: <CY1PR0501MB11783F479AF7D639A82FE02F95EC0@CY1PR0501MB1178.namprd05.prod.outlook.com>

On Fri, Aug 26, 2016 at 2:36 PM, Paul Marquess
<Paul.Marquess@owmobility.com> wrote:
> I have an existing Linux application that uses gdb to collect data from a process if it cores. Currently I've been doing that with gdb after the core is written to disk. No problem there.
>
> The requirements have now changed and it won't be possible to allow the core file to be written to disk. That means I need a way to (somehow) get gdb to collect the data while the process is still in memory.
>
> My first thought was to add a script in /proc/sys/kernel/core_pattern to catch the process as it is coring. Then I get gdb to attach to the PID of the process that is about to core. Unfortunately, when I tried that, gdb gives me this error
>
>     Unable to attach: program terminated with signal SIGSEGV, Segmentation fault.
>     No stack.
>
> That seems to imply that by the time /proc/sys/kernel/core_pattern kicks in it is too late to use the PID with gdb.
>
> Anyone know of a way to do this? Preferably one that doesn't involve changing the process itself.
>
> cheers
> Paul
You can do one of the following

1) Why not dump the information that you are looking for into a file
in the process signal handler ?
2) RTFM core file piping on linux (Probably you've done this already
?) - The idea may seem dangerous, but you can try inserting sleep in
the script for sometime till you gather whatever information that is
required.


  reply	other threads:[~2016-08-26 12:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26  9:06 Paul Marquess
2016-08-26 12:01 ` vijay nag [this message]
2016-08-26 12:33   ` Paul Marquess
2016-08-28  7:48     ` Dmitry Samersoff
2016-09-05 11:10       ` Paul Marquess
2016-09-05 22:17         ` Samuel Bronson
2016-09-05 23:19           ` Paul Marquess
     [not found]             ` <CAJYzjmf0a2Dd8XbOQaO3937Bcab1AW9gVp=r3mKSgUq_27G8ow@mail.gmail.com>
2016-09-06 16:41               ` Paul Marquess
2016-09-07 19:22                 ` Samuel Bronson
2016-09-07 22:10                   ` Paul Marquess
     [not found]         ` <d327752e-89f6-c5a3-6d72-4789b106e1f6@samersoff.net>
2016-09-08 17:12           ` Paul Marquess
2016-09-01  4:23     ` David Niklas
2016-09-05 10:59       ` Paul Marquess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKhyrx_9GnLTBDKkhW_y4QG+f3xV_SL-Vtg0WN+vU6UXnY-qLA@mail.gmail.com \
    --to=vijunag@gmail.com \
    --cc=Paul.Marquess@owmobility.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox