home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gdb.bug
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!aztec.ucsc.edu!paul
- From: paul@aztec.ucsc.edu (Paul Tatarsky)
- Subject: Gdb print struct members and SunOS sparc?
- Message-ID: <1992Jul23.113627@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:43:47 GMT
- Approved: bug-gdb@prep.ai.mit.edu
- Lines: 63
-
- Sorry if this has been asked before, but has anyone seen
- the following problem, and is it a configuration error on my part.
-
- Environment:
- sparc SunOS 4.1.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 compiled with #define GCC_MANGLE_BUG in gdb/symtab.c
-
- 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 );
- }
-
- The problem:
- 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) print foo.x
- $1 = 4194433
- (gdb) print foo.y
- $2 = 8292
- (gdb) print foo.z
- $3 = 8296
- (gdb)
-
- Why do my other systems (non-sparc,non SunOS) return x=10 y=20 z=30???
- Did I screw up the build for gcc, gdb, or both on SunOS?
- Please reply by email. Thanks in advance!
-
- Paul Tatarsky email: paul@terra.ucsc.edu
- UC Santa Cruz
- CIS/CE Board
-
-
-