Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb@sources.redhat.com
Subject: getting rid of the target stack
Date: Wed, 26 Jun 2002 22:13:00 -0000	[thread overview]
Message-ID: <nphejp2tj1.fsf@zwingli.cygnus.com> (raw)


(Probably Andrew has some document already written up about this, with
puzzling pictures and everything, but I'll describe the idea anyway.)

The target stack is a pain in the neck for a variety of reasons:

1) It's not a stack; we're always sticking things in the middle, and
   shlorking them out again later.

2) The elements of the (non-)stack are modules, not objects.  Each
   layer has its own global variables and global state, which makes it
   hard to see what's going on.

One model that seems nicer to me is one in which each thing like a
core file, a remote protocol connection, or a Linux inferior would be
an object, with hand-coded vtable, instance variables and all.  All
their state would be encapsulated in the instance; you could have
several alive simultaneously; and so on.  This would be part of the
support needed to have GDB talk to multiple processes simultaneously,
for example.

You'd get the layering effect the target stack gives you now by having
a constructor take a "backup" target object as an argument, to which
it would delegate method calls it didn't want to handle itself.
Rather than pushing layer A above layer B, you'd use B as A's "backup"
target object.

So assuming this is actually a good idea, how could you get to there
from here?

Well, you'd start with the target layers that currently always live at
the bottom of the stack.  You could re-write them one at a time in the
more object-oriented style I described above, and use a compatibility
target layer to talk to them.  Then you'd convert the next layers up.
Where the code now invokes the next lower target method or directly
calls a particular lower layer's functions, you'd replace that with an
operation on the "backup" object.

Eventually, you'd have all the different layers' state nicely
encapsulated, and that part of GDB would get a lot easier to
understand.


             reply	other threads:[~2002-06-27  5:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-26 22:13 Jim Blandy [this message]
2002-06-26 22:25 ` Daniel Jacobowitz
2002-06-27  6:23   ` Jim Blandy
2002-07-01  9:38     ` Namespaces; Was: " Andrew Cagney
2002-06-27  7:44 ` Andrew Cagney

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=nphejp2tj1.fsf@zwingli.cygnus.com \
    --to=jimb@redhat.com \
    --cc=gdb@sources.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