public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++
@ 2001-11-15 12:40 kewarken
  0 siblings, 0 replies; 3+ messages in thread
From: kewarken @ 2001-11-15 12:40 UTC (permalink / raw)
  To: gcc-gnats


>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 <stdio.h>


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> = {a = 0, b = 0, c = 0, d = 0, e = 0, _vptr. = 0x804997c}, <No data fields>}
(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==


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++
@ 2001-11-21 23:15 dje
  0 siblings, 0 replies; 3+ messages in thread
From: dje @ 2001-11-21 23:15 UTC (permalink / raw)
  To: dje, gcc-bugs, gcc-gnats, gcc-prs, kewarken, nobody

Synopsis: "gcc -gstabs" behaves differently than "gcc -g" for c++

Responsible-Changed-From-To: unassigned->dje
Responsible-Changed-By: dje
Responsible-Changed-When: Thu Nov 29 11:51:28 2001
Responsible-Changed-Why:
    submitter request
State-Changed-From-To: open->closed
State-Changed-By: dje
State-Changed-When: Thu Nov 29 11:51:28 2001
State-Changed-Why:
    user error

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4913&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++
@ 2001-11-21 23:15 dje
  0 siblings, 0 replies; 3+ messages in thread
From: dje @ 2001-11-21 23:15 UTC (permalink / raw)
  To: dje; +Cc: gcc-prs

The following reply was made to PR debug/4913; it has been noted by GNATS.

From: dje@gcc.gnu.org
To: dje@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
  gcc-prs@gcc.gnu.org, kewarken@qnx.com, nobody@gcc.gnu.org
Cc:  
Subject: Re: debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++
Date: 29 Nov 2001 19:51:30 -0000

 Synopsis: "gcc -gstabs" behaves differently than "gcc -g" for c++
 
 Responsible-Changed-From-To: unassigned->dje
 Responsible-Changed-By: dje
 Responsible-Changed-When: Thu Nov 29 11:51:28 2001
 Responsible-Changed-Why:
     submitter request
 State-Changed-From-To: open->closed
 State-Changed-By: dje
 State-Changed-When: Thu Nov 29 11:51:28 2001
 State-Changed-Why:
     user error
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4913&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-11-29 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-15 12:40 debug/4913: "gcc -gstabs" behaves differently than "gcc -g" for c++ kewarken
2001-11-21 23:15 dje
2001-11-21 23:15 dje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).