home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gdb / bug / 893 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.9 KB  |  77 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!aztec.ucsc.edu!paul
  3. From: paul@aztec.ucsc.edu (Paul Tatarsky)
  4. Subject: Gdb print struct members and SunOS sparc?
  5. Message-ID: <1992Jul23.113627@aztec.ucsc.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: paul@terra.ucsc.edu
  8. Organization: UC Santa Cruz CIS/CE
  9. Distribution: gnu
  10. Date: Thu, 23 Jul 1992 18:43:47 GMT
  11. Approved: bug-gdb@prep.ai.mit.edu
  12. Lines: 63
  13.  
  14. Sorry if this has been asked before, but has anyone seen
  15. the following problem, and is it a configuration error on my part.
  16.  
  17. Environment:
  18. sparc SunOS 4.1.2
  19. gcc -v
  20. Reading specs from /usr/local/gnu/lib/gcc-lib/sparc-sun-sunos4.1.1/2.2.2/specs
  21. gcc version 2.2.2
  22. gdb 4.6 compiled with #define GCC_MANGLE_BUG in gdb/symtab.c
  23.  
  24. Sample Code:
  25. foo.c:
  26. typedef struct {
  27.         int x,y,z;
  28.     } FOO;
  29.  
  30.     printfoo( FOO foo )
  31.     {
  32.         printf("%d %d %d\n", foo.x, foo.y, foo.z );
  33.     }
  34.  
  35.     main()
  36.     {
  37.         FOO bar;
  38.  
  39.         bar.x = 10;
  40.         bar.y = 20;
  41.         bar.z = 30;
  42.  
  43.         printfoo( bar );
  44.     }
  45.  
  46. The problem:
  47. unix> gcc -g -o foo foo.c 
  48. unix> gdb foo
  49. GDB is free software and you are welcome to distribute copies of it
  50.  under certain conditions; type "show copying" to see the conditions.
  51. There is absolutely no warranty for GDB; type "show warranty" for details.
  52. GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
  53. (gdb) break printfoo 
  54. Breakpoint 1 at 0x22a4: file foo.c, line 7.
  55. (gdb) run
  56. Starting program: /auto/terra/b/staff/paul/foo 
  57.  
  58. Breakpoint 1, printfoo (foo={x = 4194433, y = 8292, z = 8296}) at foo.c:7
  59. 7               printf("%d %d %d\n", foo.x, foo.y, foo.z );
  60. (gdb) print foo.x
  61. $1 = 4194433
  62. (gdb) print foo.y
  63. $2 = 8292
  64. (gdb) print foo.z
  65. $3 = 8296
  66. (gdb) 
  67.  
  68. Why do my other systems (non-sparc,non SunOS) return x=10 y=20 z=30???
  69. Did I screw up the build for gcc, gdb, or both on SunOS?
  70. Please reply by email. Thanks in advance!
  71.  
  72.  Paul Tatarsky         email: paul@terra.ucsc.edu
  73.  UC Santa Cruz
  74.  CIS/CE Board          
  75.  
  76.  
  77.