From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12691 invoked by alias); 19 Feb 2005 11:19:02 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 12547 invoked from network); 19 Feb 2005 11:18:34 -0000 Received: from unknown (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org with SMTP; 19 Feb 2005 11:18:34 -0000 Received: from zaretski (pns03-208-119.inter.net.il [80.230.208.119]) by romy.inter.net.il (MOS 3.5.6-GR) with ESMTP id AON66064 (AUTH halo1); Sat, 19 Feb 2005 13:18:31 +0200 (IST) Date: Sat, 19 Feb 2005 16:25:00 -0000 From: "Eli Zaretskii" To: Jeff Message-ID: <01c51674$Blat.v2.4$be4a87a0@zahav.net.il> Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=ISO-8859-1 CC: gdb@sources.redhat.com In-reply-to: <42167219.8070507@comcast.net> (message from Jeff on Fri, 18 Feb 2005 17:54:17 -0500) Subject: Re: Cann't print local vars when nesting functions Reply-to: Eli Zaretskii References: <42167219.8070507@comcast.net> X-SW-Source: 2005-02/txt/msg00123.txt.bz2 > Date: Fri, 18 Feb 2005 17:54:17 -0500 > From: Jeff > > int main(int argc, char *argv[]){ > int i,j; > > int inside(void){ > int k,l; > k = 3; > l = 4; > } > > i = 0; > j = 1; > } > > Now set the break point to the same line, j =1, and this happens: > Breakpoint 1, main () at test.c:25 > 25 j = 1; > (gdb) p i > No symbol "i" in current context. > (gdb) > > What gives? Is there something you need to special when nesting functions? Please tell the details: what platform is this, what versions of GCC and GDB you use, and how (with what command-line options) you compiled and linked the program. Also, since the line "j = 1;" is not line 25 in the source you posted, could it be that the program you actually compiled was different? FWIW, I tried this with GCC 3.3.3, naive compiler command line, and GDB 6.3, and couldn't reproduce the problem with the source you posted.