From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3806 invoked by alias); 13 Dec 2006 06:32:41 -0000 Received: (qmail 3798 invoked by uid 22791); 13 Dec 2006 06:32:40 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 13 Dec 2006 06:32:35 +0000 Received: from kahikatea.snap.net.nz (p202-124-125-62.snap.net.nz [202.124.125.62]) by viper.snap.net.nz (Postfix) with ESMTP id 056673DA093 for ; Wed, 13 Dec 2006 19:33:51 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 7EA90BE431; Wed, 13 Dec 2006 19:28:06 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17791.40309.90872.126841@kahikatea.snap.net.nz> Date: Wed, 13 Dec 2006 06:32:00 -0000 To: gdb-patches@sources.redhat.com Subject: Re: MI: Another -var-update bug? [PATCH] In-Reply-To: <17790.36044.454650.114329@kahikatea.snap.net.nz> References: <17790.36044.454650.114329@kahikatea.snap.net.nz> X-Mailer: VM 7.19 under Emacs 22.0.91.17 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00170.txt.bz2 > 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 * 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)