diff options
author | Tom Tromey <tromey@redhat.com> | 2013-03-14 18:56:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-03-14 18:56:02 +0000 |
commit | 08c23b0d0fc03ae7248e8dc5e525bec29a85d209 (patch) | |
tree | ec6c6860552c5a5f13b06252761157d07c297aaf | |
parent | d5c7e0e967c643044a713f2fd4a27cace3624d7d (diff) | |
download | gdb-08c23b0d0fc03ae7248e8dc5e525bec29a85d209.zip gdb-08c23b0d0fc03ae7248e8dc5e525bec29a85d209.tar.gz gdb-08c23b0d0fc03ae7248e8dc5e525bec29a85d209.tar.bz2 |
* symtab.c (error_in_psymtab_expansion): New function.
(lookup_symbol_aux_quick)
(basic_lookup_transparent_type_quick): Remove "last resort"
code. Use error_in_psymtab_expansion.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/symtab.c | 59 |
2 files changed, 24 insertions, 42 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e8eac05..3f1ce0e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2013-03-14 Tom Tromey <tromey@redhat.com> + + * symtab.c (error_in_psymtab_expansion): New function. + (lookup_symbol_aux_quick) + (basic_lookup_transparent_type_quick): Remove "last resort" + code. Use error_in_psymtab_expansion. + 2013-03-14 Doug Evans <dje@google.com> Jan Kratochvil <jan.kratochvil@redhat.com> diff --git a/gdb/symtab.c b/gdb/symtab.c index e62293f..efdcf16 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1616,6 +1616,20 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile, return NULL; } +/* A helper function that throws an exception when a symbol was found + in a psymtab but not in a symtab. */ + +static void ATTRIBUTE_NORETURN +error_in_psymtab_expansion (int kind, const char *name, struct symtab *symtab) +{ + error (_("\ +Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\ +%s may be an inlined function, or may be a template function\n \ +(if a template, try specifying an instantiation: %s<type>)."), + kind == GLOBAL_BLOCK ? "global" : "static", + name, symtab_to_filename_for_display (symtab), name, name); +} + /* A helper function for lookup_symbol_aux that interfaces with the "quick" symbol table functions. */ @@ -1638,30 +1652,7 @@ lookup_symbol_aux_quick (struct objfile *objfile, int kind, block = BLOCKVECTOR_BLOCK (bv, kind); sym = lookup_block_symbol (block, name, domain); if (!sym) - { - /* This shouldn't be necessary, but as a last resort try - looking in the statics even though the psymtab claimed - the symbol was global, or vice-versa. It's possible - that the psymtab gets it wrong in some cases. */ - - /* FIXME: carlton/2002-09-30: Should we really do that? - If that happens, isn't it likely to be a GDB error, in - which case we should fix the GDB error rather than - silently dealing with it here? So I'd vote for - removing the check for the symbol in the other - block. */ - block = BLOCKVECTOR_BLOCK (bv, - kind == GLOBAL_BLOCK ? - STATIC_BLOCK : GLOBAL_BLOCK); - sym = lookup_block_symbol (block, name, domain); - if (!sym) - error (_("\ -Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\ -%s may be an inlined function, or may be a template function\n\ -(if a template, try specifying an instantiation: %s<type>)."), - kind == GLOBAL_BLOCK ? "global" : "static", - name, symtab_to_filename_for_display (symtab), name, name); - } + error_in_psymtab_expansion (kind, name, symtab); return fixup_symbol_section (sym, objfile); } @@ -1849,24 +1840,8 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, int kind, block = BLOCKVECTOR_BLOCK (bv, kind); sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); if (!sym) - { - int other_kind = kind == GLOBAL_BLOCK ? STATIC_BLOCK : GLOBAL_BLOCK; - - /* This shouldn't be necessary, but as a last resort - * try looking in the 'other kind' even though the psymtab - * claimed the symbol was one thing. It's possible that - * the psymtab gets it wrong in some cases. - */ - block = BLOCKVECTOR_BLOCK (bv, other_kind); - sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (!sym) - /* FIXME; error is wrong in one case. */ - error (_("\ -Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\ -%s may be an inlined function, or may be a template function\n\ -(if a template, try specifying an instantiation: %s<type>)."), - name, symtab_to_filename_for_display (symtab), name, name); - } + error_in_psymtab_expansion (kind, name, symtab); + if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) return SYMBOL_TYPE (sym); |