This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb and cloned process
- From: Michael Snyder <msnyder at vmware dot com>
- To: Lukasz Lempart <llempart at gmail dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 23 Oct 2008 12:55:54 -0700
- Subject: Re: gdb and cloned process
- References: <4ced24c0810221709u17575bf3s73994724c456e956@mail.gmail.com>
Lukasz Lempart wrote:
I am using gdb 6.8 and running linux 2.6.9 on a 64bit AMD Opteron.
I am working with a multi-threaded application (using glibc's pthread
implementation). One of the threads, clones another process using the
following flags:
CLONE_VM | CLONE_UNTRACED | CLONE_DETACHED | CLONE_PARENT | CLONE_FILES
The cloned process also calls setsid creating its own process group.
The idea here is to peek at the memory of the original application
without stopping it, by attaching gdb to the cloned process.
I think your idea is interesting, but because of the intimate
relationship between linux clone and threads, the idea might not
be workable with multi-threaded programs.
Linux threads are built on top of clone. It's hard to
separate them, and I'm not sure that we have ever really
tried to, since use of both in the same program is probably
quite rare.
The only suggestion I can think to offer is to build a
special gdb with threads disabled, and use that one to
view the clone.