home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / gdb / bug / 1014 < prev    next >
Encoding:
Text File  |  1992-09-02  |  5.0 KB  |  159 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
  3. From: pfieland@citron.sw.stratus.com (Peggy Fieland)
  4. Subject: problem with inner procedures in gdb
  5. Message-ID: <9209021430.AA02702@citron.sw.stratus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 2 Sep 1992 14:30:39 GMT
  10. Approved: bug-gdb@prep.ai.mit.edu
  11. Lines: 146
  12.  
  13. I am running gdb-4.6 on a stratus i860.
  14.  
  15. In  the course of integrating pascal support into gdb, I discovered
  16. that gdb-4.6 does not handle the symbolic information for inner
  17. procedures properly.
  18.  
  19. Here is the sample debugging session:
  20.  
  21.  gdbx ~/tests/nested
  22. GDB is free software and you are welcome to distribute copies of it
  23.  under certain conditions; type "show copying" to see the conditions.
  24. There is absolutely no warranty for GDB; type "show warranty" for details.
  25. GDB 4.6 MLF modified 8/31/91, Copyright 1992 Free Software Foundation, Inc...
  26. Setting up the environment for debugging gdb.
  27. Function "fatal" not defined.
  28. (gdb) b main
  29. Breakpoint 1 at 01AB0H: file /home3/Languages/regression/gdb/pascal/source/nested.pascal, line 5.
  30. (gdb) r
  31. Starting program: /home2/maestro/pfieland/tests/nested
  32.  
  33. Breakpoint 1, main () at /home3/Languages/regression/gdb/pascal/source/nested.pascal:5
  34. 5       type     uns_tiny = packed 0..255;
  35. (gdb) b inner
  36. Function "inner" not defined.
  37. (gdb) p int
  38. No symbol "int" in current context.
  39. (gdb) p sint
  40. No symbol "sint" in current context.
  41. (gdb) maintenance print symbols xxx
  42. (gdb) c
  43. Continuing.
  44.  
  45. Program exited with code 0200.
  46. (gdb) q
  47.  
  48. Here is the output of the print symbols. Note that ALL of the symbols
  49. for the enclosing procedure are missing from the symbol table:
  50.  
  51.  
  52. Symtab for file /home3/Languages/regression/gdb/pascal/source/nested.pascal
  53. Read from object file /home2/maestro/pfieland/tests/nested (168908)
  54. Language: pascal
  55.  
  56. Line table:
  57.  
  58.  line 3 at 1a4c
  59.  line 5 at 1ab0
  60.  line 16 at 1ab8
  61.  line 20 at 1ae0
  62.  line 21 at 1ae8
  63.  line 22 at 1af0
  64.  line 23 at 1af8
  65.  line 26 at 1b10
  66.  line 27 at 1b18
  67.  line 28 at 1b20
  68.  line 29 at 1b28
  69.  line 30 at 1b30
  70.  line 31 at 1b38
  71.  line 32 at 1b40
  72.  line 33 at 1b4c
  73.  
  74. Blockvector:
  75.  
  76. block #000 (object 0x199698) [0x19b0..0x1b68]
  77.  int main(); block (object 0x199608) starting at 0x1a50,
  78.   block #001 (object 0x199628) [0x19b0..0x1b68] (under 0x199698)
  79.    typedef output output; 
  80.    typedef input input; 
  81.    typedef text text; 
  82.    typedef string  string ; 
  83.    typedef shortint shortint; 
  84.    typedef alpha alpha; 
  85.    typedef alfa alfa; 
  86.    typedef .bit .bit; 
  87.    typedef boolean boolean; 
  88.    typedef real real; 
  89.    typedef string string; 
  90.    typedef char char; 
  91.    typedef integer 1 integer 1; 
  92.    typedef uns short integer uns short integer; 
  93.    typedef uns tiny integer uns tiny integer; 
  94.    typedef tiny integer tiny integer; 
  95.    typedef integer integer; 
  96.    typedef integer  integer ; 
  97.    typedef .pointer .pointer; 
  98.     block #002 (object 0x199608) [0x1a50..0x1b68] (under 0x199628) main
  99.       block #003 (object 0x1995d0) [0x1abc..0x1b10] (under 0x199608) inner
  100.        int inner(); block (object 0x1995d0) starting at 0x1abc,
  101.        integer ti; local at 0xffffffe4,
  102.        typedef <subrange 0 .. 0> of integer  shortint; 
  103.        <subrange 0 .. 0> of integer  inner_sint; local at 0xffffffe2,
  104.        integer inner_int; local at 0xffffffdc,
  105.  
  106. Here is a fix:
  107.  
  108. *** /home/tools/gnu/gdb-4.6/gdb/dwarfread.c    Tue Jul 14 03:34:23 1992
  109. --- dwarfread.c    Tue Sep  1 15:49:53 1992
  110. ***************
  111. *** 1535,1542 ****
  112.         objfile -> ei.main_func_lowpc = dip -> at_low_pc;
  113.         objfile -> ei.main_func_highpc = dip -> at_high_pc;
  114.       }
  115.     new = push_context (0, dip -> at_low_pc);
  116. !   new -> name = new_symbol (dip, objfile);
  117.     list_in_scope = &local_symbols;
  118.     process_dies (thisdie + dip -> die_length, enddie, objfile);
  119.     new = pop_context ();
  120. --- 2260,2272 ----
  121.         objfile -> ei.main_func_lowpc = dip -> at_low_pc;
  122.         objfile -> ei.main_func_highpc = dip -> at_high_pc;
  123.       }
  124. +   /* Peggy Fieland.  We want this name to appear in symbols of the
  125. +      ENCLOSING SCOPE, so don't push the context until AFTER we've
  126. +      added the name to the list of symbols.  */
  127. +   sym = new_symbol (dip, objfile);
  128.     new = push_context (0, dip -> at_low_pc);
  129. !   new-> name = sym;
  130. !
  131.     list_in_scope = &local_symbols;
  132.     process_dies (thisdie + dip -> die_length, enddie, objfile);
  133.     new = pop_context ();
  134. ***************
  135. *** 1543,1549 ****
  136.     /* Make a block for the local symbols within.  */
  137.     finish_block (new -> name, &local_symbols, new -> old_blocks,
  138.           new -> start_addr, dip -> at_high_pc, objfile);
  139. !   list_in_scope = &file_symbols;
  140.   }
  141.   
  142.   
  143. --- 2273,2286 ----
  144.     /* Make a block for the local symbols within.  */
  145.     finish_block (new -> name, &local_symbols, new -> old_blocks,
  146.           new -> start_addr, dip -> at_high_pc, objfile);
  147. !   /* account for case of inner procedures.  Peggy Fieland. */
  148. !   if (context_stack_depth == 0)
  149. !      list_in_scope = &file_symbols;
  150. !   else
  151. !      {
  152. !         local_symbols = new->locals;
  153. !         list_in_scope = &local_symbols;
  154. !      }
  155.   }
  156.   
  157.   
  158.  
  159.