home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / gdb / bug / 974 < prev    next >
Encoding:
Text File  |  1992-08-14  |  4.9 KB  |  172 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
  3. From: pfieland@citron.sw.stratus.com (Peggy Fieland)
  4. Subject: (none)
  5. Message-ID: <9208132014.AA15945@citron.sw.stratus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 13 Aug 1992 20:14:49 GMT
  10. Approved: bug-gdb@prep.ai.mit.edu
  11. Lines: 159
  12.  
  13. I am using gdb-4.6 on a Stratus i860.  As the following debugging 
  14. session indicates, gdb does not print types defined in inner scopes
  15. when "info types" is issued.
  16.  
  17. Here is the debugging session.  The test program is listed as part
  18. of the session:
  19.  
  20. maestro-tests% /net/citron/home/citron/pfieland/gdb-4.6/gdb-4.6/gdb/gdbx struct2
  21. GDB is free software and you are welcome to distribute copies of it
  22.  under certain conditions; type "show copying" to see the conditions.
  23. There is absolutely no warranty for GDB; type "show warranty" for details.
  24. GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
  25. (gdb) list 1
  26. 1       #include <stdio.h>
  27. 2
  28. 3
  29. 4       main()
  30. 5       {
  31. (gdb)
  32. 6       struct ms
  33. 7       {
  34. 8       int i;
  35. 9       int j;
  36. 10      };
  37. 11
  38. 12      struct ms mystruct;
  39. 13
  40. 14      mystruct.i = 5;
  41. 15      mystruct.j = 10;
  42. (gdb)
  43. 16      printf ("%d %d\n", mystruct.i, mystruct.j);
  44. 17
  45. 18      }
  46. (gdb) b main
  47. Breakpoint 1 at 0x1458: file struct2.c, line 14.
  48. (gdb) r
  49. Starting program: /home2/maestro/pfieland/tests/struct2
  50. `
  51. Breakpoint 1, main () at struct2.c:14
  52. 14      mystruct.i = 5;
  53. (gdb) info types
  54. All defined types:
  55.  
  56. File struct2.c:
  57. struct {
  58.     int _cnt;
  59.     unsigned char *_ptr;
  60.     unsigned char *_base;
  61.     unsigned char _flag;
  62.     unsigned char _file;
  63. };
  64. struct {
  65.     unsigned int ireg_used;
  66.     unsigned int freg_used;
  67.     long *reg_base;
  68.     long *mem_ptr;
  69. };
  70. typedef struct {
  71.     int _cnt;
  72.     unsigned char *_ptr;
  73.     unsigned char *_base;
  74.     unsigned char _flag;
  75.     unsigned char _file;
  76. } FILE;
  77. typedef long fpos_t;
  78. typedef unsigned int size_t;
  79. typedef struct {
  80.     unsigned int ireg_used;
  81.     unsigned int freg_used;
  82.     long *reg_base;
  83.     long *mem_ptr;
  84. } va_list;
  85. (gdb)
  86.  
  87.  
  88. Here is the fix:
  89.  
  90.  
  91. *** /home/tools/gnu/gdb-4.6/gdb/symtab.c    Tue Jul 14 03:34:30 1992
  92. --- gdb-4.6/gdb/symtab.c    Thu Aug 13 11:19:41 1992
  93. ***************
  94. *** 2141,2146 ****
  95. --- 2182,2188 ----
  96.       = {mst_bss,  mst_text, mst_abs, mst_unknown};
  97.     enum minimal_symbol_type ourtype = types[class];
  98.     enum minimal_symbol_type ourtype2 = types2[class];
  99. +   int limit;  /* added by Peggy Fieland (Margaret_Fieland@vos.stratus.com) see below */
  100.   
  101.     if (regexp)
  102.       {
  103. ***************
  104. *** 2186,2198 ****
  105.       {
  106.         struct partial_symbol *bound, *gbound, *sbound;
  107.         int keep_going = 1;
  108. !       
  109.         if (ps->readin) continue;
  110.         
  111.         gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
  112.         sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
  113.         bound = gbound;
  114. !       
  115.         /* Go through all of the symbols stored in a partial
  116.        symtab in one loop. */
  117.         psym = objfile->global_psymbols.list + ps->globals_offset;
  118. --- 2228,2240 ----
  119.       {
  120.         struct partial_symbol *bound, *gbound, *sbound;
  121.         int keep_going = 1;
  122.         if (ps->readin) continue;
  123.         
  124.         gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
  125.         sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
  126.         bound = gbound;
  127.         /* Go through all of the symbols stored in a partial
  128.        symtab in one loop. */
  129.         psym = objfile->global_psymbols.list + ps->globals_offset;
  130. ***************
  131. *** 2272,2278 ****
  132.        It happens that the first symtab in the list
  133.        for any given blockvector is the main file.  */
  134.         if (bv != prev_bv)
  135. !     for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
  136.         {
  137.           b = BLOCKVECTOR_BLOCK (bv, i);
  138.           /* Skip the sort if this block is always sorted.  */
  139. --- 2314,2332 ----
  140.        It happens that the first symtab in the list
  141.        for any given blockvector is the main file.  */
  142.         if (bv != prev_bv)
  143. !           /* altered by Peggy Fieland (Margaret_Fieland@vos.stratus.com, so as to make types
  144. !              defined in inner scopes visible.  Specifically, without this change ,
  145. !              "info types" does not show types defined inside blocks or procedures, since
  146. !              in dwarf they are NOT automatically installed in the static block. I added
  147. !              limit and set it according to the command being executed. */
  148. !    
  149. !           {
  150. !              if (class == 2)
  151. !                 limit = BLOCKVECTOR_NBLOCKS (bv)  - 1;
  152. !              else
  153. !                 limit = STATIC_BLOCK;   
  154. !    
  155. !              for (i = GLOBAL_BLOCK; i <= limit; i++)
  156.         {
  157.           b = BLOCKVECTOR_BLOCK (bv, i);
  158.           /* Skip the sort if this block is always sorted.  */
  159. ***************
  160. *** 2336,2341 ****
  161. --- 2390,2396 ----
  162.                 }
  163.             }
  164.             }
  165. +       }
  166.         }
  167.         prev_bv = bv;
  168.       }
  169.  
  170.