From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3160 invoked by alias); 23 Nov 2006 13:09:35 -0000 Received: (qmail 3149 invoked by uid 22791); 23 Nov 2006 13:09:33 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.227) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Nov 2006 13:09:28 +0000 Received: by wx-out-0506.google.com with SMTP id h26so569590wxd for ; Thu, 23 Nov 2006 05:09:26 -0800 (PST) Received: by 10.70.54.20 with SMTP id c20mr5563174wxa.1164287366042; Thu, 23 Nov 2006 05:09:26 -0800 (PST) Received: by 10.70.12.9 with HTTP; Thu, 23 Nov 2006 05:09:25 -0800 (PST) Message-ID: Date: Thu, 23 Nov 2006 13:09:00 -0000 From: "Rob Quill" To: "Jim Blandy" Subject: Re: Checking variable scope Cc: gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00157.txt.bz2 Hi, I am stepping through the program, so I suppose I'd be looking to see if the variable is in scope at the location of the PC. How would I call lookup_symbol, given that information? I had a brief look, but I wasn't sure what parameters to pass to the function, or how to get the right values. Thanks for your help. Rob On 22/11/06, Jim Blandy wrote: > > "Rob Quill" writes: > > I am trying to make it possible to be able to check if a variable is > > in scope at a given time. My current implementation for this involves > > adding a parameter to parse_expression, and the parsing functions it > > calls, all the way until it gets to the line: > > > > if (sym == 0) > > error ("No symbol \"%s\" in specified context.", copy_name ($3)); > > > > in c-exp.y > > > > as which point it doesn't call error, but calls another function which > > returns a value signifing that the variable is not in scope. > > > > Whilst this is OK, in that it (should) work, I was wondering if anyone > > had a neater way of implementing it? > > Why not call lookup_symbol directly? You can get the block that needs > with block_for_pc_sect. Are you selecting the location by source > position, or PC, or what? >