This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI: Another -var-update bug? [PATCH]
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 13 Dec 2006 19:28:05 +1300
- Subject: Re: MI: Another -var-update bug? [PATCH]
- References: <17790.36044.454650.114329@kahikatea.snap.net.nz>
> Variable objects appear to test scope on a frame basis (in c_value_of root).
> If we create a variable object for j in the inner block of the program below
> then doing -var-update on line 10 doesn't report it as being out of scope.
> But struct varobj_root has a member struct block *valid_block. Presumably
> the addresses in this structure can be used to test if the variable is still
> in scope or not
Something like below?
--
Nick http://www.inet.net.nz/~nickrob
2006-12-13 Nick Roberts <nickrob@snap.net.nz>
* varobj.c: Include block.h.
(c_value_of_root): Check scope within nested statements.
*** varobj.c 09 Dec 2006 10:59:12 +1300 1.65
--- varobj.c 13 Dec 2006 19:17:36 +1300
***************
*** 26,31 ****
--- 26,32 ----
#include "language.h"
#include "wrapper.h"
#include "gdbcmd.h"
+ #include "block.h"
#include "gdb_assert.h"
#include "gdb_string.h"
*************** c_value_of_root (struct varobj **var_han
*** 1958,1965 ****
fi = frame_find_by_id (var->root->frame);
within_scope = fi != NULL;
/* FIXME: select_frame could fail */
! if (within_scope)
! select_frame (fi);
}
if (within_scope)
--- 1959,1972 ----
fi = frame_find_by_id (var->root->frame);
within_scope = fi != NULL;
/* FIXME: select_frame could fail */
! if (fi)
! {
! CORE_ADDR pc = get_frame_pc (fi);
! if (pc < BLOCK_START (var->root->valid_block) ||
! pc >= BLOCK_END (var->root->valid_block))
! within_scope = 0;
! select_frame (fi);
! }
}
if (within_scope)