From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17491 invoked by alias); 15 Apr 2005 09:30:53 -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 17095 invoked from network); 15 Apr 2005 09:30:27 -0000 Received: from unknown (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org with SMTP; 15 Apr 2005 09:30:27 -0000 Received: from zaretski (IGLD-84-228-237-143.inter.net.il [84.228.237.143]) by romy.inter.net.il (MOS 3.5.6-GR) with ESMTP id AZJ60234 (AUTH halo1); Fri, 15 Apr 2005 12:30:23 +0300 (IDT) Date: Fri, 15 Apr 2005 09:30:00 -0000 From: "Eli Zaretskii" To: fedevaps@yahoo.dk Message-ID: <01c5419d$Blat.v2.4$40d810e0@zahav.net.il> Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=ISO-8859-1 CC: gdb@sources.redhat.com In-reply-to: (message from JS on Fri, 15 Apr 2005 11:09:09 +0200) Subject: Re: Still cannot print variable Reply-to: Eli Zaretskii References: X-SW-Source: 2005-04/txt/msg00091.txt.bz2 > From: JS > Date: Fri, 15 Apr 2005 11:09:09 +0200 > > I am still have problems printing a variable. I have this code in a file > called test.: > > int main() > { > > int d = 119; > > return(0); > > } > > I then compile it like this: > > gcc -g -Wall -o test test.c > > (I have also tried with option -O0 but that changes nothing). > > I run "gdb test" followed by "print d" and then I get this error: > > No symbol "d" in current context. You need to get to the main function, since "d" is a local variable. After you do get to main, step one line to get past the assignment of 119 to "d", and then print its value. When I do this, I get the value of "d" printed as I'd expect.