From: Jim Ingham <jingham@apple.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Nick Roberts <nickrob@snap.net.nz>, gdb-patches@sources.redhat.com
Subject: Re: RFC: MI output during program execution
Date: Mon, 08 Aug 2005 18:23:00 -0000 [thread overview]
Message-ID: <FDDE6A38-89E2-455B-BD32-08B6B75006D5@apple.com> (raw)
In-Reply-To: <20050808130516.GA9046@nevyn.them.org>
First off, "console-quoted" has a less grand purpose than Nick
thinks... I added "console-quoted", because in the version of the
interpreter code that I maintain in the Apple sources the console
interpreter really is the CLI console interpreter, regardless of
whether you are running it from the MI or not. That is because I
wanted to be able to really switch interpreters, not just fake the
CLI under the covers of the MI - which is what Keith & Elena's
version of the interpreter code does. But this means that for the
"console" interpreter, you get raw console output, not quoted nicely
for consumption by the GUI. So we needed a version of console to run
from the MI that did the nice quoting. Other than that, "console"
and "console-quoted" are identical.
About Nick's patch. We achieve the same result, but with a different
method. What I do is whenever I run a CLI command with the
mi_cmd_interpreter_exec, I install a bunch of notify hooks - the
code to look at is mi_insert_notify_hooks. These give us a way to
funnel notifications from "behind the CLI's back".
We get a bunch of notifications this way, including breakpoint set,
frame changed, etc... Right now, I think most of the hook stuff got
ripped out of the FSF gdb in favor of events^H^H^H^H^H^Hobservers.
Someday when I have some spare time I need to go look at the
observers, and see if I can get them to do the same thing I need the
hooks to do. One of the weaknesses of the hooks is they don't store
data so I have to squirrel the mi interpreter the hook is for off
into a global - which is unclean. Maybe this sort of thing will be
better if the hooking method is more advanced.
Anyway, this model is a sort of "on demand" way of implementing
Daniel's notion of "keeping all the interpreters open at the same
time". Namely, when interpreter A relinquishes control to
interpreter B, it registers for all the things it would like to be
informed of before it does so. It has the virtue of not having to
multiplex all the information gdb generates down multiple channels.
You just selectively funnel off the pieces you are interested in. As
long as the hooks (or whatever they are now with observers...) are
correctly maintained, this is pretty easy to make work.
In general, there's only one interpreter "in charge" at a time. So I
think this model of "inserting your listeners when you give up
charge" is not too bad. It has proved pretty workable for what we
do, anyway. And I like it better than Nick's method of mocking up
certain commands in interpreter-exec. It seems better to specify
"what you want to be told about" when one interpreter invokes
another, rather than trying to guess which commands might do
something you might want to know about. Unless you disallow "define"
on the CLI side, you're always going to lose this game anyway...
Note, there are some tricky bits to this model. For instance, if you
are running the MI, and use "-interpreter-exec console" to set
commands on a breakpoint, those commands should be run with the CLI
interpreter when you hit the breakpoint. But that means that some
actions - in this case hitting a breakpoint as part of the completion
to an "-exec-run" command - can force you over to the CLI interpreter
for a little while.
There's a bit of trickery in our sources to handle this. I didn't do
it "right" - where "right" would be to abstract the notion of a
breakpoint command out of the CLI and do some hand-off between the
current interpreter and the one in charge of the breakpoint command
code. For our purposes, the CLI is the only thing that gets to
register breakpoint commands - the GUI can react in a scripted manner
to breakpoint hits on its own, so there was no need to add this
complexity.
The most current version of our sources is available in tar.gz form at:
http://www.opensource.apple.com/darwinsource/tarballs/other/
gdb-384.tar.gz
I am pretty sure the CVS repository is up to date with this as well
(some projects require an ADC membership, but gdb & friends have
anonymous access). See
http://developer.apple.com/darwin/tools/cvs/howto.html
for more details.
This code is based on a merge that's almost a year old now. Stan &
Klee are working away at a more recent merge - we're pretty sure the
patient will survive, but it's definitely not ambulatory yet...
Jim
On Aug 8, 2005, at 6:05 AM, Daniel Jacobowitz wrote:
> On Mon, Aug 08, 2005 at 04:20:43PM +1200, Nick Roberts wrote:
>
>>
>> Although Emacs will increasingly use GDB/MI to interact with GDB,
>> the GUD
>> buffer will always require the use of CLI commands. These are
>> executed via
>> "-interpreter-exec console" that Jim Ingham/Apple contributed. In
>> general
>> this isn't a problem, but CLI commands which start the inferior
>> e.g run, next,
>> finish etc do not tell Emacs when the inferior is executing (do
>> not output
>> ^running) and in some cases generate inappropriate output such as
>> the current
>> source line as CLI output. I would like to change the output of
>> these
>> commands to that of their MI counterparts. I think that Apple
>> have added a
>> separate interpreter (console-quoted) for this kind of thing. The
>> patch below
>> reflects my more modest resources and limited knowledge and seems
>> to do the
>> kind of thing that Emacs needs. It doesn't change direct use of
>> MI commands,
>> just the behaviour of a subset of CLI commands invoked the the MI
>> interpreter:
>>
>
> Fortunately, we've got access to all these bright folks at Apple.
> Does the console-quoted approach sound good to you? Jim, is a recent
> snapshot of the code for it available?
>
> The following has no frontend implementation experience behind it
> whatsoever. However, it's relevant from my few tries at adding full
> scripting support to GDB. What I'd like to see is a way to keep
> multiple interpreters open at the same time. Then, have one of them
> accepting input at a time, and receiving informative output, but
> all of
> them receiving some kinds of output. For instance, all open MI
> channels could receive a notice on breakpoint deletion, no matter
> where
> the request came from. If the console starts GDB running in this
> case,
> the MI interpreter would still get a ^running.
>
> --
> Daniel Jacobowitz
> CodeSourcery, LLC
>
next prev parent reply other threads:[~2005-08-08 17:09 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-08 5:20 Nick Roberts
2005-08-08 13:05 ` Daniel Jacobowitz
2005-08-08 18:23 ` Jim Ingham [this message]
2005-08-09 17:32 ` Nick Roberts
2005-08-21 22:09 ` Nick Roberts
2005-08-24 2:20 ` Stan Shebs
2005-08-24 16:59 ` Nick Roberts
2005-08-24 20:15 ` Jim Ingham
2005-08-24 20:48 ` Nick Roberts
2005-08-27 12:09 ` Stan Shebs
2005-09-12 3:20 ` Nick Roberts
2005-09-12 3:40 ` Daniel Jacobowitz
2005-09-19 10:30 ` Nick Roberts
2005-09-19 13:17 ` Daniel Jacobowitz
2005-09-19 22:12 ` Nick Roberts
2005-09-19 22:17 ` Nick Roberts
2005-09-19 22:32 ` Daniel Jacobowitz
2005-10-03 3:20 ` Nick Roberts
2005-10-03 13:18 ` Daniel Jacobowitz
2005-10-03 20:28 ` Nick Roberts
2005-10-03 20:31 ` Daniel Jacobowitz
2005-10-03 21:39 ` Stan Shebs
2005-10-03 21:50 ` Jim Ingham
2005-10-03 21:59 ` Daniel Jacobowitz
2005-10-03 22:01 ` Daniel Jacobowitz
2006-03-28 0:40 ` Nick Roberts
2006-03-28 22:12 ` Daniel Jacobowitz
2006-03-28 22:36 ` Nick Roberts
2006-03-28 23:13 ` Daniel Jacobowitz
2005-08-08 21:00 ` Eli Zaretskii
2005-08-09 17:52 ` Nick Roberts
[not found] <1123605445.30442.ezmlm@sources.redhat.com>
2005-08-09 17:24 ` Jim Ingham
2005-08-09 17:59 ` Bob Rossi
2005-08-09 18:09 ` Jim Ingham
2005-08-09 18:23 ` Bob Rossi
2005-08-09 18:40 ` Jim Ingham
2005-08-10 0:48 ` Daniel Jacobowitz
2005-08-10 0:48 ` Jim Ingham
2005-08-10 2:37 ` Daniel Jacobowitz
2005-08-09 18:13 ` Eli Zaretskii
2005-08-09 18:23 ` Bob Rossi
2005-08-09 19:39 ` Eli Zaretskii
2005-08-10 0:41 ` Bob Rossi
2005-08-10 0:42 ` Daniel Jacobowitz
2005-08-10 1:07 ` Bob Rossi
2005-08-10 2:37 ` Jim Ingham
2005-08-12 8:06 ` Bob Rossi
2005-08-12 10:36 ` Eli Zaretskii
2005-08-12 12:05 ` Bob Rossi
2005-08-12 17:25 ` Eli Zaretskii
2005-08-12 20:45 ` Bob Rossi
2005-08-12 20:49 ` Daniel Jacobowitz
2005-08-13 1:11 ` Bob Rossi
2005-08-13 1:15 ` Daniel Jacobowitz
2005-08-13 11:07 ` Eli Zaretskii
2005-08-12 20:54 ` Mark Kettenis
2005-08-13 15:05 ` Bob Rossi
2005-08-12 21:01 ` Daniel Jacobowitz
2005-08-13 11:13 ` Eli Zaretskii
2005-08-12 17:03 ` Jim Ingham
2005-08-13 0:33 ` Bob Rossi
2005-08-13 0:44 ` Jim Ingham
2005-08-13 5:04 ` Bob Rossi
2005-08-13 6:47 ` Daniel Jacobowitz
2005-08-13 11:06 ` Jim Ingham
2005-08-13 14:51 ` Bob Rossi
2005-08-13 16:55 ` Daniel Jacobowitz
2005-08-13 12:53 ` Eli Zaretskii
2005-08-13 21:52 ` Mark Kettenis
2005-08-13 0:22 ` Daniel Jacobowitz
2005-08-11 10:10 ` Daniel Jacobowitz
2005-08-15 2:13 Nick Roberts
2005-08-15 4:26 ` Daniel Jacobowitz
2005-08-15 10:03 ` Nick Roberts
2005-08-16 0:04 ` Bob Rossi
2005-08-16 0:33 ` Nick Roberts
2005-08-16 0:43 ` Daniel Jacobowitz
2005-08-16 3:54 ` Bob Rossi
2005-08-15 2:15 Nick Roberts
[not found] <1124238360.5670.ezmlm@sources.redhat.com>
2005-08-17 1:10 ` Jim Ingham
2005-08-17 3:18 Nick Roberts
2005-08-18 13:28 Nick Roberts
2005-08-19 0:52 ` Mark Kettenis
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=FDDE6A38-89E2-455B-BD32-08B6B75006D5@apple.com \
--to=jingham@apple.com \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=nickrob@snap.net.nz \
/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