From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8673 invoked by alias); 2 Apr 2006 06:59:53 -0000 Received: (qmail 8656 invoked by uid 22791); 2 Apr 2006 06:59:52 -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; Sun, 02 Apr 2006 06:59:50 +0000 Received: from farnswood.snap.net.nz (p202-124-115-11.snap.net.nz [202.124.115.11]) by viper.snap.net.nz (Postfix) with ESMTP id 80390749D8F; Sun, 2 Apr 2006 18:59:45 +1200 (NZST) Received: by farnswood.snap.net.nz (Postfix, from userid 501) id 8698962A99; Sun, 2 Apr 2006 07:59:20 +0100 (BST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17455.30279.765187.851779@farnswood.snap.net.nz> Date: Sun, 02 Apr 2006 06:59:00 -0000 To: Eli Zaretskii Cc: gdb@sources.redhat.com Subject: Re: info locals gives error In-Reply-To: References: <17452.52811.89546.605084@farnswood.snap.net.nz> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00002.txt.bz2 > > /* -*- compile-command: "cc -g -o simple simple.c"; -*- */ > > > > main(int argc, char **argv) { > > int i; > > i = 1; > > } > > [...] > > (gdb) b main > > Breakpoint 1 at 0x8048354: file simple.c, line 3. > > (gdb) r > > Starting program: /home/nickrob/simple > > Reading symbols from shared object read from target memory...done. > > Loaded system supplied DSO at 0x80e000 > > > > Breakpoint 1, main () at simple.c:3 > > 3 main(int argc, char **argv) { > > (gdb) info locals > > argc = Cannot access memory at address 0x0 > > I cannot reproduce this with GDB 6.4 and GCC versions 3.3.5 and 4.0.0 > on a Debian box. I also tried GCC 3.4.2 and GDB 6.3 on a Windows box. > What I get in all of those cases is some arbitrary garbage, not > "cannot access". With gcc --version gcc (GCC) 3.2 (Mandrake Linux 9.0 3.2-1mdk) (gdb) info args argc = 1 argv = (char **) 0xbffff7a4 With gcc --version gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3) (gdb) info args No arguments. readelf -wi simple (for GCC 3.2) gives (about 1200 lines of output): ... <2>: Abbrev Number: 3 (DW_TAG_formal_parameter) DW_AT_name : (indirect string, offset: 0x98e): argc DW_AT_decl_file : 1 DW_AT_decl_line : 3 DW_AT_type : DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8; ) <2>: Abbrev Number: 3 (DW_TAG_formal_parameter) DW_AT_name : (indirect string, offset: 0x993): argv DW_AT_decl_file : 1 DW_AT_decl_line : 3 DW_AT_type : DW_AT_location : 2 byte block: 91 c (DW_OP_fbreg: 12; ) <2>: Abbrev Number: 4 (DW_TAG_variable) DW_AT_name : i DW_AT_decl_file : 1 DW_AT_decl_line : 4 DW_AT_type : DW_AT_location : 2 byte block: 91 7c (DW_OP_fbreg: -4; ) ... readelf -wi simple (for GCC 4.1.0) gives (about 60 lines of output): ... <2><75>: Abbrev Number: 3 (DW_TAG_formal_parameter) DW_AT_name : argc DW_AT_decl_file : 1 DW_AT_decl_line : 3 DW_AT_type : <9a> <2><81>: Abbrev Number: 3 (DW_TAG_formal_parameter) DW_AT_name : argv DW_AT_decl_file : 1 DW_AT_decl_line : 3 DW_AT_type : <2><8d>: Abbrev Number: 4 (DW_TAG_variable) DW_AT_name : i DW_AT_decl_file : 1 DW_AT_decl_line : 4 DW_AT_type : <9a> DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16) ... I presume something is up with GCC 4.1.0 (which apparently is a part of a separate series to 4.0). Nick