aboutsummaryrefslogtreecommitdiff
path: root/gdb/buildsym.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-01-21 16:49:40 +0000
committerDaniel Jacobowitz <drow@false.org>2007-01-21 16:49:40 +0000
commitcb1df416fb6d2cc4837a8f81c5f102821c02db93 (patch)
tree4121c2130d5016d17bb765aafc6399b46742397d /gdb/buildsym.c
parent727da90068091580ad9cea2a18cd95234b600d21 (diff)
downloadgdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.zip
gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.tar.gz
gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.tar.bz2
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Daniel Jacobowitz <dan@codesourcery.com> * buildsym.c (end_symtab): Use preallocated symtab if available. Fill in SYMBOL_SYMTAB. * buildsym.h (struct subfile): Add symtab member. * dwarf2read.c (struct dwarf2_cu): Add line_header. (struct file_entry): Add symtab. (free_cu_line_header): New function. (read_file_scope): Use it. Save line_header in the cu. Process lines before DIEs. (add_file_name): Initialize new symtab member. (dwarf_decode_lines): Create symtabs for included files. (new_symbol): Set SYMBOL_SYMTAB. * symtab.c (lookup_symbol): Use SYMBOL_SYMTAB. (search_symbols): Likewise. * symtab.h (struct symbol): Add symtab member. (SYMBOL_SYMTAB): Define. * gdb.base/included.c, gdb.base/included.exp, gdb.base/included.h: New files.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r--gdb/buildsym.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index e0e2d4d..ae0750a 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -959,7 +959,10 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
}
/* Now, allocate a symbol table. */
- symtab = allocate_symtab (subfile->name, objfile);
+ if (subfile->symtab == NULL)
+ symtab = allocate_symtab (subfile->name, objfile);
+ else
+ symtab = subfile->symtab;
/* Fill in its components. */
symtab->blockvector = blockvector;
@@ -1048,6 +1051,26 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
symtab->primary = 1;
}
+ /* Default any symbols without a specified symtab to the primary
+ symtab. */
+ if (blockvector)
+ {
+ int block_i;
+
+ for (block_i = 0; block_i < BLOCKVECTOR_NBLOCKS (blockvector); block_i++)
+ {
+ struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
+ struct symbol *sym;
+ struct dict_iterator iter;
+
+ for (sym = dict_iterator_first (BLOCK_DICT (block), &iter);
+ sym != NULL;
+ sym = dict_iterator_next (&iter))
+ if (SYMBOL_SYMTAB (sym) == NULL)
+ SYMBOL_SYMTAB (sym) = symtab;
+ }
+ }
+
last_source_file = NULL;
current_subfile = NULL;
pending_macros = NULL;