Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Stan Shebs <stan@codesourcery.com>
To: tromey@redhat.com
Cc: Stan Shebs <stan@codesourcery.com>, gdb@sourceware.org
Subject: Re: Multiprogram teaser
Date: Wed, 30 Jul 2008 18:07:00 -0000	[thread overview]
Message-ID: <4890AA71.9090409@codesourcery.com> (raw)
In-Reply-To: <m3r69b47es.fsf@fleche.redhat.com>

Tom Tromey wrote:
>>>>>> "Stan" == Stan Shebs <stan@codesourcery.com> 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 <foo>" 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


      reply	other threads:[~2008-07-30 17:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29  2:29 Stan Shebs
2008-07-29  8:18 ` Michael Snyder
2008-07-29 13:14 ` Jeremy Bennett
2008-07-29 13:34   ` Marc Khouzam
2008-07-29 13:51     ` Pedro Alves
2008-07-29 14:58       ` Marc Khouzam
2008-07-29 14:12     ` Stan Shebs
2008-07-29 16:02       ` Marc Khouzam
2008-07-30 17:21       ` Tom Tromey
2008-07-30 17:43 ` Tom Tromey
2008-07-30 18:07   ` Stan Shebs [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4890AA71.9090409@codesourcery.com \
    --to=stan@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox