From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27798 invoked by alias); 24 Sep 2003 18:14:27 -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 28819 invoked from network); 24 Sep 2003 14:45:33 -0000 Received: from unknown (HELO cuddles.cambridge.redhat.com) (81.96.64.123) by sources.redhat.com with SMTP; 24 Sep 2003 14:45:33 -0000 Received: from cuddles.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by cuddles.cambridge.redhat.com (8.12.8/8.12.8) with ESMTP id h8OEjNuv011512; Wed, 24 Sep 2003 15:45:24 +0100 Received: (from aph@localhost) by cuddles.cambridge.redhat.com (8.12.8/8.12.8/Submit) id h8OEjLJt011370; Wed, 24 Sep 2003 15:45:21 +0100 Date: Wed, 24 Sep 2003 18:14:00 -0000 Message-Id: <200309241445.h8OEjLJt011370@cuddles.cambridge.redhat.com> From: Andrew Haley To: gcc@gcc.gnu.org CC: gdb@sources.redhat.com Subject: Handling aliases in debug information X-SW-Source: 2003-09/txt/msg00300.txt.bz2 In this program, a and b are aliases for the same variable: int main (int argc, char *argv[]) { union { int a; int b; }; a = argc; return b; } But debugging is hard: cuddles:~ $ g++ -v Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4/specs Configured with: '/local/aph/gcc/gcc/configure' '--enable-threads=posix '--enable-languages=c,c++,java : (reconfigured) Thread model: posix gcc version 3.4 20030915 (experimental) cuddles:~ $ g++ union.cc -g cuddles:~ $ gdb ./a.out GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) b main Breakpoint 1 at 0x8048434: file union.cc, line 10. (gdb) r Starting program: /cuddles/aph/home/a.out Breakpoint 1, main (argc=1, argv=0xbfffdbc4) at union.cc:10 10 a = argc; (gdb) n 11 return b; (gdb) p a No symbol "a" in current context. (gdb) info locals No locals. Is this because a. g++ is not generating good debug info for anonymous unions? b. gdb is not interpreting g++ debug info correctly? c. Some other reason? Thanks, Andrew.