From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6029 invoked by alias); 8 Mar 2003 14:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 5994 invoked by uid 71); 8 Mar 2003 14:36:00 -0000 Resent-Date: 8 Mar 2003 14:36:00 -0000 Resent-Message-ID: <20030308143600.5991.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, werner@almesberger.net Received: (qmail 3428 invoked from network); 8 Mar 2003 14:30:08 -0000 Received: from unknown (HELO host.almesberger.net) (63.105.73.239) by 172.16.49.205 with SMTP; 8 Mar 2003 14:30:08 -0000 Received: from almesberger.net (vpnwa-home [10.200.0.2]) by host.almesberger.net (8.11.6/8.9.3) with ESMTP id h28EU3c27610 for ; Sat, 8 Mar 2003 06:30:04 -0800 Received: (from werner@localhost) by almesberger.net (8.11.6/8.11.6) id h28ETwm27010; Sat, 8 Mar 2003 11:29:58 -0300 Message-Id: <200303081429.h28ETwm27010@almesberger.net> Date: Sat, 08 Mar 2003 14:36:00 -0000 From: werner@almesberger.net To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: debug/10005: gcc -O -g does not produce location information for aliases of a variable X-SW-Source: 2003-03/txt/msg00402.txt.bz2 List-Id: >Number: 10005 >Category: debug >Synopsis: gcc -O -g does not produce location information for aliases of a variable >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Mar 08 14:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Werner Almesberger >Release: 3.3 20030303 (prerelease) >Organization: >Environment: System: Linux ar 2.4.18 #5 Mon Mar 18 09:25:24 ART 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ./configure --prefix=/usr/local/gcc20030303/ --enable-languages=c >Description: gcc -O -g does not produce location information for aliases of a variable, so a debugger may fail to change the variable. Of course, one could argue that with -O, all bets are off as far as the accuracy of debugging information is concerned, but this still seems to be a fairly bad case. >How-To-Repeat: Example (with Red Hat's gcc 3.1 20011127 on ia32; gcc 3.3 yields different code, but the problem remains): $ cat <foo.c int bar; int main(int argc) { bar = (int) &argc; bar = argc; label: return argc; } EOF $ gcc -O -g foo.c $ readelf -w a.out ... DW_AT_name : (indirect string, offset: 0x3a): argc ... DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8; ) ... DW_AT_name : (indirect string, offset: 0x55): label ... DW_AT_low_pc : 0x80483a9 134513577 ... $ objdump -d a.out ... 08048398
: ... 80483a1: 8b 45 08 mov 0x8(%ebp),%eax 80483a4: a3 24 95 04 08 mov %eax,0x8049524 80483a9: c9 leave ... So suppose we place a breakpoint at "label" (0x80483a9), change "argc" (supposedly at 8(%ebp)), and let the program continue. In this case, "main" will still return the original value, and ignore the change. >Fix: >Release-Note: >Audit-Trail: >Unformatted: