Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] MI: -var-update bug
Date: Fri, 08 Dec 2006 19:38:00 -0000	[thread overview]
Message-ID: <17785.48689.501272.349814@kahikatea.snap.net.nz> (raw)


This patch fixes a bug where -var-update doesn't restore the selected frame
when there is an out of scope variable object.

Here is one way see this bug (it might need an OS that randomizes the virtual
address space of a process but there are other ways to make it work in this
case):

gdb -i=mi yourprog
...
(gdb)
start
...
(gdb)
-var-create - * anyvariable
(gdb)
b somesubroutine
...
(gdb)
r
...
(gdb)
up
^done,frame={level="1",....
             ^^^^^^^^^
(gdb)
-var-update *
^done,changelist=[{name="var1",in_scope="false"}]
(gdb)
frame
&"frame\n"
^done,frame={level="0",...
             ^^^^^^^^^

A conservative change would be to additionally restore the selected frame when
GDB returns from varobj_update with a value of -1 because new == NULL but I
think the frame only gets changed by value_of_root -> c_value_of_root ->
reinit_frame_cache, so it's safe to just move the frame restoration forward.

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


2006-12-09  Nick Roberts  <nickrob@snap.net.nz>

	* varobj.c (varobj_update): Ensure frame is restored when
	variable object is out of scope.


*** varobj.c	09 Dec 2006 01:44:28 +1300	1.64
--- varobj.c	09 Dec 2006 01:47:18 +1300	
*************** varobj_update (struct varobj **varp, str
*** 1052,1057 ****
--- 1052,1063 ----
       has changed. */
    type_changed = 1;
    new = value_of_root (varp, &type_changed);
+ 
+   /* Restore selected frame */
+   fi = frame_find_by_id (old_fid);
+   if (fi)
+     select_frame (fi);
+ 
    if (new == NULL)
      {
        (*varp)->error = 1;
*************** varobj_update (struct varobj **varp, str
*** 1147,1157 ****
        *(*changelist + changed) = NULL;
      }
  
-   /* Restore selected frame */
-   fi = frame_find_by_id (old_fid);
-   if (fi)
-     select_frame (fi);
- 
    if (type_changed)
      return -2;
    else


             reply	other threads:[~2006-12-08 19:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08 19:38 Nick Roberts [this message]
2006-12-08 19:43 ` Daniel Jacobowitz
2006-12-08 19:56   ` Nick Roberts
2006-12-08 20:04     ` Daniel Jacobowitz
2006-12-08 20:09       ` Nick Roberts
2006-12-08 20:23         ` Daniel Jacobowitz
2006-12-09 20:47           ` 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=17785.48689.501272.349814@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@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