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

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!aztec.ucsc.edu!paul
  3. From: paul@aztec.ucsc.edu (Paul Tatarsky)
  4. Subject: Gdb on Sunos struct print problem?
  5. Message-ID: <1992Jul23.105153@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:01:11 GMT
  11. Approved: bug-gdb@prep.ai.mit.edu
  12. Lines: 61
  13.  
  14. Really sorry if this has been asked a thousand times.
  15.  
  16. I have the following environment:
  17. SunOS 4.1.2
  18. gcc 2.2.2: gcc -v
  19. Reading specs from /usr/local/gnu/lib/gcc-lib/sparc-sun-sunos4.1.1/2.2.2/specs
  20. gcc version 2.2.2
  21. gdb 4.6 with #define GCC_MANGLE_BUG in symtab.c
  22.  
  23. The basic jist of the problem is that gdb doesn't print struct members
  24. correctly on the suns. Did I screw up somewhere?
  25.  
  26. Sample code:
  27. foo.c:
  28.  typedef struct {
  29.     int x,y,z;
  30.     } FOO;
  31.  
  32.     printfoo( FOO foo )
  33.     {
  34.     printf("%d %d %d\n", foo.x, foo.y, foo.z );
  35.     }
  36.  
  37.     main()
  38.     {
  39.     FOO bar;
  40.  
  41.     bar.x = 10;
  42.     bar.y = 20;
  43.     bar.z = 30;
  44.  
  45.     printfoo( bar );
  46.     }
  47.  
  48. -- 
  49. unix> gcc -g -o foo foo.c 
  50. unix> gdb foo
  51. GDB is free software and you are welcome to distribute copies of it
  52.  under certain conditions; type "show copying" to see the conditions.
  53. There is absolutely no warranty for GDB; type "show warranty" for details.
  54. GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
  55. (gdb) break printfoo
  56. Breakpoint 1 at 0x22a4: file foo.c, line 7.
  57. (gdb) run
  58. Starting program: /auto/terra/b/staff/paul/foo 
  59.  
  60. Breakpoint 1, printfoo (foo={x = 4194433, y = 8292, z = 8296}) at foo.c:7
  61. 7               printf("%d %d %d\n", foo.x, foo.y, foo.z );
  62. (gdb) 
  63.  
  64.  
  65. Shouldn't this be (it is on all my other systems):
  66. Breakpoint 1, printfoo (foo={x = 10, y = 20, z = 30}) at foo.c:7
  67. 7               printf("%d %d %d\n", foo.x, foo.y, foo.z );
  68.  
  69. Please reply by email. Thanks in advance.
  70.  
  71.  Paul Tatarsky         email: paul@terra.ucsc.edu
  72.  UC Santa Cruz
  73.  CIS/CE Board          
  74.  
  75.