Folks,
If I use gdb to attach to a running process, do some stuff, exit while
leaving process running, but I want to take a core dump of the process
before leaving gdb, how might I do that? When I try "shell gcore [pid]"
from within gdb, gcore complains that process is being traced (which it
is I suppose). Any thoughts on how to get this core dump without killing
the process being debugged?
Chris
|
|
0
|
|
|
|
Reply
|
Chris
|
7/10/2004 6:43:37 AM |
|
Chris Markle <cmarkle@sendmail.com> writes:
> If I use gdb to attach to a running process, do some stuff, exit while
> leaving process running, but I want to take a core dump of the process
> before leaving gdb, how might I do that? When I try "shell gcore
> [pid]" from within gdb, gcore complains that process is being traced
> (which it is I suppose). Any thoughts on how to get this core dump
> without killing the process being debugged?
Detach gdb from the process and then run gcore, or have you found
that you cannot detach gdb from the process without killing it?
tim
|
|
0
|
|
|
|
Reply
|
Tim
|
7/11/2004 12:37:47 AM
|
|
Tim,
>>If I use gdb to attach to a running process, do some stuff, exit while
>>leaving process running, but I want to take a core dump of the process
>>before leaving gdb, how might I do that? [...]
> Detach gdb from the process and then run gcore, or have you found
> that you cannot detach gdb from the process without killing it?
I can try that. I had hoped to make the whole thing as automated as
possible to get in and get out as fast as possible to minimize impact
the running application. I'll think some more about how to automate it.
Thx for the suggestion.
Chris
|
|
0
|
|
|
|
Reply
|
Chris
|
7/11/2004 1:02:29 AM
|
|
On Fri, 09 Jul 2004 23:43:37 -0700 Chris Markle <cmarkle@sendmail.com> wrote:
> Folks,
>
> If I use gdb to attach to a running process, do some stuff, exit while
> leaving process running, but I want to take a core dump of the process
> before leaving gdb, how might I do that? When I try "shell gcore
> [pid]" from within gdb, gcore complains that process is being traced
> (which it is I suppose). Any thoughts on how to get this core dump
> without killing the process being debugged?
Just run the gdb command 'gcore'.
(gdb) help gcore
Save a core file with the current state of the debugged process.
Argument is optional filename. Default filename is 'core.<process_id>'.
/fc
|
|
0
|
|
|
|
Reply
|
Frank
|
7/11/2004 3:23:35 AM
|
|
Frank,
> > [...] but I want to take a core dump of the process
> > before leaving gdb, how might I do that? When I try "shell gcore
> > [pid]" from within gdb, gcore complains that process is being traced
> > (which it is I suppose). Any thoughts on how to get this core dump
> > without killing the process being debugged?
>
> Just run the gdb command 'gcore'.
http://www.gnu.org/software/gdb/documentation/ makes no mention of a gdb
gcore command. Is this a doc omission or is gcore support in gdb specific to
some particular gdb implementations (e.g. I got the slight impression from
googling that gcore might be a linux-only gdb capability)?
Chris
|
|
0
|
|
|
|
Reply
|
Chris
|
7/11/2004 6:28:41 AM
|
|
On Sun, 11 Jul 2004 06:28:41 GMT "Chris Markle" <cmarkle@sendmail.com> wrote:
> Frank,
>
>> > [...] but I want to take a core dump of the process
>> > before leaving gdb, how might I do that? When I try "shell gcore
>> > [pid]" from within gdb, gcore complains that process is being traced
>> > (which it is I suppose). Any thoughts on how to get this core dump
>> > without killing the process being debugged?
>>
>> Just run the gdb command 'gcore'.
>
> http://www.gnu.org/software/gdb/documentation/ makes no mention of a gdb
> gcore command. Is this a doc omission or is gcore support in gdb specific to
> some particular gdb implementations (e.g. I got the slight impression from
> googling that gcore might be a linux-only gdb capability)?
Did you try it and find it doesn't work? I don't have a Solaris machine
with gdb to actually try it. I'll admit, I only know of it by word-of-
mouth, not from ever having seen any documentation. I know for sure it
works on Linux, so it must be a doc omission, possibly due to limited
platform support (or maybe just plain oversight).
From the gdb/NEWS file (5.2.1):
* New command "generate-core-file" (or "gcore").
This new gdb command allows the user to drop a core file of the child
process state at any time. So far it's been implemented only for
GNU/Linux and Solaris, but should be relatively easily ported to other
hosts. Argument is core file name (defaults to core.<pid>).
From a grep:
../gdb/procfs.c:/* gcore only implemented on solaris and unixware (so far) */
so who knows ...
/fc
|
|
0
|
|
|
|
Reply
|
Frank
|
7/11/2004 7:28:01 AM
|
|
|
5 Replies
1023 Views
(page loaded in 0.068 seconds)
Similiar Articles: take core dump from gdb of running process? - comp.unix.solaris ...Folks, If I use gdb to attach to a running process, do some stuff, exit while leaving process running, but I want to take a core dump of the process... Getting info on hung process - comp.unix.aixtake core dump from gdb of running process? - comp.unix.solaris ... Getting info on hung process - comp.unix.aix There are 13 of these processes running concurrently and 1 ... dbx - Can't attach to process. - comp.unix.solarisRe: GAS and GDB: Breakpoint not "breaking" - comp.lang.asm.x86 ... dbx - Can't attach to process. - comp.unix.solaris take core dump from gdb of running process ... Dumping stacktrace on HPUX itanium using gdb - comp.sys.hp.hpux ...take core dump from gdb of running process? - comp.unix.solaris ... gdb for Solaris 10 - comp.unix.solaris take core dump from gdb of running process? - comp.unix.solaris ... dbx : Interpreting stack history of core - comp.unix.solaris ...take core dump from gdb of running process? - comp.unix.solaris ... dbx : Interpreting stack history of core - comp.unix.solaris ... DBX script to print stack trace seen ... gdb for Solaris 10 - comp.unix.solaristake core dump from gdb of running process? - comp.unix.solaris ... gdb for Solaris 10 - comp.unix.solaris take core dump from gdb of running process? - comp.unix.solaris ... Re: GAS and GDB: Breakpoint not "breaking" - comp.lang.asm.x86 ...Re: GAS and GDB: Breakpoint not "breaking" - comp.lang ... dbx - Can't attach to process. - comp.unix.solaris take core dump from gdb of running process? - comp ... How to get Tomcat thread stack dump - comp.infosystems.www.servers ...take core dump from gdb of running process? - comp.unix.solaris ... How to get Tomcat thread stack dump - comp.infosystems.www.servers ... (I'm running T... ... as ... DBX for HP-UX - comp.sys.hp.hpuxtake core dump from gdb of running process? - comp.unix.solaris ... Dumping stacktrace on HPUX itanium using gdb - comp.sys.hp.hpux ... gdb for Solaris 10 - comp.unix ... Crash utility on AIX 5.3 for reading core dumps? - comp.unix.admin ...... utility on AIX 5.3 for reading core dumps? - comp.unix.admin ... gdb and core ... to read the ... comp.unix.aix I did not see anything in the ... process write a core dump. ... take core dump from gdb of running process? - comp.unix.solaris ...Folks, If I use gdb to attach to a running process, do some stuff, exit while leaving process running, but I want to take a core dump of the process... Core dump - Wikipedia, the free encyclopedia... as early versions of Unix did not support attaching debuggers to running processes, so core dumps ... Binary File Descriptor library (BFD), and the GNU Debugger (gdb) and ... 7/23/2012 4:37:45 AM
|