From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11990 invoked by alias); 22 Mar 2002 00:23:24 -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 11980 invoked from network); 22 Mar 2002 00:23:22 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 22 Mar 2002 00:23:22 -0000 Received: from redhat.com (notinuse.cygnus.com [205.180.231.12]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id QAA15766; Thu, 21 Mar 2002 16:23:16 -0800 (PST) Message-ID: <3C9A7705.766C7E86@redhat.com> Date: Thu, 21 Mar 2002 16:23:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686) X-Accept-Language: en MIME-Version: 1.0 To: Kiranmaye Gannabathula CC: "'gdb@sources.redhat.com'" Subject: Re: Static variables incorrect address References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00184.txt.bz2 Kiranmaye Gannabathula wrote: > > Hello, > I have a problem with the global static variables in gdb. > > For a C program as below > > static int Data = 9; > > int Func1(void) > { > return Data; > } > > if i compile this with debug info and run it under gdb, when i breakpoint on > the variable Data and try to print its value i get some value and > if i look at the address > p /x Data > i get some invalid address. I believe you want to say "p /x &Data". Otherwise you will be looking at memory at an address determined by the value of the variable "Data".