From: Jim Ingham <jingham@apple.com>
To: gdb-patches@sources.redhat.com
Subject: Nother little one, this time in varobj.c
Date: Tue, 09 Apr 2002 17:36:00 -0000 [thread overview]
Message-ID: <F91F3C28-4C1A-11D6-B08E-000393540DDC@apple.com> (raw)
Here is another little buglet. varobj_update stores the current frame,
and then resets it
when it is done. This is great, because the varobj may be in a
different frame than the current one. Unfortunately, the intervening
code can call c_value_of_root, which calls reinit_frame_cache, which
blows away the frame cache, leaving varobj_update holding a pointer to a
freed frame_info structure.
The patch below fixes this goof.
BTW, I am not sure why it is necessary to call reinit_frame_cache here.
Keith, do you remember why this was necessary? It is inefficient,
especially if you are evaluating a bunch of variables that are fairly
high up on the stack. But since I don't remember why this was done, I
am reluctant to just change it outright...
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.27
diff -c -w -r1.27 varobj.c
*** varobj.c 5 Apr 2002 22:04:42 -0000 1.27
--- varobj.c 10 Apr 2002 00:30:06 -0000
***************
*** 850,856 ****
struct value *new;
struct vstack *stack = NULL;
struct vstack *result = NULL;
! struct frame_info *old_fi;
/* sanity check: have we been passed a pointer? */
if (changelist == NULL)
--- 850,858 ----
struct value *new;
struct vstack *stack = NULL;
struct vstack *result = NULL;
! CORE_ADDR old_frame;
! int old_level;
!
/* sanity check: have we been passed a pointer? */
if (changelist == NULL)
***************
*** 861,869 ****
/* Not a root var */
return -1;
! /* Save the selected stack frame, since we will need to change it
! in order to evaluate expressions. */
! old_fi = selected_frame;
/* Update the root variable. value_of_root can return NULL
if the variable is no longer around, i.e. we stepped out of
--- 863,875 ----
/* Not a root var */
return -1;
! /* Save the selected stack frame, since we will need to change it in
! order to evaluate expressions. However, you have to hold onto
! the address not the struct frame, because value_of_root calls
! reinit_frame_cache for its own mysterious purposes, leaving you
! holding onto garbage... */
!
! record_selected_frame (&old_frame, &old_level);
/* Update the root variable. value_of_root can return NULL
if the variable is no longer around, i.e. we stepped out of
***************
*** 983,989 ****
}
/* Restore selected frame */
! select_frame (old_fi, -1);
if (type_changed)
return -2;
--- 989,999 ----
}
/* Restore selected frame */
! if (old_frame != 0)
! {
! old_fi = find_frame_addr_in_frame_chain (old_frame);
! select_frame (old_fi, old_level);
! }
if (type_changed)
return -2;
Jim
--
Jim Ingham jingham@apple.com
Developer Tools - gdb
Apple Computer
next reply other threads:[~2002-04-10 0:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-09 17:36 Jim Ingham [this message]
2002-04-09 23:44 ` Keith Seitz
2002-04-10 6:27 ` Fernando Nasser
2002-04-10 7:33 ` Andrew Cagney
2002-04-10 11:07 ` Jim Ingham
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=F91F3C28-4C1A-11D6-B08E-000393540DDC@apple.com \
--to=jingham@apple.com \
--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