From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16709 invoked by alias); 30 Jul 2008 17:53:19 -0000 Received: (qmail 16700 invoked by uid 22791); 30 Jul 2008 17:53:18 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Jul 2008 17:52:58 +0000 Received: (qmail 7484 invoked from network); 30 Jul 2008 17:52:56 -0000 Received: from unknown (HELO macbook-2.local) (stan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jul 2008 17:52:56 -0000 Message-ID: <4890AA71.9090409@codesourcery.com> Date: Wed, 30 Jul 2008 18:07:00 -0000 From: Stan Shebs User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: tromey@redhat.com CC: Stan Shebs , gdb@sourceware.org Subject: Re: Multiprogram teaser References: <488E7670.40609@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-07/txt/msg00328.txt.bz2 Tom Tromey wrote: >>>>>> "Stan" == Stan Shebs writes: >>>>>> > > Stan> Here's a little teaser showing the results of me flogging GDB's > Stan> source code. > > Delightful. > > Stan> Attaching objfile /home/stan/hello to exec /home/stan/hello > Stan> Attaching objfile /home/stan/goodbye to exec /home/stan/goodbye > [...] > Stan> (gdb) exec /home/stan/hello > > I'm wondering what happens if you want to start two instances of hello > at once. > I hadn't thought of that one, no pids to distinguish before they start up... > I suppose one solution to the UI problems would be to treat each > separate "exec" (I dunno what you want to call this -- a concept > encompassing a process, a core file, or an unstarted executable) as an > object that can be manipulated in its own right. > The idea of an exec is relatively well-defined in GDB, it's what exec.c manipulates. It's just that the current code assumes there is only ever one, so the state is scattered in random globals, and then things like lookup_symbol iterate through all objfiles, secure in the knowledge that the first main() found will always be the one wanted. Breaking the assumption does result in cascading messiness, because of those globals is the target stack, built on top of the assumed single exec target. Should there be multiple target stacks? Arguments for and against. > So, you could have "info " to list them, switch between them, > have "set args" set the arguments for the current one, "run" start one > or more of them, etc. > I didn't show that, but yeah, I extended "info files" to list them all. Its default behavior is a little flawed, in that it wants to show you every section of every executable, which can get to be a lot of scrolling. :-) Stan