aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.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/symtab.c
parent727da90068091580ad9cea2a18cd95234b600d21 (diff)
downloadfsf-binutils-gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.zip
fsf-binutils-gdb-cb1df416fb6d2cc4837a8f81c5f102821c02db93.tar.gz
fsf-binutils-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/symtab.c')
-rw-r--r--gdb/symtab.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 4a5b1e2..e00edf7 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1133,6 +1133,10 @@ lookup_symbol (const char *name, const struct block *block,
if (needtofreename)
xfree (demangled_name);
+ /* Override the returned symtab with the symbol's specific one. */
+ if (returnval != NULL && symtab != NULL)
+ *symtab = SYMBOL_SYMTAB (returnval);
+
return returnval;
}
@@ -3008,7 +3012,11 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
QUIT;
/* If it would match (logic taken from loop below)
- load the file and go on to the next one */
+ load the file and go on to the next one. We check the
+ filename here, but that's a bit bogus: we don't know
+ what file it really comes from until we have full
+ symtabs. The symbol might be in a header file included by
+ this psymtab. This only affects Insight. */
if (file_matches (ps->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0)
@@ -3087,8 +3095,10 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
b = BLOCKVECTOR_BLOCK (bv, i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
+ struct symtab *real_symtab = SYMBOL_SYMTAB (sym);
QUIT;
- if (file_matches (s->filename, files, nfiles)
+
+ if (file_matches (real_symtab->filename, files, nfiles)
&& ((regexp == NULL
|| re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
&& ((kind == VARIABLES_DOMAIN && SYMBOL_CLASS (sym) != LOC_TYPEDEF
@@ -3101,7 +3111,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[],
/* match */
psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
psr->block = i;
- psr->symtab = s;
+ psr->symtab = real_symtab;
psr->symbol = sym;
psr->msymbol = NULL;
psr->next = NULL;