public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* MI: event notification
@ 2006-06-21  1:34 Nick Roberts
  2006-06-21  2:23 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Roberts @ 2006-06-21  1:34 UTC (permalink / raw)
  To: gdb

In the past there have been discussions about the performance of certain
MI commands.  To reduce the overhead, I would like to add some event
notification where GDB informs that front end when something has changed

I think this has always been the intention but that nothing has so far
been implemented.  As a start, and by way of an example, I attach a patch
that tries to say when the stack has changed so that MI command(s)
-stack-list-frames, -stack-list-arguments need not be issued while stepping
within the same frame, for example.  

From the manual:

`NOTIFY-ASYNC-OUTPUT ==>'
     `[ TOKEN ] "=" ASYNC-OUTPUT'


Using the patch, "=stack-changed\n" gets printed every time the stack changes
e.g

(gdb)
-exec-finish
^running
(gdb)
=stack-changed
*stopped,reason="function-finished",thread-id="0",frame={addr="0x080487cc",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbff7efa4"}],file="myprog.c",fullname="/home/nickrob/myprog.c",line="112"},gdb-result-var="$1",return-value="9"
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x080487d1",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbff7efa4"}],file="myprog.c",fullname="/home/nickrob/myprog.c",line="108"}
(gdb)
-exec-continue
^running
(gdb)
=stack-changed
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080488aa",func="myprint",args=[{name="i",value="2"},{name="j",value="2"}],file="myprint.c",fullname="/home/nickrob/myprint.c",line="9"}
(gdb)


WDYT?

-- 
Nick                                           http://www.inet.net.nz/~nickrob



*** mi-main.c	13 May 2006 16:42:07 +1200	1.84
--- mi-main.c	21 Jun 2006 12:38:48 +1200	
*************** mi_execute_async_cli_command (char *mi, 
*** 1339,1344 ****
--- 1339,1346 ----
  
    if (!target_can_async_p ())
      {
+       static struct frame_id previous = {0, 0, 0, 0, 0, 0}; 
+       struct frame_id current;
        /* Do this before doing any printing.  It would appear that some
           print code leaves garbage around in the buffer. */
        do_cleanups (old_cleanups);
*************** mi_execute_async_cli_command (char *mi, 
*** 1346,1351 ****
--- 1348,1362 ----
           the stopped message. */
        if (last_async_command)
  	fputs_unfiltered (last_async_command, raw_stdout);
+       current = get_frame_id (get_current_frame ());
+       if (!frame_id_eq (previous, current))
+ 	fputs_unfiltered ("=stack-changed\n", raw_stdout);
+       previous.stack_addr = current.stack_addr;
+       previous.stack_addr_p = current.stack_addr_p;
+       previous.code_addr = current.code_addr;
+       previous.code_addr_p = current.code_addr_p;
+       previous.special_addr = current.special_addr;
+       previous.special_addr_p = current.special_addr_p;
        fputs_unfiltered ("*stopped", raw_stdout);
        mi_out_put (uiout, raw_stdout);
        mi_out_rewind (uiout);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-07-17 22:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-21  1:34 MI: event notification Nick Roberts
2006-06-21  2:23 ` Daniel Jacobowitz
2006-06-21  2:31   ` Nick Roberts
2006-06-21  4:50     ` Daniel Jacobowitz
2006-07-10 20:43       ` Jim Ingham
2006-07-16  4:34         ` Nick Roberts
2006-07-17 22:00           ` Jim Ingham
2006-07-17 23:02             ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).