diff options
author | Doug Evans <xdje42@gmail.com> | 2014-12-23 07:55:39 -0800 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2014-12-23 07:58:14 -0800 |
commit | 1994afbf19892c9e614a034fbf1a5233e9addce3 (patch) | |
tree | af1c6640f99921a6f636e860dc10914dc53cedea /gdb/symtab.h | |
parent | 9d7b48dc6e8415e95f5228a6f66b414827eb0204 (diff) | |
download | gdb-1994afbf19892c9e614a034fbf1a5233e9addce3.zip gdb-1994afbf19892c9e614a034fbf1a5233e9addce3.tar.gz gdb-1994afbf19892c9e614a034fbf1a5233e9addce3.tar.bz2 |
Look up primitive types as symbols.
gdb/ChangeLog:
* ada-lang.c (user_select_syms): Only fetch symtab if symbol is
objfile-owned.
(cache_symbol): Ignore symbols that are not objfile-owned.
* block.c (block_objfile): New function.
(block_gdbarch): New function.
* block.h (block_objfile): Declare.
(block_gdbarch): Declare.
* c-exp.y (classify_name): Remove call to
language_lookup_primitive_type. No longer necessary.
* gdbtypes.c (lookup_typename): Call lookup_symbol_in_language.
Remove call to language_lookup_primitive_type. No longer necessary.
* guile/scm-symbol.c (syscm_gdbarch_data_key): New static global.
(syscm_gdbarch_data): New struct.
(syscm_init_arch_symbols): New function.
(syscm_get_symbol_map): Renamed from syscm_objfile_symbol_map.
All callers updated. Handle symbols owned by arches.
(gdbscm_symbol_symtab): Handle symbols owned by arches.
(gdbscm_initialize_symbols): Initialize syscm_gdbarch_data_key.
* language.c (language_lookup_primitive_type_1): New function.
(language_lookup_primitive_type): Call it.
(language_alloc_type_symbol): New function.
(language_init_primitive_type_symbols): New function.
(language_lookup_primitive_type_as_symbol): New function.
* language.h (struct language_arch_info) <primitive_type_symbols>:
New member.
(language_lookup_primitive_type): Add function comment.
(language_lookup_primitive_type_as_symbol): Declare.
* printcmd.c (address_info): Handle arch-owned symbols.
* python/py-symbol.c (sympy_get_symtab): Ditto.
(set_symbol): Ditto.
(sympy_dealloc): Ditto.
* symmisc.c (print_symbol): Ditto.
* symtab.c (fixup_symbol_section): Ditto.
(lookup_symbol_aux): Initialize block_found.
(basic_lookup_symbol_nonlocal): Try looking up the symbol as a
primitive type.
(initialize_objfile_symbol_1): New function.
(initialize_objfile_symbol): Call it.
(allocate_symbol): Call it.
(allocate_template_symbol): Call it.
(symbol_objfile): Assert symbol is objfile-owned.
(symbol_arch, symbol_symtab, symbol_set_symtab): Ditto.
* symtab.h (struct symbol) <owner>: Replaces member "symtab".
(struct symbol) <is_objfile_owned>: New member.
(SYMBOL_OBJFILE_OWNED): New macro.
* cp-namespace.c (cp_lookup_bare_symbol): New arg langdef.
All callers updated. Try to find the symbol as a primitive type.
(lookup_namespace_scope): New arg langdef. All callers updated.
Call cp_lookup_bare_symbol directly for simple bare symbols.
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r-- | gdb/symtab.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h index b3a9a6b..3f645b1 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -711,10 +711,19 @@ struct symbol struct type *type; - /* The symbol table containing this symbol. This is the file - associated with LINE. It can be NULL during symbols read-in but it is - never NULL during normal operation. */ - struct symtab *symtab; + /* The owner of this symbol. + Which one to use is defined by symbol.is_arch_owned. */ + + union + { + /* The symbol table containing this symbol. This is the file associated + with LINE. It can be NULL during symbols read-in but it is never NULL + during normal operation. */ + struct symtab *symtab; + + /* For types defined by the architecture. */ + struct gdbarch *arch; + } owner; /* Domain code. */ @@ -726,6 +735,11 @@ struct symbol unsigned int aclass_index : SYMBOL_ACLASS_BITS; + /* If non-zero then symbol is objfile-owned, use owner.symtab. + Otherwise symbol is arch-owned, use owner.arch. */ + + unsigned int is_objfile_owned : 1; + /* Whether this is an argument. */ unsigned is_argument : 1; @@ -742,6 +756,7 @@ struct symbol SYMBOL_INLINED set) this is the line number of the function's call site. Inlined function symbols are not definitions, and they are never found by symbol table lookup. + If this symbol is arch-owned, LINE shall be zero. FIXME: Should we really make the assumption that nobody will try to debug files longer than 64K lines? What about machine @@ -769,10 +784,14 @@ struct symbol extern const struct symbol_impl *symbol_impls; +/* Note: There is no accessor macro for symbol.owner because it is + "private". */ + #define SYMBOL_DOMAIN(symbol) (symbol)->domain #define SYMBOL_IMPL(symbol) (symbol_impls[(symbol)->aclass_index]) #define SYMBOL_ACLASS_INDEX(symbol) (symbol)->aclass_index #define SYMBOL_CLASS(symbol) (SYMBOL_IMPL (symbol).aclass) +#define SYMBOL_OBJFILE_OWNED(symbol) ((symbol)->is_objfile_owned) #define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument #define SYMBOL_INLINED(symbol) (symbol)->is_inlined #define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \ |