public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: gdb@sourceware.org
Subject: MI: event notification
Date: Wed, 21 Jun 2006 01:34:00 -0000	[thread overview]
Message-ID: <17560.40409.61785.698765@kahikatea.snap.net.nz> (raw)

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);

             reply	other threads:[~2006-06-21  1:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21  1:34 Nick Roberts [this message]
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

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=17560.40409.61785.698765@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).