🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #114

Gdb on Sunos struct print problem?

#114
From: Paul Tatarsky
Date: Thu, 23 Jul 1992 18:01
60 lines
1993 bytes
Really sorry if this has been asked a thousand times.

I have the following environment:
SunOS 4.1.2
gcc 2.2.2: gcc -v
Reading specs from /usr/local/gnu/lib/gcc-lib/sparc-sun-sunos4.1.1/2.2.2/specs
gcc version 2.2.2
gdb 4.6 with #define GCC_MANGLE_BUG in symtab.c

The basic jist of the problem is that gdb doesn't print struct members
correctly on the suns. Did I screw up somewhere?

Sample code:
foo.c:
 typedef struct {
	int x,y,z;
    } FOO;

    printfoo( FOO foo )
    {
	printf("%d %d %d\n", foo.x, foo.y, foo.z );
    }

    main()
    {
	FOO bar;

	bar.x = 10;
	bar.y = 20;
	bar.z = 30;

	printfoo( bar );
    }

-- 
unix> gcc -g -o foo foo.c 
unix> gdb foo
GDB is free software and you are welcome to 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.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
(gdb) break printfoo
Breakpoint 1 at 0x22a4: file foo.c, line 7.
(gdb) run
Starting program: /auto/terra/b/staff/paul/foo 

Breakpoint 1, printfoo (foo={x = 4194433, y = 8292, z = 8296}) at foo.c:7
7               printf("%d %d %d\n", foo.x, foo.y, foo.z );
(gdb) 


Shouldn't this be (it is on all my other systems):
Breakpoint 1, printfoo (foo={x = 10, y = 20, z = 30}) at foo.c:7
7               printf("%d %d %d\n", foo.x, foo.y, foo.z );

Please reply by email. Thanks in advance.

 Paul Tatarsky         email: paul@terra.ucsc.edu
 UC Santa Cruz
 CIS/CE Board          
Technical Details
Message-ID: <1992Jul23.105153@aztec.ucsc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!aztec.ucsc.edu!paul

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!aztec.ucsc.edu!paul
From: paul@aztec.ucsc.edu (Paul Tatarsky)
Subject: Gdb on Sunos struct print problem?
Message-ID: <1992Jul23.105153@aztec.ucsc.edu>
Sender: gnulists@ai.mit.edu
Reply-To: paul@terra.ucsc.edu
Organization: UC Santa Cruz CIS/CE
Distribution: gnu
Date: Thu, 23 Jul 1992 18:01:11 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 61