From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30546 invoked by alias); 29 Jul 2008 03:09:03 -0000 Received: (qmail 30537 invoked by uid 22791); 29 Jul 2008 03:09:02 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jul 2008 03:08:45 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id D75693C14E; Mon, 28 Jul 2008 20:08:43 -0700 (PDT) Subject: Re: Multiprogram teaser From: Michael Snyder To: Stan Shebs Cc: gdb@sourceware.org In-Reply-To: <488E7670.40609@codesourcery.com> References: <488E7670.40609@codesourcery.com> Content-Type: text/plain Date: Tue, 29 Jul 2008 08:18:00 -0000 Message-Id: <1217300923.3549.582.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-7.fc7) 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-07/txt/msg00286.txt.bz2 Very teasy. ;-) Say, how come you're stan at cs.com? Was "shebs" taken? ;-) On Mon, 2008-07-28 at 18:46 -0700, Stan Shebs wrote: > Here's a little teaser showing the results of me flogging GDB's source > code. In addition to the fun aspect of listing the main()s of two > different programs, it points up the the potential confusion of having > several programs in a session. What I've got so far in my prototype is > the ability to collect multiple execs from the command line, the > creation of "exec" objects from which you can select one as "current", > and some symbol table hacking to restrict lookups to the current executable. > > stan@adell:~/mpgdb/linux/gdb$ ./gdb -nx ~/hello ~/goodbye > GNU gdb (GDB) 6.8.50.20080728-cvs > [...] > Attaching objfile /home/stan/hello to exec /home/stan/hello > Attaching objfile /home/stan/goodbye to exec /home/stan/goodbye > (gdb) list main > 1 int glob = 45; > 2 > 3 main() { > 4 mailand(); > 5 foo(glob); > 6 printf("goodbye cruel world\n"); > 7 } > 8 > 9 foo(int x) { > 10 return x + 92; > (gdb) exec /home/stan/hello > Setting current exec to /home/stan/hello. > (gdb) list main > 3 if (bar == 0) > 4 exit(1); > 5 } > 6 > 7 main() > 8 { > 9 bar(); > 10 printf("hello world\n"); > 11 } > 12 > (gdb) > > > Stan > > >