RFC: MI output during program execution

Jim Ingham jingham@apple.com
Wed Aug 10 02:37:00 GMT 2005


On Aug 9, 2005, at 5:48 PM, Bob Rossi wrote:

> On Tue, Aug 09, 2005 at 08:41:28PM -0400, Daniel Jacobowitz wrote:
>
>> On Tue, Aug 09, 2005 at 06:34:21PM -0400, Bob Rossi wrote:
>>
>>> However, in the meantime, I think it's possible to query the  
>>> state of
>>> GDB at any moment. So, if you allow the user to enter a command via
>>> -interpreter-exec console, you could then follow that command up  
>>> with
>>> other MI commands to sync the state of GDB with the state of the FE.
>>>
>>
>> But we haven't got all the relevant query commands, I think.  And I
>> haven't a clue what the full set would be.  Rather than adding them,
>> investing effort in getting the async approach going makes more sense
>> to me.
>>
>
> I agree. However, getting the observer approach up and running,  
> will in
> a way, define the full set.
>
>
>> As Jim's pointed out, you can need this any time you hit a  
>> breakpoint,
>> if the user has set commands on it.  Keeping track of this in the  
>> FE is
>> going to be tricky.  Also, if you're presenting a real console window
>> and you have to do a half-dozen queries after every command to  
>> keep the
>> UI up to date, that's probably going to be visibly slow.
>>
>
> Here is another odd scenario, Jim, please give some info if you have
> experience in this area.
>
> If you hit a breakpoint, and the observer starts to send you data,  
> does
> it
>    - send all the state data in one async response, in the same  
> response as
>      the async MI command that says *stopped?
>    - send all the state data in one async response, in a different  
> response
>      as the async MI command that says *stopped?
>    - send all the state data, each in different async response's, in a
>      different response as the async MI command that says *stopped?
>
> This may seem unimportant, however I believe it could be marginally
> important. For instance, does the front end have to wait for the async
> observer response before it can do anything else?

Remember I haven't done this with observers or events yet.  The way I  
did it with hooks, the result of the hooks is gathered into the  
"^done" or the other termination states for the command.  So for  
instance, if you run gdb on itself, and do:

(top-gdb) commands 3
Type commands for when breakpoint 3 is hit, one per line.
End with a line saying just "end".
 >print argc
 >up
 >break decode_line_1
 >continue
 >end
(top-gdb) set interpreter mi
-exec-run
*stopped,reason="breakpoint-hit",commands="yes",bkptno="3",thread-id="1"
~"$1 = 15"
~"\n"
~"#1  0x0003c4d0 in do_catch_errors (uiout=0x337618, data=0xbffff0f0)  
at ../../gdb/src/gdb/top.c:577\n"
~"577\t  return args->func (args->func_args);\n"
~"Breakpoint 4 at 0x8237c: file ../../gdb/src/gdb/linespec.c, line  
735.\n"
~"Continuing.\n"
^continuing
*started,MI_HOOK_RESULT= 
{HOOK_TYPE="frame_changed",frame="1"},MI_HOOK_RESULT= 
{HOOK_TYPE="breakpoint_create",bkpt= 
{number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0008237c", 
func="decode_line_1",file="../../gdb/src/gdb/ 
linespec.c",line="735",shlib="/Volumes/ThePlayground/Users/jingham/ 
Work/gdb-sources/tot-shlib-experiment/build/gdb/ 
gdb",times="0"}},reason="breakpoint-command"
GNU gdb 2004-03-03-cvs (Thu Jul 28 18:14:44 GMT 2005)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
you are
welcome to change it and/or distribute copies of it under certain  
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for  
details.
This GDB was configured as "powerpc-apple-darwin8.1.0".
Setting up the environment for debugging gdb.
*stopped,reason="breakpoint-hit",commands="no",bkptno="4",thread-id="1"

So it's sort of like your third option, except it sends it as part of  
the message that tells you the breakpoint command handling is done.   
If the breakpoint had not done a continue, you would see:

=breakpoint-command-completed,MI_HOOK_RESULT= 
{HOOK_TYPE="frame_changed",frame="1"},MI_HOOK_RESULT= 
{HOOK_TYPE="breakpoint_create",bkpt= 
{number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0008237c", 
func="decode_line_1",file="../../gdb/src/gdb/ 
linespec.c",line="735",shlib="/Volumes/ThePlayground/Users/jingham/ 
Work/gdb-sources/tot-shlib-experiment/build/gdb/gdb",times="0"}}

It might make more sense to have the "*started" be an "=started"  
message, I'm not sure why I made it a "*", I guess by analogy with  
the "*stopped"...

Jim

>
> Thanks,
> Bob Rossi
>



More information about the Gdb-patches mailing list