From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24048 invoked by alias); 23 Oct 2008 20:01:37 -0000 Received: (qmail 24035 invoked by uid 22791); 23 Oct 2008 20:01:36 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Oct 2008 20:00:50 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id CF16015001; Thu, 23 Oct 2008 13:00:47 -0700 (PDT) Received: from [10.20.92.59] (promb-2s-dhcp59.eng.vmware.com [10.20.92.59]) by mailhost3.vmware.com (Postfix) with ESMTP id C618AC9A25; Thu, 23 Oct 2008 13:00:47 -0700 (PDT) Message-ID: <4900D6CA.5090500@vmware.com> Date: Thu, 23 Oct 2008 20:01:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Lukasz Lempart CC: "gdb@sourceware.org" Subject: Re: gdb and cloned process References: <4ced24c0810221709u17575bf3s73994724c456e956@mail.gmail.com> In-Reply-To: <4ced24c0810221709u17575bf3s73994724c456e956@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00113.txt.bz2 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.