This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
collecting data from a coring process
- From: Paul Marquess <Paul dot Marquess at owmobility dot com>
- To: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Fri, 26 Aug 2016 09:06:17 +0000
- Subject: collecting data from a coring process
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Paul dot Marquess at owmobility dot com;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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