From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15495 invoked by alias); 6 Feb 2008 00:27:20 -0000 Received: (qmail 15482 invoked by uid 22791); 6 Feb 2008 00:27:18 -0000 X-Spam-Check-By: sourceware.org Received: from fk-out-0910.google.com (HELO fk-out-0910.google.com) (209.85.128.189) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Feb 2008 00:26:49 +0000 Received: by fk-out-0910.google.com with SMTP id 26so2856176fkx.8 for ; Tue, 05 Feb 2008 16:26:47 -0800 (PST) Received: by 10.82.106.14 with SMTP id e14mr16612300buc.38.1202257606858; Tue, 05 Feb 2008 16:26:46 -0800 (PST) Received: by 10.82.165.12 with HTTP; Tue, 5 Feb 2008 16:26:46 -0800 (PST) Message-ID: <8f2776cb0802051626s7189fd87t12eef4fa45366f7d@mail.gmail.com> Date: Wed, 06 Feb 2008 00:27:00 -0000 From: "Jim Blandy" To: "Eli Zaretskii" Subject: Re: value of local variable stored in register Cc: kushneeraj@gmail.com, gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <8f2776cb0802051142s6ab14bs80f91835da26f4e8@mail.gmail.com> X-Google-Sender-Auth: 7bec6f02579c5bc1 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: 2008-02/txt/msg00035.txt.bz2 On Feb 5, 2008 12:35 PM, Eli Zaretskii wrote: > > The output of 'info address' isn't very helpful if c has a non-trivial > > DWARF location expression. > > Can you show an example? > > Also, is this problem relevant to the case in point (the OP presented > a test program)? Even simple programs can have this trouble. In the example below, GDB can't print the address of parameter 'x', even though its home is a fixed offset from the base address of the frame. $ cat recur.c #include int recur (int x) { if (x > 0) return 2 * recur (x - 2); else return 1; } int main (int argc, char **argv) { printf ("%d\n", recur (7)); } $ gcc -g recur.c -o recur $ ~/gdb/pub/nat/gdb/gdb recur GNU gdb 6.7.50.20080111-cvs Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) break recur Breakpoint 1 at 0x804838a: file recur.c, line 6. (gdb) run Starting program: /home/jimb/play/recur Breakpoint 1, recur (x=7) at recur.c:6 6 if (x > 0) (gdb) info address x Symbol "x" is a variable with complex or multiple locations (DWARF2). (gdb) shell readelf -wi recur The section .debug_info contains: Compilation Unit @ offset 0x0: Length: 369 Version: 2 Abbrev Offset: 0 Pointer Size: 4 <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_stmt_list : 0 DW_AT_high_pc : 0x80483e7 DW_AT_low_pc : 0x8048384 DW_AT_producer : GNU C 4.1.2 20070626 (Red Hat 4.1.2-13) DW_AT_language : 1 (ANSI C) DW_AT_name : recur.c DW_AT_comp_dir : /home/jimb/play ... <1><10b>: Abbrev Number: 5 (DW_TAG_subprogram) DW_AT_sibling : <137> DW_AT_external : 1 DW_AT_name : recur DW_AT_decl_file : 1 DW_AT_decl_line : 5 DW_AT_prototyped : 1 DW_AT_type : DW_AT_low_pc : 0x8048384 DW_AT_high_pc : 0x80483b1 DW_AT_frame_base : 0 (location list) <2><12a>: Abbrev Number: 6 (DW_TAG_formal_parameter) DW_AT_name : x DW_AT_decl_file : 1 DW_AT_decl_line : 4 DW_AT_type : DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0) ... (gdb)