🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1281

gdb problem with gcc-2.x debug output for anon structures

#1281
From: Peter Schauer
Date: Wed, 16 Dec 1992 13:51
48 lines
1565 bytes
Given this little C++ program compiled by gcc-2.x (any dbx debugging version):

pes$ cat x.C
typedef struct
{
        int a;
        int b;
} my_struct;

my_struct g;
main() {}

gdb-4.x is unable to print g:

(gdb) p g
$1 = <unknown struct>
(gdb) ptype g
type = struct my_struct {<incomplete type>
}

This is due to the following #if 0 in dbxout.c:
#if 0 /* Tiemann says this creates output tha "confuses GDB".
         Too bad the info is so vague.  Hope this doesn't lose.  */
             && ! (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
                   && DECL_IGNORED_P (TYPE_NAME (type)))
#endif

If this is changed to a #if 1, gdb is able to print g:

(gdb) p g
$1 = {
  a = 0x0, 
  b = 0x0
}
(gdb) ptype g
type = struct my_struct {
    int a;
    int b;
}

I am not sure what input "confused" gdb and if the newer versions of
gdb will still get confused with that input, but maybe this if 0 should
be removed.

Hope this helps,

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de
Technical Details
Message-ID: <92Dec16.125208met.20493@rebus.regent.e-technik.tu-muenchen.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!regent.e-technik.tu-muenchen.dbp.DE!Peter.Schauer

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!regent.e-technik.tu-muenchen.dbp.DE!Peter.Schauer
From: Peter.Schauer@regent.e-technik.tu-muenchen.dbp.DE (Peter Schauer)
Subject: gdb problem with gcc-2.x debug output for anon structures
Message-ID: <92Dec16.125208met.20493@rebus.regent.e-technik.tu-muenchen.de>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 16 Dec 1992 13:51:52 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 49