From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12708 invoked by alias); 20 Nov 2001 16: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 12680 invoked by uid 71); 20 Nov 2001 16:35:59 -0000 Resent-Date: 20 Nov 2001 16:35:59 -0000 Resent-Message-ID: <20011120163559.12679.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, kewarken@qnx.com Received:(qmail 9675 invoked by uid 61); 20 Nov 2001 16:26:22 -0000 Message-Id:<20011120162622.9674.qmail@sourceware.cygnus.com> Date: Thu, 15 Nov 2001 12:40:00 -0000 From: kewarken@qnx.com Reply-To: kewarken@qnx.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++ X-SW-Source: 2001-11/txt/msg00339.txt.bz2 List-Id: >Number: 4913 >Category: debug >Synopsis: "gcc -gstabs" behaves differently than "gcc -g" for c++ >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Nov 20 08:35:59 PST 2001 >Closed-Date: >Last-Modified: >Originator: Kris Warkentin >Release: gcc-2.95.4 >Organization: >Environment: Debian Gnu/Linux testing Linux stimpy 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i686 unknown >Description: Here is a script that shows the problem. Basically examining a class which inherits from a parent class looks different depending on how it was compiled. Since gcc uses stabs by default (on a linux box anyway), then gcc -g should give the same results as gcc -gstabs. This test case shows that it does not. Script started on Tue Nov 20 11:10:59 2001 marcind@stimpy:~$ cat testit.cc #include class A { public: int a; int b; int c; virtual void foo(int arg) = 0; private: int d; int e; }; class B : public A { public: void foo(int arg); }; void B::foo(int arg) { a = arg; b = arg; c = arg; } void main( ) { B* pA = new(B); pA->foo(55); pA->a = 1; pA->b = 2; pA->c = 3; } marcind@stimpy:~$ g++ -g -o testit testit.cc marcind@stimpy:~$ gdb testit GNU gdb 5.0.90-cvs (MI_OUT) Copyright 2001 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 "i386-linux"... (gdb) b main Breakpoint 1 at 0x804873c: file testit.cc, line 34. (gdb) r Starting program: /home/marcind/testit Breakpoint 1, main () at testit.cc:34 34 B* pA = new(B); (gdb) n 36 pA->foo(55); (gdb) print *pA $1 = { = {a = 0, b = 0, c = 0, d = 0, e = 0, _vptr. = 0x804997c}, } (gdb) print pA->a $2 = 0 (gdb) info source Current source file is testit.cc Compilation directory is /home/marcind/ Located in /home/marcind/testit.cc Contains 42 lines. Source language is c++. Compiled with stabs debugging format. (gdb) The program is running. Exit anyway? (y or n) y marcind@stimpy:~$ gcc -gstabs -o testit testit.cc marcind@stimpy:~$ gdb testit GNU gdb 5.0.90-cvs (MI_OUT) Copyright 2001 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 "i386-linux"... (gdb) b main Breakpoint 1 at 0x804936c: file testit.cc, line 34. (gdb) r Starting program: /home/marcind/testit Breakpoint 1, main () at testit.cc:34 34 B* pA = new(B); (gdb) n 36 pA->foo(55); (gdb) print pA $1 = (B *) 0x8050470 (gdb) print *pA $2 = {A = {a = 0, b = 0, c = 0, d = 0, e = 0, _vptr.A = 0x804e3c8}} (gdb) print pA->a There is no member named a. (gdb) print pA->A->a $3 = 0 (gdb) info source Current source file is testit.cc Located in /home/marcind/testit.cc Contains 42 lines. Source language is c++. Compiled with stabs debugging format. (gdb) The program is running. Exit anyway? (y or n) y marcind@stimpy:~$ exit Script done on Tue Nov 20 11:13:39 2001 >How-To-Repeat: see above >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: unknown; name="testit.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="testit.cc" I2luY2x1ZGUgPHN0ZGlvLmg+CgoKY2xhc3MgQSB7CgpwdWJsaWM6CglpbnQgYTsKCWludCBiOwoJ aW50IGM7CiAgICB2aXJ0dWFsIHZvaWQgZm9vKGludCBhcmcpID0gMDsKCnByaXZhdGU6CglpbnQg ZDsKCWludCBlOwp9OwoKY2xhc3MgQiA6IHB1YmxpYyBBIHsKCnB1YmxpYzoKCXZvaWQgZm9vKGlu dCBhcmcpOwoKfTsKCnZvaWQgQjo6Zm9vKGludCBhcmcpCnsKCWEgPSBhcmc7CgliID0gYXJnOwoJ YyA9IGFyZzsKfQoKCnZvaWQgbWFpbiggKQp7CglCKiBwQSA9IG5ldyhCKTsKCglwQS0+Zm9vKDU1 KTsKCglwQS0+YSA9IDE7CglwQS0+YiA9IDI7CglwQS0+YyA9IDM7Cgp9Cg==