🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52060

Re: Getting <unknown struct> from gdb

#52060
From: Robert Mollitor
Date: Thu, 25 Feb 1993 16:52
86 lines
2155 bytes
>I am designing a program that has two processes share memory,
>I am checking to see if one process has written into memory
>by looking at a pointer in a process controlled by gdb, when I stop
>at a breakpoint and give the command
>
>(gdb)display *data
>
>It responds with 
>(gdb) data = <unknown struct>
>
>Does anyone out there know why it might be happening
>
>I am using gdb 2.3.3 and gdb 4.7
            ^^^
            g++ I assume
 

I've also been getting this, but only under case (A):

(A)

    typedef struct Foo Foo;
    struct Foo
      {
        int a;
      };

    Foo *foo;

    (gdb) print *foo

    [<unknown struct>]

(B)

    typedef struct Foo 
        {
          int a;
        }
      Foo;

    Foo *foo;

    (gdb) print *foo

    [works, I believe]

(C)

    struct Foo
      {
        int a;
      };
    typedef struct Foo Foo;

    Foo *foo;

    (gdb) print *foo

    [works, I believe]

(D)

    typedef struct Foo Foo;
    struct Foo
      {
        int a;
      };
    typedef Foo Bar;	// Bar is not used anywhere

    Foo *foo;

    (gdb) print *foo

    [works, which is pretty weird]


Actually I think I noticed this with g++ 2.3.2, but I think it is still
broken with g++ 2.3.3.  Also, I'm going by memory right now, so I may have
something wrong.  I'm pretty sure about the weird workaround, though.

robt
--
Robert Mollitor						      robert@visix.com
Visix Software Inc.					...!uupsi!visix!robert
Technical Details
Message-ID: <C30K7M.HqK@visix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!gatech!news.ans.net!cmcl2!psinntp!psinntp!viper!news
References: <C2x474.KxJ@dcs.ed.ac.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,898541e3d4c7fd77,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-02-25 08:52:34 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!howland.reston.ans.net!gatech!news.ans.net!cmcl2!psinntp!psinntp!viper!news
From: robert@visix.com (Robert Mollitor)
Subject: Re: Getting <unknown struct> from gdb
Sender: news@visix.com
Message-ID: <C30K7M.HqK@visix.com>
Date: Thu, 25 Feb 1993 16:52:34 GMT
References: <C2x474.KxJ@dcs.ed.ac.uk>
Organization: Visix Software Inc., Reston, VA
Followup-To: gnu.gcc.help
Lines: 86