Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Ingham <jingham@apple.com>
To: Bob Rossi <bob_rossi@cox.net>
Cc: Alain Magloire <alain@qnx.com>, gdb@sources.redhat.com
Subject: Re: asynchronous MI output commands
Date: Thu, 11 May 2006 19:25:00 -0000	[thread overview]
Message-ID: <5671FFE9-AC72-4100-B0A6-38E944074C68@apple.com> (raw)
In-Reply-To: <20060511170345.GB1600@brasko.net>


On May 11, 2006, at 10:03 AM, Bob Rossi wrote:

> On Thu, May 11, 2006 at 08:42:03AM -0700, Jim Ingham wrote:
>> I think that the lack of notification about what has gone on when
>> somebody uses interpreter-exec to run the target is just a bug in the
>> interpreter-exec command.  Since that command allows lots of stuff to
>> go on behind the MI client's back, you need to inform the client
>> about this.  You could either post asynchronous notifications about
>> what happened (for instance an =running or whatever) or you can just
>> make the -interpreter-exec command behave like -exec-next when it
>> does indeed run the target.  The latter is what we did for Xcode, so
>> you get the *stopped message if the target was run.
>
> Hi Jim,
>
> Well, I agree that this is a bug in the interpreter-exec command.
> I think both of your solution are appropriate. I would find it
> interesting to know which solution is easier to implement in GDB. The
> interesting case of course is when the user does a single CLI command
> that is a 'commands' definition. Thus, a single -interpreter-exec
> command can be similar to running N CLI commands.

We seem to get it half right for defined commands.  For instance:

(gdb) list main
1       int main (int argc, char **argv)
2       {
3
4         printf ("I got %d arguments\n", argc);
5
6         return 0;
7       }
(gdb) break 4
Breakpoint 1 at 0x2cdc: file main.c, line 4.
(gdb) break 6
Breakpoint 2 at 0x2cec: file main.c, line 6.
(gdb) define printAndContinue
Type commands for definition of "printandcontinue".
End with a line saying just "end".
 >print argc
 >continue
 >end
(gdb) run
Starting program: /private/tmp/a.out
Reading symbols for shared libraries . done

Breakpoint 1, main (argc=1, argv=0xbffff404) at main.c:4
4         printf ("I got %d arguments\n", argc);
(gdb) set interpreter mi
-interpreter-exec console-quoted printAndContinue
~"$1 = 1"
~"\n"
^continuing
I got 1 arguments
~"\nBreakpoint "
~"2, main (argc=1, argv=0xbffff404) at main.c:6\n"
~"6\t  return 0;\n"
^done,MI_HOOK_RESULT= 
{HOOK_TYPE="frame_changed",frame="0"},MI_HOOK_RESULT= 
{HOOK_TYPE="stack_changed"}

Normally the "I got 1 arguments" line would go to the tty for the  
target, so that wouldn't show up in the output that the MI client  
would be parsing.

What we do here is emit the "^continuing" so the MI can know that the  
target started.  This might more properly be an "=running" or  
something like that.  I think this is just an artifact of how the mi  
works right now.

Then when the defined command stops, we tell the MI what has changed  
in these HOOK_RESULT output messages.  Again, it's arguable that  
these should also be "=" type messages.  When I started working on  
this Xcode (ProjectBuilder as it then was) was not good at handling  
the "=" type asynchronous messages, and I haven't gotten around to  
changing this.

You don't get a *stopped message because the continuation is buried  
in the defined command.  We could fix this, and if the target has run  
tell the client that it has indeed stopped.  But this may also be an  
argument that it's better to tell the client about this through the  
asynchronous "=" messages, especially since the define command could  
run a number of times, and end up with a command that doesn't run the  
target.

Anyway, what we have now works well enough, if a little irregular,  
and I don't think fixing it up to be nicer looking would be  
particularly hard to do.

Note that breakpoint commands can also be a problem here, since they  
can run console commands out from under the MI.  They can in fact  
cause the target to stop, print some stuff, then continue again.  So  
if you allow this - which we had a lot of pressure to do since  
breakpoint commands are pretty handy - you have to do a little  
fiddling to get that right as well.

Jim

>
> I haven't even tested this case out yet, but I'm assuming there's big
> problems in this area. I seem to have more time lately, and would like
> to start patching up some of these holes. I would very much like to  
> see
> mi3 come out soon, with a lot of these problems resolved.
>
> Thanks,
> Bob Rossi


  reply	other threads:[~2006-05-11 17:35 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-11 15:02 Alain Magloire
2006-05-11 15:42 ` Bob Rossi
2006-05-11 16:40   ` Jim Ingham
2006-05-11 17:03     ` Daniel Jacobowitz
2006-05-11 17:35       ` Jim Ingham
2006-05-11 19:24     ` Bob Rossi
2006-05-11 19:25       ` Jim Ingham [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-12  0:19 Alain Magloire
2006-05-10 22:15 Alain Magloire
2006-05-11  3:41 ` Bob Rossi
2006-05-11  8:58   ` Vladimir Prus
2006-05-11 10:48     ` Bob Rossi
2006-05-11 10:52       ` Vladimir Prus
2006-05-11 11:14         ` Bob Rossi
2006-05-11 12:50           ` Vladimir Prus
2006-05-11 14:50             ` Bob Rossi
2006-05-09  9:46 Alain Magloire
2006-05-07 22:30 Bjarke Viksoe
2006-05-07 22:50 ` Daniel Jacobowitz
2006-05-08  0:36   ` Bjarke Viksoe
2006-05-08  1:52     ` Daniel Jacobowitz
     [not found] <1147034156.28828.ezmlm@sourceware.org>
2006-05-07 21:27 ` Bjarke Viksoe
2006-05-07 21:41   ` Daniel Jacobowitz
2006-05-10 12:43     ` Vladimir Prus
2006-05-06  1:26 Bob Rossi
2006-05-06  1:59 ` Daniel Jacobowitz
2006-05-06  2:48   ` Bob Rossi
2006-05-06  3:37     ` Nick Roberts
2006-05-06 15:20       ` Bob Rossi
2006-05-06  4:06     ` Daniel Jacobowitz
2006-05-06  4:05       ` Daniel Jacobowitz
2006-05-06 11:53       ` Bob Rossi
2006-05-06 12:06         ` Bob Rossi
2006-05-06  3:14   ` Bob Rossi
2006-05-06  4:04     ` Nick Roberts
2006-05-06 11:49       ` Daniel Jacobowitz
2006-05-06 11:50         ` Bob Rossi
2006-05-06 16:52           ` Daniel Jacobowitz
2006-05-06 19:45             ` Bob Rossi
2006-05-06 20:37               ` Daniel Jacobowitz
2006-05-07  0:44                 ` Bob Rossi
2006-05-07 20:35                   ` Daniel Jacobowitz
2006-05-07 20:42                     ` Bob Rossi
2006-05-07 22:01                       ` Daniel Jacobowitz
2006-05-08  1:22                         ` Bob Rossi
2006-05-08  2:03                           ` Daniel Jacobowitz
2006-05-09 21:48                             ` Bob Rossi
2006-05-08  6:38                           ` Nick Roberts
2006-05-08 11:28                             ` Bob Rossi
2006-05-08  1:26                         ` Bob Rossi
2006-05-06 11:51       ` Bob Rossi
2006-05-06  3:27 ` Nick Roberts
2006-05-06 16:40   ` Bob Rossi

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=5671FFE9-AC72-4100-B0A6-38E944074C68@apple.com \
    --to=jingham@apple.com \
    --cc=alain@qnx.com \
    --cc=bob_rossi@cox.net \
    --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