home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gdb.bug
- Path: sparky!uunet!cis.ohio-state.edu!citron.sw.stratus.com!pfieland
- From: pfieland@citron.sw.stratus.com (Peggy Fieland)
- Subject: problem with inner procedures in gdb
- Message-ID: <9209021430.AA02702@citron.sw.stratus.com>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Wed, 2 Sep 1992 14:30:39 GMT
- Approved: bug-gdb@prep.ai.mit.edu
- Lines: 146
-
- I am running gdb-4.6 on a stratus i860.
-
- In the course of integrating pascal support into gdb, I discovered
- that gdb-4.6 does not handle the symbolic information for inner
- procedures properly.
-
- Here is the sample debugging session:
-
- gdbx ~/tests/nested
- 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 MLF modified 8/31/91, Copyright 1992 Free Software Foundation, Inc...
- Setting up the environment for debugging gdb.
- Function "fatal" not defined.
- (gdb) b main
- Breakpoint 1 at 01AB0H: file /home3/Languages/regression/gdb/pascal/source/nested.pascal, line 5.
- (gdb) r
- Starting program: /home2/maestro/pfieland/tests/nested
-
- Breakpoint 1, main () at /home3/Languages/regression/gdb/pascal/source/nested.pascal:5
- 5 type uns_tiny = packed 0..255;
- (gdb) b inner
- Function "inner" not defined.
- (gdb) p int
- No symbol "int" in current context.
- (gdb) p sint
- No symbol "sint" in current context.
- (gdb) maintenance print symbols xxx
- (gdb) c
- Continuing.
-
- Program exited with code 0200.
- (gdb) q
-
- Here is the output of the print symbols. Note that ALL of the symbols
- for the enclosing procedure are missing from the symbol table:
-
-
- Symtab for file /home3/Languages/regression/gdb/pascal/source/nested.pascal
- Read from object file /home2/maestro/pfieland/tests/nested (168908)
- Language: pascal
-
- Line table:
-
- line 3 at 1a4c
- line 5 at 1ab0
- line 16 at 1ab8
- line 20 at 1ae0
- line 21 at 1ae8
- line 22 at 1af0
- line 23 at 1af8
- line 26 at 1b10
- line 27 at 1b18
- line 28 at 1b20
- line 29 at 1b28
- line 30 at 1b30
- line 31 at 1b38
- line 32 at 1b40
- line 33 at 1b4c
-
- Blockvector:
-
- block #000 (object 0x199698) [0x19b0..0x1b68]
- int main(); block (object 0x199608) starting at 0x1a50,
- block #001 (object 0x199628) [0x19b0..0x1b68] (under 0x199698)
- typedef output output;
- typedef input input;
- typedef text text;
- typedef string string ;
- typedef shortint shortint;
- typedef alpha alpha;
- typedef alfa alfa;
- typedef .bit .bit;
- typedef boolean boolean;
- typedef real real;
- typedef string string;
- typedef char char;
- typedef integer 1 integer 1;
- typedef uns short integer uns short integer;
- typedef uns tiny integer uns tiny integer;
- typedef tiny integer tiny integer;
- typedef integer integer;
- typedef integer integer ;
- typedef .pointer .pointer;
- block #002 (object 0x199608) [0x1a50..0x1b68] (under 0x199628) main
- block #003 (object 0x1995d0) [0x1abc..0x1b10] (under 0x199608) inner
- int inner(); block (object 0x1995d0) starting at 0x1abc,
- integer ti; local at 0xffffffe4,
- typedef <subrange 0 .. 0> of integer shortint;
- <subrange 0 .. 0> of integer inner_sint; local at 0xffffffe2,
- integer inner_int; local at 0xffffffdc,
-
- Here is a fix:
-
- *** /home/tools/gnu/gdb-4.6/gdb/dwarfread.c Tue Jul 14 03:34:23 1992
- --- dwarfread.c Tue Sep 1 15:49:53 1992
- ***************
- *** 1535,1542 ****
- objfile -> ei.main_func_lowpc = dip -> at_low_pc;
- objfile -> ei.main_func_highpc = dip -> at_high_pc;
- }
- new = push_context (0, dip -> at_low_pc);
- ! new -> name = new_symbol (dip, objfile);
- list_in_scope = &local_symbols;
- process_dies (thisdie + dip -> die_length, enddie, objfile);
- new = pop_context ();
- --- 2260,2272 ----
- objfile -> ei.main_func_lowpc = dip -> at_low_pc;
- objfile -> ei.main_func_highpc = dip -> at_high_pc;
- }
- + /* Peggy Fieland. We want this name to appear in symbols of the
- + ENCLOSING SCOPE, so don't push the context until AFTER we've
- + added the name to the list of symbols. */
- + sym = new_symbol (dip, objfile);
- new = push_context (0, dip -> at_low_pc);
- ! new-> name = sym;
- !
- list_in_scope = &local_symbols;
- process_dies (thisdie + dip -> die_length, enddie, objfile);
- new = pop_context ();
- ***************
- *** 1543,1549 ****
- /* Make a block for the local symbols within. */
- finish_block (new -> name, &local_symbols, new -> old_blocks,
- new -> start_addr, dip -> at_high_pc, objfile);
- ! list_in_scope = &file_symbols;
- }
-
-
- --- 2273,2286 ----
- /* Make a block for the local symbols within. */
- finish_block (new -> name, &local_symbols, new -> old_blocks,
- new -> start_addr, dip -> at_high_pc, objfile);
- ! /* account for case of inner procedures. Peggy Fieland. */
- ! if (context_stack_depth == 0)
- ! list_in_scope = &file_symbols;
- ! else
- ! {
- ! local_symbols = new->locals;
- ! list_in_scope = &local_symbols;
- ! }
- }
-
-
-
-