Replace the block_found global with explicit data-flow
As Pedro suggested on gdb-patches@ (see https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this change makes symbol lookup functions return a structure that includes both the symbol found and the block in which it was found. This makes it possible to get rid of the block_found global variable and thus makes block hunting explicit. gdb/ * ada-exp.y (write_object_renaming): Replace struct ada_symbol_info with struct block_symbol. Update field references accordingly. (block_lookup, select_possible_type_sym): Likewise. (find_primitive_type): Likewise. Also update call to ada_lookup_symbol to extract the symbol itself. (write_var_or_type, write_name_assoc): Likewise. * ada-lang.h (struct ada_symbol_info): Remove. (ada_lookup_symbol_list): Replace struct ada_symbol_info with struct block_symbol. (ada_lookup_encoded_symbol, user_select_syms): Likewise. (ada_lookup_symbol): Return struct block_symbol instead of a mere symbol. * ada-lang.c (defns_collected): Replace struct ada_symbol_info with struct block_symbol. (resolve_subexp, ada_resolve_function, sort_choices, user_select_syms, is_nonfunction, add_defn_to_vec, num_defns_collected, defns_collected, symbols_are_identical_enums, remove_extra_symbols, remove_irrelevant_renamings, add_lookup_symbol_list_worker, ada_lookup_symbol_list, ada_iterate_over_symbols, ada_lookup_encoded_symbol, get_var_value): Likewise. (ada_lookup_symbol): Return a block_symbol instead of a mere symbol. Replace struct ada_symbol_info with struct block_symbol. (ada_lookup_symbol_nonlocal): Likewise. (standard_lookup): Make block passing explicit through lookup_symbol_in_language. * ada-tasks.c (get_tcb_types_info): Update the calls to lookup_symbol_in_language to extract the mere symbol out of the returned value. (ada_tasks_inferior_data_sniffer): Likewise. * ax-gdb.c (gen_static_field): Likewise for the call to lookup_symbol. (gen_maybe_namespace_elt): Deal with struct symbol_in_block from lookup functions. (gen_expr): Likewise. * c-exp.y: Likewise. Remove uses of block_found. (lex_one_token, classify_inner_name, c_print_token): Likewise. (classify_name): Likewise. Rename the "sym" local variable to "bsym". * c-valprint.c (print_unpacked_pointer): Likewise. * compile/compile-c-symbols.c (convert_symbol_sym): Promote the "sym" parameter from struct symbol * to struct block_symbol. Use it to remove uses of block_found. Deal with struct symbol_in_block from lookup functions. (gcc_convert_symbol): Likewise. Update the call to convert_symbol_sym. * compile/compile-object-load.c (compile_object_load): Deal with struct symbol_in_block from lookup functions. * cp-namespace.c (cp_lookup_nested_symbol_1, cp_lookup_nested_symbol, cp_lookup_bare_symbol, cp_search_static_and_baseclasses, cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports, cp_lookup_symbol_imports_or_template, cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace, lookup_namespace_scope, cp_lookup_nonlocal, find_symbol_in_baseclass): Return struct symbol_in_block instead of mere symbols and deal with struct symbol_in_block from lookup functions. * cp-support.c (inspect_type, replace_typedefs, cp_lookup_rtti_type): Deal with struct symbol_in_block from lookup functions. * cp-support.h (cp_lookup_symbol_nonlocal, cp_lookup_symbol_from_namespace, cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol): Return struct symbol_in_block instead of mere symbols. * d-exp.y (d_type_from_name, d_module_from_name, push_variable, push_module_name): Deal with struct symbol_in_block from lookup functions. Remove uses of block_found. * eval.c (evaluate_subexp_standard): Update call to cp_lookup_symbol_namespace. * f-exp.y: Deal with struct symbol_in_block from lookup functions. Remove uses of block_found. (yylex): Likewise. * gdbtypes.c (lookup_typename, lookup_struct, lookup_union, lookup_enum, lookup_template_type, check_typedef): Deal with struct symbol_in_block from lookup functions. * guile/scm-frame.c (gdbscm_frame_read_var): Likewise. * guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise. (gdbscm_lookup_global_symbol): Likewise. * gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise. * go-exp.y: Likewise. Remove uses of block_found. (package_name_p, classify_packaged_name, classify_name): Likewise. * infrun.c (insert_exception_resume_breakpoint): Likewise. * jv-exp.y (push_variable): Likewise. * jv-lang.c (java_lookup_class, get_java_object_type): Likewise. * language.c (language_bool_type): Likewise. * language.h (struct language_defn): Update la_lookup_symbol_nonlocal to return a struct symbol_in_block rather than a mere symbol. * linespec.c (find_label_symbols): Deal with struct symbol_in_block from lookup functions. * m2-exp.y: Likewise. Remove uses of block_found. (yylex): Likewise. * mi/mi-cmd-stack.c (list_args_or_locals): Likewise. * objc-lang.c (lookup_struct_typedef, find_imps): Likewise. * p-exp.y: Likewise. Remove uses of block_found. (yylex): Likewise. * p-valprint.c (pascal_val_print): Likewise. * parse.c (write_dollar_variable): Likewise. Remove uses of block_found. * parser-defs.h (struct symtoken): Turn the SYM field into a struct symbol_in_block. * printcmd.c (address_info): Deal with struct symbol_in_block from lookup functions. * python/py-frame.c (frapy_read_var): Likewise. * python/py-symbol.c (gdbpy_lookup_symbol, gdbpy_lookup_global_symbol): Likewise. * skip.c (skip_function_command): Likewise. * solib-darwin.c (darwin_lookup_lib_symbol): Return a struct symbol_in_block instead of a mere symbol. * solib-spu.c (spu_lookup_lib_symbol): Likewise. * solib-svr4.c (elf_lookup_lib_symbol): Likewise. * solib.c (solib_global_lookup): Likewise. * solist.h (solib_global_lookup): Likewise. (struct target_so_ops): Update lookup_lib_global_symbol to return a struct symbol_in_block rather than a mere symbol. * source.c (select_source_symtab): Deal with struct symbol_in_block from lookup functions. * stack.c (print_frame_args, iterate_over_block_arg_vars): Likewise. * symfile.c (set_initial_language): Likewise. * symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct symbol_in_block. (SYMBOL_LOOKUP_FAILED_P): New predicate as a macro. (struct symbol_cache_slot): Turn the FOUND field into a struct symbol_in_block. (block_found): Remove. (eq_symbol_entry): Update to deal with struct symbol_in_block in cache slots. (symbol_cache_lookup): Return a struct symbol_in_block rather than a mere symbol. (symbol_cache_mark_found): Add a BLOCK parameter to fill appropriately the cache slots. Update callers. (symbol_cache_dump): Update cache slots handling to the type change. (lookup_symbol_in_language, lookup_symbol, lookup_language_this, lookup_symbol_aux, lookup_local_symbol, lookup_symbol_in_objfile, lookup_global_symbol_from_objfile, lookup_symbol_in_objfile_symtabs, lookup_symbol_in_objfile_from_linkage_name, lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block, lookup_static_symbol, lookup_global_symbol): Return a struct symbol_in_block rather than a mere symbol. Deal with struct symbol_in_block from other lookup functions. Remove uses of block_found. (lookup_symbol_in_block): Remove uses of block_found. (struct global_sym_lookup_data): Turn the RESULT field into a struct symbol_in_block. (lookup_symbol_global_iterator_cb): Update references to the RESULT field. (search_symbols): Deal with struct symbol_in_block from lookup functions. * symtab.h (struct symbol_in_block): New structure. (block_found): Remove. (lookup_symbol_in_language, lookup_symbol, basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block, looku_static_symbol, lookup_global_symbol, lookup_symbol_in_block, lookup_language_this, lookup_global_symbol_from_objfile): Return a struct symbol_in_block rather than just a mere symbol. Update comments to remove mentions of block_found. * valops.c (find_function_in_inferior, value_struct_elt_for_reference, value_maybe_namespace_elt, value_of_this): Deal with struct symbol_in_block from lookup functions. * value.c (value_static_field, value_fn_field): Likewise.
This commit is contained in:
parent
5efafabf7b
commit
d12307c199
50 changed files with 910 additions and 697 deletions
174
gdb/ChangeLog
174
gdb/ChangeLog
|
@ -1,3 +1,177 @@
|
||||||
|
2015-08-01 Pierre-Marie de Rodat <derodat@adacore.com>
|
||||||
|
|
||||||
|
* ada-exp.y (write_object_renaming): Replace struct
|
||||||
|
ada_symbol_info with struct block_symbol. Update field
|
||||||
|
references accordingly.
|
||||||
|
(block_lookup, select_possible_type_sym): Likewise.
|
||||||
|
(find_primitive_type): Likewise. Also update call to
|
||||||
|
ada_lookup_symbol to extract the symbol itself.
|
||||||
|
(write_var_or_type, write_name_assoc): Likewise.
|
||||||
|
* ada-lang.h (struct ada_symbol_info): Remove.
|
||||||
|
(ada_lookup_symbol_list): Replace struct ada_symbol_info with
|
||||||
|
struct block_symbol.
|
||||||
|
(ada_lookup_encoded_symbol, user_select_syms): Likewise.
|
||||||
|
(ada_lookup_symbol): Return struct block_symbol instead of a
|
||||||
|
mere symbol.
|
||||||
|
* ada-lang.c (defns_collected): Replace struct ada_symbol_info
|
||||||
|
with struct block_symbol.
|
||||||
|
(resolve_subexp, ada_resolve_function, sort_choices,
|
||||||
|
user_select_syms, is_nonfunction, add_defn_to_vec,
|
||||||
|
num_defns_collected, defns_collected,
|
||||||
|
symbols_are_identical_enums, remove_extra_symbols,
|
||||||
|
remove_irrelevant_renamings, add_lookup_symbol_list_worker,
|
||||||
|
ada_lookup_symbol_list, ada_iterate_over_symbols,
|
||||||
|
ada_lookup_encoded_symbol, get_var_value): Likewise.
|
||||||
|
(ada_lookup_symbol): Return a block_symbol instead of a mere
|
||||||
|
symbol. Replace struct ada_symbol_info with struct
|
||||||
|
block_symbol.
|
||||||
|
(ada_lookup_symbol_nonlocal): Likewise.
|
||||||
|
(standard_lookup): Make block passing explicit through
|
||||||
|
lookup_symbol_in_language.
|
||||||
|
* ada-tasks.c (get_tcb_types_info): Update the calls to
|
||||||
|
lookup_symbol_in_language to extract the mere symbol out of the
|
||||||
|
returned value.
|
||||||
|
(ada_tasks_inferior_data_sniffer): Likewise.
|
||||||
|
* ax-gdb.c (gen_static_field): Likewise for the call to
|
||||||
|
lookup_symbol.
|
||||||
|
(gen_maybe_namespace_elt): Deal with struct symbol_in_block from
|
||||||
|
lookup functions.
|
||||||
|
(gen_expr): Likewise.
|
||||||
|
* c-exp.y: Likewise. Remove uses of block_found.
|
||||||
|
(lex_one_token, classify_inner_name, c_print_token): Likewise.
|
||||||
|
(classify_name): Likewise. Rename the "sym" local variable to
|
||||||
|
"bsym".
|
||||||
|
* c-valprint.c (print_unpacked_pointer): Likewise.
|
||||||
|
* compile/compile-c-symbols.c (convert_symbol_sym): Promote the
|
||||||
|
"sym" parameter from struct symbol * to struct block_symbol.
|
||||||
|
Use it to remove uses of block_found. Deal with struct
|
||||||
|
symbol_in_block from lookup functions.
|
||||||
|
(gcc_convert_symbol): Likewise. Update the call to
|
||||||
|
convert_symbol_sym.
|
||||||
|
* compile/compile-object-load.c (compile_object_load): Deal with
|
||||||
|
struct symbol_in_block from lookup functions.
|
||||||
|
* cp-namespace.c (cp_lookup_nested_symbol_1,
|
||||||
|
cp_lookup_nested_symbol, cp_lookup_bare_symbol,
|
||||||
|
cp_search_static_and_baseclasses,
|
||||||
|
cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports,
|
||||||
|
cp_lookup_symbol_imports_or_template,
|
||||||
|
cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace,
|
||||||
|
lookup_namespace_scope, cp_lookup_nonlocal,
|
||||||
|
find_symbol_in_baseclass): Return struct symbol_in_block instead
|
||||||
|
of mere symbols and deal with struct symbol_in_block from lookup
|
||||||
|
functions.
|
||||||
|
* cp-support.c (inspect_type, replace_typedefs,
|
||||||
|
cp_lookup_rtti_type): Deal with struct symbol_in_block from
|
||||||
|
lookup functions.
|
||||||
|
* cp-support.h (cp_lookup_symbol_nonlocal,
|
||||||
|
cp_lookup_symbol_from_namespace,
|
||||||
|
cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol):
|
||||||
|
Return struct symbol_in_block instead of mere symbols.
|
||||||
|
* d-exp.y (d_type_from_name, d_module_from_name, push_variable,
|
||||||
|
push_module_name):
|
||||||
|
Deal with struct symbol_in_block from lookup functions. Remove
|
||||||
|
uses of block_found.
|
||||||
|
* eval.c (evaluate_subexp_standard): Update call to
|
||||||
|
cp_lookup_symbol_namespace.
|
||||||
|
* f-exp.y: Deal with struct symbol_in_block from lookup
|
||||||
|
functions. Remove uses of block_found.
|
||||||
|
(yylex): Likewise.
|
||||||
|
* gdbtypes.c (lookup_typename, lookup_struct, lookup_union,
|
||||||
|
lookup_enum, lookup_template_type, check_typedef): Deal with
|
||||||
|
struct symbol_in_block from lookup functions.
|
||||||
|
* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
|
||||||
|
* guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise.
|
||||||
|
(gdbscm_lookup_global_symbol): Likewise.
|
||||||
|
* gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise.
|
||||||
|
* go-exp.y: Likewise. Remove uses of block_found.
|
||||||
|
(package_name_p, classify_packaged_name, classify_name):
|
||||||
|
Likewise.
|
||||||
|
* infrun.c (insert_exception_resume_breakpoint): Likewise.
|
||||||
|
* jv-exp.y (push_variable): Likewise.
|
||||||
|
* jv-lang.c (java_lookup_class, get_java_object_type): Likewise.
|
||||||
|
* language.c (language_bool_type): Likewise.
|
||||||
|
* language.h (struct language_defn): Update
|
||||||
|
la_lookup_symbol_nonlocal to return a struct symbol_in_block
|
||||||
|
rather than a mere symbol.
|
||||||
|
* linespec.c (find_label_symbols): Deal with struct
|
||||||
|
symbol_in_block from lookup functions.
|
||||||
|
* m2-exp.y: Likewise. Remove uses of block_found.
|
||||||
|
(yylex): Likewise.
|
||||||
|
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
|
||||||
|
* objc-lang.c (lookup_struct_typedef, find_imps): Likewise.
|
||||||
|
* p-exp.y: Likewise. Remove uses of block_found.
|
||||||
|
(yylex): Likewise.
|
||||||
|
* p-valprint.c (pascal_val_print): Likewise.
|
||||||
|
* parse.c (write_dollar_variable): Likewise. Remove uses of
|
||||||
|
block_found.
|
||||||
|
* parser-defs.h (struct symtoken): Turn the SYM field into a
|
||||||
|
struct symbol_in_block.
|
||||||
|
* printcmd.c (address_info): Deal with struct symbol_in_block
|
||||||
|
from lookup functions.
|
||||||
|
* python/py-frame.c (frapy_read_var): Likewise.
|
||||||
|
* python/py-symbol.c (gdbpy_lookup_symbol,
|
||||||
|
gdbpy_lookup_global_symbol): Likewise.
|
||||||
|
* skip.c (skip_function_command): Likewise.
|
||||||
|
* solib-darwin.c (darwin_lookup_lib_symbol): Return a struct
|
||||||
|
symbol_in_block instead of a mere symbol.
|
||||||
|
* solib-spu.c (spu_lookup_lib_symbol): Likewise.
|
||||||
|
* solib-svr4.c (elf_lookup_lib_symbol): Likewise.
|
||||||
|
* solib.c (solib_global_lookup): Likewise.
|
||||||
|
* solist.h (solib_global_lookup): Likewise.
|
||||||
|
(struct target_so_ops): Update lookup_lib_global_symbol to
|
||||||
|
return a struct symbol_in_block rather than a mere symbol.
|
||||||
|
* source.c (select_source_symtab): Deal with struct
|
||||||
|
symbol_in_block from lookup functions.
|
||||||
|
* stack.c (print_frame_args, iterate_over_block_arg_vars):
|
||||||
|
Likewise.
|
||||||
|
* symfile.c (set_initial_language): Likewise.
|
||||||
|
* symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct
|
||||||
|
symbol_in_block.
|
||||||
|
(SYMBOL_LOOKUP_FAILED_P): New predicate as a macro.
|
||||||
|
(struct symbol_cache_slot): Turn the FOUND field into a struct
|
||||||
|
symbol_in_block.
|
||||||
|
(block_found): Remove.
|
||||||
|
(eq_symbol_entry): Update to deal with struct symbol_in_block in
|
||||||
|
cache slots.
|
||||||
|
(symbol_cache_lookup): Return a struct symbol_in_block rather
|
||||||
|
than a mere symbol.
|
||||||
|
(symbol_cache_mark_found): Add a BLOCK parameter to fill
|
||||||
|
appropriately the cache slots. Update callers.
|
||||||
|
(symbol_cache_dump): Update cache slots handling to the type
|
||||||
|
change.
|
||||||
|
(lookup_symbol_in_language, lookup_symbol, lookup_language_this,
|
||||||
|
lookup_symbol_aux, lookup_local_symbol,
|
||||||
|
lookup_symbol_in_objfile, lookup_global_symbol_from_objfile,
|
||||||
|
lookup_symbol_in_objfile_symtabs,
|
||||||
|
lookup_symbol_in_objfile_from_linkage_name,
|
||||||
|
lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal,
|
||||||
|
lookup_symbol_in_static_block, lookup_static_symbol,
|
||||||
|
lookup_global_symbol):
|
||||||
|
Return a struct symbol_in_block rather than a mere symbol. Deal
|
||||||
|
with struct symbol_in_block from other lookup functions. Remove
|
||||||
|
uses of block_found.
|
||||||
|
(lookup_symbol_in_block): Remove uses of block_found.
|
||||||
|
(struct global_sym_lookup_data): Turn the RESULT field into a
|
||||||
|
struct symbol_in_block.
|
||||||
|
(lookup_symbol_global_iterator_cb): Update references to the
|
||||||
|
RESULT field.
|
||||||
|
(search_symbols): Deal with struct symbol_in_block from lookup
|
||||||
|
functions.
|
||||||
|
* symtab.h (struct symbol_in_block): New structure.
|
||||||
|
(block_found): Remove.
|
||||||
|
(lookup_symbol_in_language, lookup_symbol,
|
||||||
|
basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block,
|
||||||
|
looku_static_symbol, lookup_global_symbol,
|
||||||
|
lookup_symbol_in_block, lookup_language_this,
|
||||||
|
lookup_global_symbol_from_objfile): Return a struct
|
||||||
|
symbol_in_block rather than just a mere symbol. Update comments
|
||||||
|
to remove mentions of block_found.
|
||||||
|
* valops.c (find_function_in_inferior,
|
||||||
|
value_struct_elt_for_reference, value_maybe_namespace_elt,
|
||||||
|
value_of_this): Deal with struct symbol_in_block from lookup
|
||||||
|
functions.
|
||||||
|
* value.c (value_static_field, value_fn_field): Likewise.
|
||||||
|
|
||||||
2015-07-31 Simon Marchi <simon.marchi@ericsson.com>
|
2015-07-31 Simon Marchi <simon.marchi@ericsson.com>
|
||||||
|
|
||||||
* remote-m32r-sdi.c (m32r_remove_watchpoint): Use enum type
|
* remote-m32r-sdi.c (m32r_remove_watchpoint): Use enum type
|
||||||
|
|
|
@ -868,7 +868,7 @@ write_object_renaming (struct parser_state *par_state,
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
|
enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
|
||||||
struct ada_symbol_info sym_info;
|
struct block_symbol sym_info;
|
||||||
|
|
||||||
if (max_depth <= 0)
|
if (max_depth <= 0)
|
||||||
error (_("Could not find renamed symbol"));
|
error (_("Could not find renamed symbol"));
|
||||||
|
@ -878,9 +878,9 @@ write_object_renaming (struct parser_state *par_state,
|
||||||
|
|
||||||
name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
|
name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
|
||||||
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
|
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
|
||||||
if (sym_info.sym == NULL)
|
if (sym_info.symbol == NULL)
|
||||||
error (_("Could not find renamed variable: %s"), ada_decode (name));
|
error (_("Could not find renamed variable: %s"), ada_decode (name));
|
||||||
else if (SYMBOL_CLASS (sym_info.sym) == LOC_TYPEDEF)
|
else if (SYMBOL_CLASS (sym_info.symbol) == LOC_TYPEDEF)
|
||||||
/* We have a renaming of an old-style renaming symbol. Don't
|
/* We have a renaming of an old-style renaming symbol. Don't
|
||||||
trust the block information. */
|
trust the block information. */
|
||||||
sym_info.block = orig_left_context;
|
sym_info.block = orig_left_context;
|
||||||
|
@ -890,13 +890,13 @@ write_object_renaming (struct parser_state *par_state,
|
||||||
int inner_renamed_entity_len;
|
int inner_renamed_entity_len;
|
||||||
const char *inner_renaming_expr;
|
const char *inner_renaming_expr;
|
||||||
|
|
||||||
switch (ada_parse_renaming (sym_info.sym, &inner_renamed_entity,
|
switch (ada_parse_renaming (sym_info.symbol, &inner_renamed_entity,
|
||||||
&inner_renamed_entity_len,
|
&inner_renamed_entity_len,
|
||||||
&inner_renaming_expr))
|
&inner_renaming_expr))
|
||||||
{
|
{
|
||||||
case ADA_NOT_RENAMING:
|
case ADA_NOT_RENAMING:
|
||||||
write_var_from_sym (par_state, orig_left_context, sym_info.block,
|
write_var_from_sym (par_state, orig_left_context, sym_info.block,
|
||||||
sym_info.sym);
|
sym_info.symbol);
|
||||||
break;
|
break;
|
||||||
case ADA_OBJECT_RENAMING:
|
case ADA_OBJECT_RENAMING:
|
||||||
write_object_renaming (par_state, sym_info.block,
|
write_object_renaming (par_state, sym_info.block,
|
||||||
|
@ -939,7 +939,7 @@ write_object_renaming (struct parser_state *par_state,
|
||||||
{
|
{
|
||||||
const char *end;
|
const char *end;
|
||||||
char *index_name;
|
char *index_name;
|
||||||
struct ada_symbol_info index_sym_info;
|
struct block_symbol index_sym_info;
|
||||||
|
|
||||||
end = strchr (renaming_expr, 'X');
|
end = strchr (renaming_expr, 'X');
|
||||||
if (end == NULL)
|
if (end == NULL)
|
||||||
|
@ -952,13 +952,13 @@ write_object_renaming (struct parser_state *par_state,
|
||||||
|
|
||||||
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
|
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
|
||||||
&index_sym_info);
|
&index_sym_info);
|
||||||
if (index_sym_info.sym == NULL)
|
if (index_sym_info.symbol == NULL)
|
||||||
error (_("Could not find %s"), index_name);
|
error (_("Could not find %s"), index_name);
|
||||||
else if (SYMBOL_CLASS (index_sym_info.sym) == LOC_TYPEDEF)
|
else if (SYMBOL_CLASS (index_sym_info.symbol) == LOC_TYPEDEF)
|
||||||
/* Index is an old-style renaming symbol. */
|
/* Index is an old-style renaming symbol. */
|
||||||
index_sym_info.block = orig_left_context;
|
index_sym_info.block = orig_left_context;
|
||||||
write_var_from_sym (par_state, NULL, index_sym_info.block,
|
write_var_from_sym (par_state, NULL, index_sym_info.block,
|
||||||
index_sym_info.sym);
|
index_sym_info.symbol);
|
||||||
}
|
}
|
||||||
if (slice_state == SIMPLE_INDEX)
|
if (slice_state == SIMPLE_INDEX)
|
||||||
{
|
{
|
||||||
|
@ -1013,7 +1013,7 @@ static const struct block*
|
||||||
block_lookup (const struct block *context, const char *raw_name)
|
block_lookup (const struct block *context, const char *raw_name)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
struct ada_symbol_info *syms;
|
struct block_symbol *syms;
|
||||||
int nsyms;
|
int nsyms;
|
||||||
struct symtab *symtab;
|
struct symtab *symtab;
|
||||||
|
|
||||||
|
@ -1027,14 +1027,14 @@ block_lookup (const struct block *context, const char *raw_name)
|
||||||
|
|
||||||
nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms);
|
nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms);
|
||||||
if (context == NULL
|
if (context == NULL
|
||||||
&& (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK))
|
&& (nsyms == 0 || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK))
|
||||||
symtab = lookup_symtab (name);
|
symtab = lookup_symtab (name);
|
||||||
else
|
else
|
||||||
symtab = NULL;
|
symtab = NULL;
|
||||||
|
|
||||||
if (symtab != NULL)
|
if (symtab != NULL)
|
||||||
return BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK);
|
return BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK);
|
||||||
else if (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)
|
else if (nsyms == 0 || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
error (_("No file or function \"%s\"."), raw_name);
|
error (_("No file or function \"%s\"."), raw_name);
|
||||||
|
@ -1045,12 +1045,12 @@ block_lookup (const struct block *context, const char *raw_name)
|
||||||
{
|
{
|
||||||
if (nsyms > 1)
|
if (nsyms > 1)
|
||||||
warning (_("Function name \"%s\" ambiguous here"), raw_name);
|
warning (_("Function name \"%s\" ambiguous here"), raw_name);
|
||||||
return SYMBOL_BLOCK_VALUE (syms[0].sym);
|
return SYMBOL_BLOCK_VALUE (syms[0].symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symbol*
|
static struct symbol*
|
||||||
select_possible_type_sym (struct ada_symbol_info *syms, int nsyms)
|
select_possible_type_sym (struct block_symbol *syms, int nsyms)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int preferred_index;
|
int preferred_index;
|
||||||
|
@ -1058,13 +1058,13 @@ select_possible_type_sym (struct ada_symbol_info *syms, int nsyms)
|
||||||
|
|
||||||
preferred_index = -1; preferred_type = NULL;
|
preferred_index = -1; preferred_type = NULL;
|
||||||
for (i = 0; i < nsyms; i += 1)
|
for (i = 0; i < nsyms; i += 1)
|
||||||
switch (SYMBOL_CLASS (syms[i].sym))
|
switch (SYMBOL_CLASS (syms[i].symbol))
|
||||||
{
|
{
|
||||||
case LOC_TYPEDEF:
|
case LOC_TYPEDEF:
|
||||||
if (ada_prefer_type (SYMBOL_TYPE (syms[i].sym), preferred_type))
|
if (ada_prefer_type (SYMBOL_TYPE (syms[i].symbol), preferred_type))
|
||||||
{
|
{
|
||||||
preferred_index = i;
|
preferred_index = i;
|
||||||
preferred_type = SYMBOL_TYPE (syms[i].sym);
|
preferred_type = SYMBOL_TYPE (syms[i].symbol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LOC_REGISTER:
|
case LOC_REGISTER:
|
||||||
|
@ -1079,7 +1079,7 @@ select_possible_type_sym (struct ada_symbol_info *syms, int nsyms)
|
||||||
}
|
}
|
||||||
if (preferred_type == NULL)
|
if (preferred_type == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return syms[preferred_index].sym;
|
return syms[preferred_index].symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct type*
|
static struct type*
|
||||||
|
@ -1101,7 +1101,7 @@ find_primitive_type (struct parser_state *par_state, char *name)
|
||||||
(char *) alloca (strlen (name) + sizeof ("standard__"));
|
(char *) alloca (strlen (name) + sizeof ("standard__"));
|
||||||
strcpy (expanded_name, "standard__");
|
strcpy (expanded_name, "standard__");
|
||||||
strcat (expanded_name, name);
|
strcat (expanded_name, name);
|
||||||
sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL);
|
sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL).symbol;
|
||||||
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||||
type = SYMBOL_TYPE (sym);
|
type = SYMBOL_TYPE (sym);
|
||||||
}
|
}
|
||||||
|
@ -1274,7 +1274,7 @@ write_var_or_type (struct parser_state *par_state,
|
||||||
while (tail_index > 0)
|
while (tail_index > 0)
|
||||||
{
|
{
|
||||||
int nsyms;
|
int nsyms;
|
||||||
struct ada_symbol_info *syms;
|
struct block_symbol *syms;
|
||||||
struct symbol *type_sym;
|
struct symbol *type_sym;
|
||||||
struct symbol *renaming_sym;
|
struct symbol *renaming_sym;
|
||||||
const char* renaming;
|
const char* renaming;
|
||||||
|
@ -1294,10 +1294,10 @@ write_var_or_type (struct parser_state *par_state,
|
||||||
if (nsyms == 1)
|
if (nsyms == 1)
|
||||||
{
|
{
|
||||||
struct symbol *ren_sym =
|
struct symbol *ren_sym =
|
||||||
ada_find_renaming_symbol (syms[0].sym, syms[0].block);
|
ada_find_renaming_symbol (syms[0].symbol, syms[0].block);
|
||||||
|
|
||||||
if (ren_sym != NULL)
|
if (ren_sym != NULL)
|
||||||
syms[0].sym = ren_sym;
|
syms[0].symbol = ren_sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
type_sym = select_possible_type_sym (syms, nsyms);
|
type_sym = select_possible_type_sym (syms, nsyms);
|
||||||
|
@ -1305,7 +1305,7 @@ write_var_or_type (struct parser_state *par_state,
|
||||||
if (type_sym != NULL)
|
if (type_sym != NULL)
|
||||||
renaming_sym = type_sym;
|
renaming_sym = type_sym;
|
||||||
else if (nsyms == 1)
|
else if (nsyms == 1)
|
||||||
renaming_sym = syms[0].sym;
|
renaming_sym = syms[0].symbol;
|
||||||
else
|
else
|
||||||
renaming_sym = NULL;
|
renaming_sym = NULL;
|
||||||
|
|
||||||
|
@ -1367,7 +1367,7 @@ write_var_or_type (struct parser_state *par_state,
|
||||||
if (nsyms == 1)
|
if (nsyms == 1)
|
||||||
{
|
{
|
||||||
write_var_from_sym (par_state, block, syms[0].block,
|
write_var_from_sym (par_state, block, syms[0].block,
|
||||||
syms[0].sym);
|
syms[0].symbol);
|
||||||
write_selectors (par_state, encoded_name + tail_index);
|
write_selectors (par_state, encoded_name + tail_index);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1433,13 +1433,14 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
|
||||||
{
|
{
|
||||||
if (strchr (name.ptr, '.') == NULL)
|
if (strchr (name.ptr, '.') == NULL)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *syms;
|
struct block_symbol *syms;
|
||||||
int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
|
int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
|
||||||
VAR_DOMAIN, &syms);
|
VAR_DOMAIN, &syms);
|
||||||
if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF)
|
|
||||||
|
if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF)
|
||||||
write_exp_op_with_string (par_state, OP_NAME, name);
|
write_exp_op_with_string (par_state, OP_NAME, name);
|
||||||
else
|
else
|
||||||
write_var_from_sym (par_state, NULL, syms[0].block, syms[0].sym);
|
write_var_from_sym (par_state, NULL, syms[0].block, syms[0].symbol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (write_var_or_type (par_state, NULL, name) != NULL)
|
if (write_var_or_type (par_state, NULL, name) != NULL)
|
||||||
|
|
227
gdb/ada-lang.c
227
gdb/ada-lang.c
|
@ -108,14 +108,14 @@ static void ada_add_block_symbols (struct obstack *,
|
||||||
const struct block *, const char *,
|
const struct block *, const char *,
|
||||||
domain_enum, struct objfile *, int);
|
domain_enum, struct objfile *, int);
|
||||||
|
|
||||||
static int is_nonfunction (struct ada_symbol_info *, int);
|
static int is_nonfunction (struct block_symbol *, int);
|
||||||
|
|
||||||
static void add_defn_to_vec (struct obstack *, struct symbol *,
|
static void add_defn_to_vec (struct obstack *, struct symbol *,
|
||||||
const struct block *);
|
const struct block *);
|
||||||
|
|
||||||
static int num_defns_collected (struct obstack *);
|
static int num_defns_collected (struct obstack *);
|
||||||
|
|
||||||
static struct ada_symbol_info *defns_collected (struct obstack *, int);
|
static struct block_symbol *defns_collected (struct obstack *, int);
|
||||||
|
|
||||||
static struct value *resolve_subexp (struct expression **, int *, int,
|
static struct value *resolve_subexp (struct expression **, int *, int,
|
||||||
struct type *);
|
struct type *);
|
||||||
|
@ -223,7 +223,7 @@ static int find_struct_field (const char *, struct type *, int,
|
||||||
static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
|
static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
|
||||||
struct value *);
|
struct value *);
|
||||||
|
|
||||||
static int ada_resolve_function (struct ada_symbol_info *, int,
|
static int ada_resolve_function (struct block_symbol *, int,
|
||||||
struct value **, int, const char *,
|
struct value **, int, const char *,
|
||||||
struct type *);
|
struct type *);
|
||||||
|
|
||||||
|
@ -3311,7 +3311,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
case OP_VAR_VALUE:
|
case OP_VAR_VALUE:
|
||||||
if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
|
if (SYMBOL_DOMAIN (exp->elts[pc + 2].symbol) == UNDEF_DOMAIN)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *candidates;
|
struct block_symbol *candidates;
|
||||||
int n_candidates;
|
int n_candidates;
|
||||||
|
|
||||||
n_candidates =
|
n_candidates =
|
||||||
|
@ -3327,7 +3327,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
out all types. */
|
out all types. */
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < n_candidates; j += 1)
|
for (j = 0; j < n_candidates; j += 1)
|
||||||
switch (SYMBOL_CLASS (candidates[j].sym))
|
switch (SYMBOL_CLASS (candidates[j].symbol))
|
||||||
{
|
{
|
||||||
case LOC_REGISTER:
|
case LOC_REGISTER:
|
||||||
case LOC_ARG:
|
case LOC_ARG:
|
||||||
|
@ -3345,7 +3345,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j < n_candidates)
|
while (j < n_candidates)
|
||||||
{
|
{
|
||||||
if (SYMBOL_CLASS (candidates[j].sym) == LOC_TYPEDEF)
|
if (SYMBOL_CLASS (candidates[j].symbol) == LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
candidates[j] = candidates[n_candidates - 1];
|
candidates[j] = candidates[n_candidates - 1];
|
||||||
n_candidates -= 1;
|
n_candidates -= 1;
|
||||||
|
@ -3381,7 +3381,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
}
|
}
|
||||||
|
|
||||||
exp->elts[pc + 1].block = candidates[i].block;
|
exp->elts[pc + 1].block = candidates[i].block;
|
||||||
exp->elts[pc + 2].symbol = candidates[i].sym;
|
exp->elts[pc + 2].symbol = candidates[i].symbol;
|
||||||
if (innermost_block == NULL
|
if (innermost_block == NULL
|
||||||
|| contained_in (candidates[i].block, innermost_block))
|
|| contained_in (candidates[i].block, innermost_block))
|
||||||
innermost_block = candidates[i].block;
|
innermost_block = candidates[i].block;
|
||||||
|
@ -3403,7 +3403,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
|
if (exp->elts[pc + 3].opcode == OP_VAR_VALUE
|
||||||
&& SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
|
&& SYMBOL_DOMAIN (exp->elts[pc + 5].symbol) == UNDEF_DOMAIN)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *candidates;
|
struct block_symbol *candidates;
|
||||||
int n_candidates;
|
int n_candidates;
|
||||||
|
|
||||||
n_candidates =
|
n_candidates =
|
||||||
|
@ -3426,7 +3426,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
}
|
}
|
||||||
|
|
||||||
exp->elts[pc + 4].block = candidates[i].block;
|
exp->elts[pc + 4].block = candidates[i].block;
|
||||||
exp->elts[pc + 5].symbol = candidates[i].sym;
|
exp->elts[pc + 5].symbol = candidates[i].symbol;
|
||||||
if (innermost_block == NULL
|
if (innermost_block == NULL
|
||||||
|| contained_in (candidates[i].block, innermost_block))
|
|| contained_in (candidates[i].block, innermost_block))
|
||||||
innermost_block = candidates[i].block;
|
innermost_block = candidates[i].block;
|
||||||
|
@ -3456,7 +3456,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
case UNOP_ABS:
|
case UNOP_ABS:
|
||||||
if (possible_user_operator_p (op, argvec))
|
if (possible_user_operator_p (op, argvec))
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *candidates;
|
struct block_symbol *candidates;
|
||||||
int n_candidates;
|
int n_candidates;
|
||||||
|
|
||||||
n_candidates =
|
n_candidates =
|
||||||
|
@ -3469,7 +3469,8 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
replace_operator_with_call (expp, pc, nargs, 1,
|
replace_operator_with_call (expp, pc, nargs, 1,
|
||||||
candidates[i].sym, candidates[i].block);
|
candidates[i].symbol,
|
||||||
|
candidates[i].block);
|
||||||
exp = *expp;
|
exp = *expp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3623,7 +3624,7 @@ return_match (struct type *func_type, struct type *context_type)
|
||||||
the process; the index returned is for the modified vector. */
|
the process; the index returned is for the modified vector. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ada_resolve_function (struct ada_symbol_info syms[],
|
ada_resolve_function (struct block_symbol syms[],
|
||||||
int nsyms, struct value **args, int nargs,
|
int nsyms, struct value **args, int nargs,
|
||||||
const char *name, struct type *context_type)
|
const char *name, struct type *context_type)
|
||||||
{
|
{
|
||||||
|
@ -3639,9 +3640,9 @@ ada_resolve_function (struct ada_symbol_info syms[],
|
||||||
{
|
{
|
||||||
for (k = 0; k < nsyms; k += 1)
|
for (k = 0; k < nsyms; k += 1)
|
||||||
{
|
{
|
||||||
struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].sym));
|
struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol));
|
||||||
|
|
||||||
if (ada_args_match (syms[k].sym, args, nargs)
|
if (ada_args_match (syms[k].symbol, args, nargs)
|
||||||
&& (fallback || return_match (type, context_type)))
|
&& (fallback || return_match (type, context_type)))
|
||||||
{
|
{
|
||||||
syms[m] = syms[k];
|
syms[m] = syms[k];
|
||||||
|
@ -3704,19 +3705,19 @@ encoded_ordered_before (const char *N0, const char *N1)
|
||||||
encoded names. */
|
encoded names. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sort_choices (struct ada_symbol_info syms[], int nsyms)
|
sort_choices (struct block_symbol syms[], int nsyms)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i < nsyms; i += 1)
|
for (i = 1; i < nsyms; i += 1)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info sym = syms[i];
|
struct block_symbol sym = syms[i];
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = i - 1; j >= 0; j -= 1)
|
for (j = i - 1; j >= 0; j -= 1)
|
||||||
{
|
{
|
||||||
if (encoded_ordered_before (SYMBOL_LINKAGE_NAME (syms[j].sym),
|
if (encoded_ordered_before (SYMBOL_LINKAGE_NAME (syms[j].symbol),
|
||||||
SYMBOL_LINKAGE_NAME (sym.sym)))
|
SYMBOL_LINKAGE_NAME (sym.symbol)))
|
||||||
break;
|
break;
|
||||||
syms[j + 1] = syms[j];
|
syms[j + 1] = syms[j];
|
||||||
}
|
}
|
||||||
|
@ -3733,7 +3734,7 @@ sort_choices (struct ada_symbol_info syms[], int nsyms)
|
||||||
to be re-integrated one of these days. */
|
to be re-integrated one of these days. */
|
||||||
|
|
||||||
int
|
int
|
||||||
user_select_syms (struct ada_symbol_info *syms, int nsyms, int max_results)
|
user_select_syms (struct block_symbol *syms, int nsyms, int max_results)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int *chosen = (int *) alloca (sizeof (int) * nsyms);
|
int *chosen = (int *) alloca (sizeof (int) * nsyms);
|
||||||
|
@ -3765,22 +3766,22 @@ See set/show multiple-symbol."));
|
||||||
|
|
||||||
for (i = 0; i < nsyms; i += 1)
|
for (i = 0; i < nsyms; i += 1)
|
||||||
{
|
{
|
||||||
if (syms[i].sym == NULL)
|
if (syms[i].symbol == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (SYMBOL_CLASS (syms[i].sym) == LOC_BLOCK)
|
if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK)
|
||||||
{
|
{
|
||||||
struct symtab_and_line sal =
|
struct symtab_and_line sal =
|
||||||
find_function_start_sal (syms[i].sym, 1);
|
find_function_start_sal (syms[i].symbol, 1);
|
||||||
|
|
||||||
if (sal.symtab == NULL)
|
if (sal.symtab == NULL)
|
||||||
printf_unfiltered (_("[%d] %s at <no source file available>:%d\n"),
|
printf_unfiltered (_("[%d] %s at <no source file available>:%d\n"),
|
||||||
i + first_choice,
|
i + first_choice,
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym),
|
SYMBOL_PRINT_NAME (syms[i].symbol),
|
||||||
sal.line);
|
sal.line);
|
||||||
else
|
else
|
||||||
printf_unfiltered (_("[%d] %s at %s:%d\n"), i + first_choice,
|
printf_unfiltered (_("[%d] %s at %s:%d\n"), i + first_choice,
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym),
|
SYMBOL_PRINT_NAME (syms[i].symbol),
|
||||||
symtab_to_filename_for_display (sal.symtab),
|
symtab_to_filename_for_display (sal.symtab),
|
||||||
sal.line);
|
sal.line);
|
||||||
continue;
|
continue;
|
||||||
|
@ -3788,42 +3789,42 @@ See set/show multiple-symbol."));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int is_enumeral =
|
int is_enumeral =
|
||||||
(SYMBOL_CLASS (syms[i].sym) == LOC_CONST
|
(SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
|
||||||
&& SYMBOL_TYPE (syms[i].sym) != NULL
|
&& SYMBOL_TYPE (syms[i].symbol) != NULL
|
||||||
&& TYPE_CODE (SYMBOL_TYPE (syms[i].sym)) == TYPE_CODE_ENUM);
|
&& TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) == TYPE_CODE_ENUM);
|
||||||
struct symtab *symtab = NULL;
|
struct symtab *symtab = NULL;
|
||||||
|
|
||||||
if (SYMBOL_OBJFILE_OWNED (syms[i].sym))
|
if (SYMBOL_OBJFILE_OWNED (syms[i].symbol))
|
||||||
symtab = symbol_symtab (syms[i].sym);
|
symtab = symbol_symtab (syms[i].symbol);
|
||||||
|
|
||||||
if (SYMBOL_LINE (syms[i].sym) != 0 && symtab != NULL)
|
if (SYMBOL_LINE (syms[i].symbol) != 0 && symtab != NULL)
|
||||||
printf_unfiltered (_("[%d] %s at %s:%d\n"),
|
printf_unfiltered (_("[%d] %s at %s:%d\n"),
|
||||||
i + first_choice,
|
i + first_choice,
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym),
|
SYMBOL_PRINT_NAME (syms[i].symbol),
|
||||||
symtab_to_filename_for_display (symtab),
|
symtab_to_filename_for_display (symtab),
|
||||||
SYMBOL_LINE (syms[i].sym));
|
SYMBOL_LINE (syms[i].symbol));
|
||||||
else if (is_enumeral
|
else if (is_enumeral
|
||||||
&& TYPE_NAME (SYMBOL_TYPE (syms[i].sym)) != NULL)
|
&& TYPE_NAME (SYMBOL_TYPE (syms[i].symbol)) != NULL)
|
||||||
{
|
{
|
||||||
printf_unfiltered (("[%d] "), i + first_choice);
|
printf_unfiltered (("[%d] "), i + first_choice);
|
||||||
ada_print_type (SYMBOL_TYPE (syms[i].sym), NULL,
|
ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL,
|
||||||
gdb_stdout, -1, 0, &type_print_raw_options);
|
gdb_stdout, -1, 0, &type_print_raw_options);
|
||||||
printf_unfiltered (_("'(%s) (enumeral)\n"),
|
printf_unfiltered (_("'(%s) (enumeral)\n"),
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym));
|
SYMBOL_PRINT_NAME (syms[i].symbol));
|
||||||
}
|
}
|
||||||
else if (symtab != NULL)
|
else if (symtab != NULL)
|
||||||
printf_unfiltered (is_enumeral
|
printf_unfiltered (is_enumeral
|
||||||
? _("[%d] %s in %s (enumeral)\n")
|
? _("[%d] %s in %s (enumeral)\n")
|
||||||
: _("[%d] %s at %s:?\n"),
|
: _("[%d] %s at %s:?\n"),
|
||||||
i + first_choice,
|
i + first_choice,
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym),
|
SYMBOL_PRINT_NAME (syms[i].symbol),
|
||||||
symtab_to_filename_for_display (symtab));
|
symtab_to_filename_for_display (symtab));
|
||||||
else
|
else
|
||||||
printf_unfiltered (is_enumeral
|
printf_unfiltered (is_enumeral
|
||||||
? _("[%d] %s (enumeral)\n")
|
? _("[%d] %s (enumeral)\n")
|
||||||
: _("[%d] %s at ?\n"),
|
: _("[%d] %s at ?\n"),
|
||||||
i + first_choice,
|
i + first_choice,
|
||||||
SYMBOL_PRINT_NAME (syms[i].sym));
|
SYMBOL_PRINT_NAME (syms[i].symbol));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4603,13 +4604,13 @@ standard_lookup (const char *name, const struct block *block,
|
||||||
domain_enum domain)
|
domain_enum domain)
|
||||||
{
|
{
|
||||||
/* Initialize it just to avoid a GCC false warning. */
|
/* Initialize it just to avoid a GCC false warning. */
|
||||||
struct symbol *sym = NULL;
|
struct block_symbol sym = {NULL, NULL};
|
||||||
|
|
||||||
if (lookup_cached_symbol (name, domain, &sym, NULL))
|
if (lookup_cached_symbol (name, domain, &sym.symbol, NULL))
|
||||||
return sym;
|
return sym.symbol;
|
||||||
sym = lookup_symbol_in_language (name, block, domain, language_c, 0);
|
sym = lookup_symbol_in_language (name, block, domain, language_c, 0);
|
||||||
cache_symbol (name, domain, sym, block_found);
|
cache_symbol (name, domain, sym.symbol, sym.block);
|
||||||
return sym;
|
return sym.symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4617,14 +4618,14 @@ standard_lookup (const char *name, const struct block *block,
|
||||||
in the symbol fields of SYMS[0..N-1]. We treat enumerals as functions,
|
in the symbol fields of SYMS[0..N-1]. We treat enumerals as functions,
|
||||||
since they contend in overloading in the same way. */
|
since they contend in overloading in the same way. */
|
||||||
static int
|
static int
|
||||||
is_nonfunction (struct ada_symbol_info syms[], int n)
|
is_nonfunction (struct block_symbol syms[], int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < n; i += 1)
|
for (i = 0; i < n; i += 1)
|
||||||
if (TYPE_CODE (SYMBOL_TYPE (syms[i].sym)) != TYPE_CODE_FUNC
|
if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_FUNC
|
||||||
&& (TYPE_CODE (SYMBOL_TYPE (syms[i].sym)) != TYPE_CODE_ENUM
|
&& (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM
|
||||||
|| SYMBOL_CLASS (syms[i].sym) != LOC_CONST))
|
|| SYMBOL_CLASS (syms[i].symbol) != LOC_CONST))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4688,7 +4689,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append (SYM,BLOCK,SYMTAB) to the end of the array of struct ada_symbol_info
|
/* Append (SYM,BLOCK,SYMTAB) to the end of the array of struct block_symbol
|
||||||
records in OBSTACKP. Do nothing if SYM is a duplicate. */
|
records in OBSTACKP. Do nothing if SYM is a duplicate. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4697,7 +4698,7 @@ add_defn_to_vec (struct obstack *obstackp,
|
||||||
const struct block *block)
|
const struct block *block)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ada_symbol_info *prevDefns = defns_collected (obstackp, 0);
|
struct block_symbol *prevDefns = defns_collected (obstackp, 0);
|
||||||
|
|
||||||
/* Do not try to complete stub types, as the debugger is probably
|
/* Do not try to complete stub types, as the debugger is probably
|
||||||
already scanning all symbols matching a certain name at the
|
already scanning all symbols matching a certain name at the
|
||||||
|
@ -4710,45 +4711,44 @@ add_defn_to_vec (struct obstack *obstackp,
|
||||||
|
|
||||||
for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1)
|
for (i = num_defns_collected (obstackp) - 1; i >= 0; i -= 1)
|
||||||
{
|
{
|
||||||
if (lesseq_defined_than (sym, prevDefns[i].sym))
|
if (lesseq_defined_than (sym, prevDefns[i].symbol))
|
||||||
return;
|
return;
|
||||||
else if (lesseq_defined_than (prevDefns[i].sym, sym))
|
else if (lesseq_defined_than (prevDefns[i].symbol, sym))
|
||||||
{
|
{
|
||||||
prevDefns[i].sym = sym;
|
prevDefns[i].symbol = sym;
|
||||||
prevDefns[i].block = block;
|
prevDefns[i].block = block;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
struct ada_symbol_info info;
|
struct block_symbol info;
|
||||||
|
|
||||||
info.sym = sym;
|
info.symbol = sym;
|
||||||
info.block = block;
|
info.block = block;
|
||||||
obstack_grow (obstackp, &info, sizeof (struct ada_symbol_info));
|
obstack_grow (obstackp, &info, sizeof (struct block_symbol));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of ada_symbol_info structures currently collected in
|
/* Number of block_symbol structures currently collected in current vector in
|
||||||
current vector in *OBSTACKP. */
|
OBSTACKP. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
num_defns_collected (struct obstack *obstackp)
|
num_defns_collected (struct obstack *obstackp)
|
||||||
{
|
{
|
||||||
return obstack_object_size (obstackp) / sizeof (struct ada_symbol_info);
|
return obstack_object_size (obstackp) / sizeof (struct block_symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vector of ada_symbol_info structures currently collected in current
|
/* Vector of block_symbol structures currently collected in current vector in
|
||||||
vector in *OBSTACKP. If FINISH, close off the vector and return
|
OBSTACKP. If FINISH, close off the vector and return its final address. */
|
||||||
its final address. */
|
|
||||||
|
|
||||||
static struct ada_symbol_info *
|
static struct block_symbol *
|
||||||
defns_collected (struct obstack *obstackp, int finish)
|
defns_collected (struct obstack *obstackp, int finish)
|
||||||
{
|
{
|
||||||
if (finish)
|
if (finish)
|
||||||
return obstack_finish (obstackp);
|
return obstack_finish (obstackp);
|
||||||
else
|
else
|
||||||
return (struct ada_symbol_info *) obstack_base (obstackp);
|
return (struct block_symbol *) obstack_base (obstackp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a bound minimal symbol matching NAME according to Ada
|
/* Return a bound minimal symbol matching NAME according to Ada
|
||||||
|
@ -4879,7 +4879,7 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
|
||||||
So, for practical purposes, we consider them as the same. */
|
So, for practical purposes, we consider them as the same. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
symbols_are_identical_enums (struct ada_symbol_info *syms, int nsyms)
|
symbols_are_identical_enums (struct block_symbol *syms, int nsyms)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -4892,26 +4892,26 @@ symbols_are_identical_enums (struct ada_symbol_info *syms, int nsyms)
|
||||||
|
|
||||||
/* Quick check: All symbols should have an enum type. */
|
/* Quick check: All symbols should have an enum type. */
|
||||||
for (i = 0; i < nsyms; i++)
|
for (i = 0; i < nsyms; i++)
|
||||||
if (TYPE_CODE (SYMBOL_TYPE (syms[i].sym)) != TYPE_CODE_ENUM)
|
if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Quick check: They should all have the same value. */
|
/* Quick check: They should all have the same value. */
|
||||||
for (i = 1; i < nsyms; i++)
|
for (i = 1; i < nsyms; i++)
|
||||||
if (SYMBOL_VALUE (syms[i].sym) != SYMBOL_VALUE (syms[0].sym))
|
if (SYMBOL_VALUE (syms[i].symbol) != SYMBOL_VALUE (syms[0].symbol))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Quick check: They should all have the same number of enumerals. */
|
/* Quick check: They should all have the same number of enumerals. */
|
||||||
for (i = 1; i < nsyms; i++)
|
for (i = 1; i < nsyms; i++)
|
||||||
if (TYPE_NFIELDS (SYMBOL_TYPE (syms[i].sym))
|
if (TYPE_NFIELDS (SYMBOL_TYPE (syms[i].symbol))
|
||||||
!= TYPE_NFIELDS (SYMBOL_TYPE (syms[0].sym)))
|
!= TYPE_NFIELDS (SYMBOL_TYPE (syms[0].symbol)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* All the sanity checks passed, so we might have a set of
|
/* All the sanity checks passed, so we might have a set of
|
||||||
identical enumeration types. Perform a more complete
|
identical enumeration types. Perform a more complete
|
||||||
comparison of the type of each symbol. */
|
comparison of the type of each symbol. */
|
||||||
for (i = 1; i < nsyms; i++)
|
for (i = 1; i < nsyms; i++)
|
||||||
if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].sym),
|
if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].symbol),
|
||||||
SYMBOL_TYPE (syms[0].sym)))
|
SYMBOL_TYPE (syms[0].symbol)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -4925,7 +4925,7 @@ symbols_are_identical_enums (struct ada_symbol_info *syms, int nsyms)
|
||||||
Returns the number of items in the modified list. */
|
Returns the number of items in the modified list. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remove_extra_symbols (struct ada_symbol_info *syms, int nsyms)
|
remove_extra_symbols (struct block_symbol *syms, int nsyms)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
@ -4943,16 +4943,16 @@ remove_extra_symbols (struct ada_symbol_info *syms, int nsyms)
|
||||||
/* If two symbols have the same name and one of them is a stub type,
|
/* If two symbols have the same name and one of them is a stub type,
|
||||||
the get rid of the stub. */
|
the get rid of the stub. */
|
||||||
|
|
||||||
if (TYPE_STUB (SYMBOL_TYPE (syms[i].sym))
|
if (TYPE_STUB (SYMBOL_TYPE (syms[i].symbol))
|
||||||
&& SYMBOL_LINKAGE_NAME (syms[i].sym) != NULL)
|
&& SYMBOL_LINKAGE_NAME (syms[i].symbol) != NULL)
|
||||||
{
|
{
|
||||||
for (j = 0; j < nsyms; j++)
|
for (j = 0; j < nsyms; j++)
|
||||||
{
|
{
|
||||||
if (j != i
|
if (j != i
|
||||||
&& !TYPE_STUB (SYMBOL_TYPE (syms[j].sym))
|
&& !TYPE_STUB (SYMBOL_TYPE (syms[j].symbol))
|
||||||
&& SYMBOL_LINKAGE_NAME (syms[j].sym) != NULL
|
&& SYMBOL_LINKAGE_NAME (syms[j].symbol) != NULL
|
||||||
&& strcmp (SYMBOL_LINKAGE_NAME (syms[i].sym),
|
&& strcmp (SYMBOL_LINKAGE_NAME (syms[i].symbol),
|
||||||
SYMBOL_LINKAGE_NAME (syms[j].sym)) == 0)
|
SYMBOL_LINKAGE_NAME (syms[j].symbol)) == 0)
|
||||||
remove_p = 1;
|
remove_p = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4960,19 +4960,20 @@ remove_extra_symbols (struct ada_symbol_info *syms, int nsyms)
|
||||||
/* Two symbols with the same name, same class and same address
|
/* Two symbols with the same name, same class and same address
|
||||||
should be identical. */
|
should be identical. */
|
||||||
|
|
||||||
else if (SYMBOL_LINKAGE_NAME (syms[i].sym) != NULL
|
else if (SYMBOL_LINKAGE_NAME (syms[i].symbol) != NULL
|
||||||
&& SYMBOL_CLASS (syms[i].sym) == LOC_STATIC
|
&& SYMBOL_CLASS (syms[i].symbol) == LOC_STATIC
|
||||||
&& is_nondebugging_type (SYMBOL_TYPE (syms[i].sym)))
|
&& is_nondebugging_type (SYMBOL_TYPE (syms[i].symbol)))
|
||||||
{
|
{
|
||||||
for (j = 0; j < nsyms; j += 1)
|
for (j = 0; j < nsyms; j += 1)
|
||||||
{
|
{
|
||||||
if (i != j
|
if (i != j
|
||||||
&& SYMBOL_LINKAGE_NAME (syms[j].sym) != NULL
|
&& SYMBOL_LINKAGE_NAME (syms[j].symbol) != NULL
|
||||||
&& strcmp (SYMBOL_LINKAGE_NAME (syms[i].sym),
|
&& strcmp (SYMBOL_LINKAGE_NAME (syms[i].symbol),
|
||||||
SYMBOL_LINKAGE_NAME (syms[j].sym)) == 0
|
SYMBOL_LINKAGE_NAME (syms[j].symbol)) == 0
|
||||||
&& SYMBOL_CLASS (syms[i].sym) == SYMBOL_CLASS (syms[j].sym)
|
&& SYMBOL_CLASS (syms[i].symbol)
|
||||||
&& SYMBOL_VALUE_ADDRESS (syms[i].sym)
|
== SYMBOL_CLASS (syms[j].symbol)
|
||||||
== SYMBOL_VALUE_ADDRESS (syms[j].sym))
|
&& SYMBOL_VALUE_ADDRESS (syms[i].symbol)
|
||||||
|
== SYMBOL_VALUE_ADDRESS (syms[j].symbol))
|
||||||
remove_p = 1;
|
remove_p = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5151,7 +5152,7 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
|
||||||
the user will be unable to print such rename entities. */
|
the user will be unable to print such rename entities. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remove_irrelevant_renamings (struct ada_symbol_info *syms,
|
remove_irrelevant_renamings (struct block_symbol *syms,
|
||||||
int nsyms, const struct block *current_block)
|
int nsyms, const struct block *current_block)
|
||||||
{
|
{
|
||||||
struct symbol *current_function;
|
struct symbol *current_function;
|
||||||
|
@ -5165,7 +5166,7 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
|
||||||
is_new_style_renaming = 0;
|
is_new_style_renaming = 0;
|
||||||
for (i = 0; i < nsyms; i += 1)
|
for (i = 0; i < nsyms; i += 1)
|
||||||
{
|
{
|
||||||
struct symbol *sym = syms[i].sym;
|
struct symbol *sym = syms[i].symbol;
|
||||||
const struct block *block = syms[i].block;
|
const struct block *block = syms[i].block;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *suffix;
|
const char *suffix;
|
||||||
|
@ -5182,11 +5183,11 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
|
||||||
|
|
||||||
is_new_style_renaming = 1;
|
is_new_style_renaming = 1;
|
||||||
for (j = 0; j < nsyms; j += 1)
|
for (j = 0; j < nsyms; j += 1)
|
||||||
if (i != j && syms[j].sym != NULL
|
if (i != j && syms[j].symbol != NULL
|
||||||
&& strncmp (name, SYMBOL_LINKAGE_NAME (syms[j].sym),
|
&& strncmp (name, SYMBOL_LINKAGE_NAME (syms[j].symbol),
|
||||||
name_len) == 0
|
name_len) == 0
|
||||||
&& block == syms[j].block)
|
&& block == syms[j].block)
|
||||||
syms[j].sym = NULL;
|
syms[j].symbol = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_new_style_renaming)
|
if (is_new_style_renaming)
|
||||||
|
@ -5194,7 +5195,7 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
|
||||||
int j, k;
|
int j, k;
|
||||||
|
|
||||||
for (j = k = 0; j < nsyms; j += 1)
|
for (j = k = 0; j < nsyms; j += 1)
|
||||||
if (syms[j].sym != NULL)
|
if (syms[j].symbol != NULL)
|
||||||
{
|
{
|
||||||
syms[k] = syms[j];
|
syms[k] = syms[j];
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -5223,9 +5224,9 @@ remove_irrelevant_renamings (struct ada_symbol_info *syms,
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < nsyms)
|
while (i < nsyms)
|
||||||
{
|
{
|
||||||
if (ada_parse_renaming (syms[i].sym, NULL, NULL, NULL)
|
if (ada_parse_renaming (syms[i].symbol, NULL, NULL, NULL)
|
||||||
== ADA_OBJECT_RENAMING
|
== ADA_OBJECT_RENAMING
|
||||||
&& old_renaming_is_invisible (syms[i].sym, current_function_name))
|
&& old_renaming_is_invisible (syms[i].symbol, current_function_name))
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -5479,7 +5480,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
|
||||||
static int
|
static int
|
||||||
ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
|
ada_lookup_symbol_list_worker (const char *name0, const struct block *block0,
|
||||||
domain_enum domain,
|
domain_enum domain,
|
||||||
struct ada_symbol_info **results,
|
struct block_symbol **results,
|
||||||
int full_search)
|
int full_search)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
@ -5566,7 +5567,7 @@ done:
|
||||||
cache_symbol (name0, domain, NULL, NULL);
|
cache_symbol (name0, domain, NULL, NULL);
|
||||||
|
|
||||||
if (ndefns == 1 && full_search && syms_from_global_search)
|
if (ndefns == 1 && full_search && syms_from_global_search)
|
||||||
cache_symbol (name0, domain, (*results)[0].sym, (*results)[0].block);
|
cache_symbol (name0, domain, (*results)[0].symbol, (*results)[0].block);
|
||||||
|
|
||||||
ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
|
ndefns = remove_irrelevant_renamings (*results, ndefns, block0);
|
||||||
|
|
||||||
|
@ -5580,7 +5581,7 @@ done:
|
||||||
|
|
||||||
int
|
int
|
||||||
ada_lookup_symbol_list (const char *name0, const struct block *block0,
|
ada_lookup_symbol_list (const char *name0, const struct block *block0,
|
||||||
domain_enum domain, struct ada_symbol_info **results)
|
domain_enum domain, struct block_symbol **results)
|
||||||
{
|
{
|
||||||
return ada_lookup_symbol_list_worker (name0, block0, domain, results, 1);
|
return ada_lookup_symbol_list_worker (name0, block0, domain, results, 1);
|
||||||
}
|
}
|
||||||
|
@ -5594,12 +5595,12 @@ ada_iterate_over_symbols (const struct block *block,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int ndefs, i;
|
int ndefs, i;
|
||||||
struct ada_symbol_info *results;
|
struct block_symbol *results;
|
||||||
|
|
||||||
ndefs = ada_lookup_symbol_list_worker (name, block, domain, &results, 0);
|
ndefs = ada_lookup_symbol_list_worker (name, block, domain, &results, 0);
|
||||||
for (i = 0; i < ndefs; ++i)
|
for (i = 0; i < ndefs; ++i)
|
||||||
{
|
{
|
||||||
if (! (*callback) (results[i].sym, data))
|
if (! (*callback) (results[i].symbol, data))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5639,20 +5640,20 @@ ada_name_for_lookup (const char *name)
|
||||||
void
|
void
|
||||||
ada_lookup_encoded_symbol (const char *name, const struct block *block,
|
ada_lookup_encoded_symbol (const char *name, const struct block *block,
|
||||||
domain_enum domain,
|
domain_enum domain,
|
||||||
struct ada_symbol_info *info)
|
struct block_symbol *info)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *candidates;
|
struct block_symbol *candidates;
|
||||||
int n_candidates;
|
int n_candidates;
|
||||||
|
|
||||||
gdb_assert (info != NULL);
|
gdb_assert (info != NULL);
|
||||||
memset (info, 0, sizeof (struct ada_symbol_info));
|
memset (info, 0, sizeof (struct block_symbol));
|
||||||
|
|
||||||
n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
|
n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates);
|
||||||
if (n_candidates == 0)
|
if (n_candidates == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*info = candidates[0];
|
*info = candidates[0];
|
||||||
info->sym = fixup_symbol_section (info->sym, NULL);
|
info->symbol = fixup_symbol_section (info->symbol, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
|
/* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
|
||||||
|
@ -5661,30 +5662,30 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
|
||||||
choosing the first symbol if there are multiple choices.
|
choosing the first symbol if there are multiple choices.
|
||||||
If IS_A_FIELD_OF_THIS is not NULL, it is set to zero. */
|
If IS_A_FIELD_OF_THIS is not NULL, it is set to zero. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
ada_lookup_symbol (const char *name, const struct block *block0,
|
ada_lookup_symbol (const char *name, const struct block *block0,
|
||||||
domain_enum domain, int *is_a_field_of_this)
|
domain_enum domain, int *is_a_field_of_this)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info info;
|
struct block_symbol info;
|
||||||
|
|
||||||
if (is_a_field_of_this != NULL)
|
if (is_a_field_of_this != NULL)
|
||||||
*is_a_field_of_this = 0;
|
*is_a_field_of_this = 0;
|
||||||
|
|
||||||
ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
|
ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)),
|
||||||
block0, domain, &info);
|
block0, domain, &info);
|
||||||
return info.sym;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
ada_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
ada_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = ada_lookup_symbol (name, block_static_block (block), domain, NULL);
|
sym = ada_lookup_symbol (name, block_static_block (block), domain, NULL);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
/* If we haven't found a match at this point, try the primitive
|
/* If we haven't found a match at this point, try the primitive
|
||||||
|
@ -5707,12 +5708,12 @@ ada_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
gdbarch = target_gdbarch ();
|
gdbarch = target_gdbarch ();
|
||||||
else
|
else
|
||||||
gdbarch = block_gdbarch (block);
|
gdbarch = block_gdbarch (block);
|
||||||
sym = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
|
sym.symbol = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11372,7 +11373,7 @@ scan_discrim_bound (char *str, int k, struct value *dval, LONGEST * px,
|
||||||
static struct value *
|
static struct value *
|
||||||
get_var_value (char *name, char *err_msg)
|
get_var_value (char *name, char *err_msg)
|
||||||
{
|
{
|
||||||
struct ada_symbol_info *syms;
|
struct block_symbol *syms;
|
||||||
int nsyms;
|
int nsyms;
|
||||||
|
|
||||||
nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN,
|
nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN,
|
||||||
|
@ -11386,7 +11387,7 @@ get_var_value (char *name, char *err_msg)
|
||||||
error (("%s"), err_msg);
|
error (("%s"), err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value_of_variable (syms[0].sym, syms[0].block);
|
return value_of_variable (syms[0].symbol, syms[0].block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Value of integer variable named NAME in the current environment. If
|
/* Value of integer variable named NAME in the current environment. If
|
||||||
|
|
|
@ -79,17 +79,6 @@ struct ada_opname_map
|
||||||
/* Defined in ada-lang.c */
|
/* Defined in ada-lang.c */
|
||||||
extern const struct ada_opname_map ada_opname_table[];
|
extern const struct ada_opname_map ada_opname_table[];
|
||||||
|
|
||||||
/* A tuple representing one instance of a symbol-lookup operation. */
|
|
||||||
|
|
||||||
struct ada_symbol_info
|
|
||||||
{
|
|
||||||
/* The symbol that was found. */
|
|
||||||
struct symbol *sym;
|
|
||||||
|
|
||||||
/* The block where the symbol was found. */
|
|
||||||
const struct block *block;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Denotes a type of renaming symbol (see ada_parse_renaming). */
|
/* Denotes a type of renaming symbol (see ada_parse_renaming). */
|
||||||
enum ada_renaming_category
|
enum ada_renaming_category
|
||||||
{
|
{
|
||||||
|
@ -236,22 +225,23 @@ extern const char *ada_decode (const char*);
|
||||||
extern enum language ada_update_initial_language (enum language);
|
extern enum language ada_update_initial_language (enum language);
|
||||||
|
|
||||||
extern int ada_lookup_symbol_list (const char *, const struct block *,
|
extern int ada_lookup_symbol_list (const char *, const struct block *,
|
||||||
domain_enum, struct ada_symbol_info**);
|
domain_enum, struct block_symbol**);
|
||||||
|
|
||||||
extern char *ada_fold_name (const char *);
|
extern char *ada_fold_name (const char *);
|
||||||
|
|
||||||
extern struct symbol *ada_lookup_symbol (const char *, const struct block *,
|
extern struct block_symbol ada_lookup_symbol (const char *,
|
||||||
|
const struct block *,
|
||||||
domain_enum, int *);
|
domain_enum, int *);
|
||||||
|
|
||||||
extern void ada_lookup_encoded_symbol
|
extern void ada_lookup_encoded_symbol
|
||||||
(const char *name, const struct block *block, domain_enum domain,
|
(const char *name, const struct block *block, domain_enum domain,
|
||||||
struct ada_symbol_info *symbol_info);
|
struct block_symbol *symbol_info);
|
||||||
|
|
||||||
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
|
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
|
||||||
|
|
||||||
extern void ada_fill_in_ada_prototype (struct symbol *);
|
extern void ada_fill_in_ada_prototype (struct symbol *);
|
||||||
|
|
||||||
extern int user_select_syms (struct ada_symbol_info *, int, int);
|
extern int user_select_syms (struct block_symbol *, int, int);
|
||||||
|
|
||||||
extern int get_selections (int *, int, int, int, char *);
|
extern int get_selections (int *, int, int, int, char *);
|
||||||
|
|
||||||
|
|
|
@ -471,23 +471,24 @@ get_tcb_types_info (void)
|
||||||
|
|
||||||
struct symbol *atcb_sym =
|
struct symbol *atcb_sym =
|
||||||
lookup_symbol_in_language (atcb_name, NULL, STRUCT_DOMAIN,
|
lookup_symbol_in_language (atcb_name, NULL, STRUCT_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
const struct symbol *common_atcb_sym =
|
const struct symbol *common_atcb_sym =
|
||||||
lookup_symbol_in_language (common_atcb_name, NULL, STRUCT_DOMAIN,
|
lookup_symbol_in_language (common_atcb_name, NULL, STRUCT_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
const struct symbol *private_data_sym =
|
const struct symbol *private_data_sym =
|
||||||
lookup_symbol_in_language (private_data_name, NULL, STRUCT_DOMAIN,
|
lookup_symbol_in_language (private_data_name, NULL, STRUCT_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
const struct symbol *entry_call_record_sym =
|
const struct symbol *entry_call_record_sym =
|
||||||
lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
|
lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
|
|
||||||
if (atcb_sym == NULL || atcb_sym->type == NULL)
|
if (atcb_sym == NULL || atcb_sym->type == NULL)
|
||||||
{
|
{
|
||||||
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
|
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
|
||||||
size, so the symbol name differs. */
|
size, so the symbol name differs. */
|
||||||
atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL,
|
atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL,
|
||||||
STRUCT_DOMAIN, language_c, NULL);
|
STRUCT_DOMAIN, language_c,
|
||||||
|
NULL).symbol;
|
||||||
|
|
||||||
if (atcb_sym == NULL || atcb_sym->type == NULL)
|
if (atcb_sym == NULL || atcb_sym->type == NULL)
|
||||||
error (_("Cannot find Ada_Task_Control_Block type. Aborting"));
|
error (_("Cannot find Ada_Task_Control_Block type. Aborting"));
|
||||||
|
@ -863,7 +864,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
|
||||||
|
|
||||||
/* Try to get pointer type and array length from the symtab. */
|
/* Try to get pointer type and array length from the symtab. */
|
||||||
sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN,
|
sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
/* Validate. */
|
/* Validate. */
|
||||||
|
@ -908,7 +909,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
|
||||||
data->known_tasks_length = 1;
|
data->known_tasks_length = 1;
|
||||||
|
|
||||||
sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN,
|
sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN,
|
||||||
language_c, NULL);
|
language_c, NULL).symbol;
|
||||||
if (sym != NULL && SYMBOL_VALUE_ADDRESS (sym) != 0)
|
if (sym != NULL && SYMBOL_VALUE_ADDRESS (sym) != 0)
|
||||||
{
|
{
|
||||||
/* Validate. */
|
/* Validate. */
|
||||||
|
|
12
gdb/ax-gdb.c
12
gdb/ax-gdb.c
|
@ -1556,7 +1556,7 @@ gen_static_field (struct gdbarch *gdbarch,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
|
const char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
|
||||||
struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
|
struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
|
@ -1647,20 +1647,20 @@ gen_maybe_namespace_elt (struct expression *exp,
|
||||||
const struct type *curtype, char *name)
|
const struct type *curtype, char *name)
|
||||||
{
|
{
|
||||||
const char *namespace_name = TYPE_TAG_NAME (curtype);
|
const char *namespace_name = TYPE_TAG_NAME (curtype);
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = cp_lookup_symbol_namespace (namespace_name, name,
|
sym = cp_lookup_symbol_namespace (namespace_name, name,
|
||||||
block_for_pc (ax->scope),
|
block_for_pc (ax->scope),
|
||||||
VAR_DOMAIN);
|
VAR_DOMAIN);
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym.symbol == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
gen_var_ref (exp->gdbarch, ax, value, sym);
|
gen_var_ref (exp->gdbarch, ax, value, sym.symbol);
|
||||||
|
|
||||||
if (value->optimized_out)
|
if (value->optimized_out)
|
||||||
error (_("`%s' has been optimized out, cannot use"),
|
error (_("`%s' has been optimized out, cannot use"),
|
||||||
SYMBOL_PRINT_NAME (sym));
|
SYMBOL_PRINT_NAME (sym.symbol));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -2194,7 +2194,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
|
||||||
func = block_linkage_function (b);
|
func = block_linkage_function (b);
|
||||||
lang = language_def (SYMBOL_LANGUAGE (func));
|
lang = language_def (SYMBOL_LANGUAGE (func));
|
||||||
|
|
||||||
sym = lookup_language_this (lang, b);
|
sym = lookup_language_this (lang, b).symbol;
|
||||||
if (!sym)
|
if (!sym)
|
||||||
error (_("no `%s' found"), lang->la_name_of_this);
|
error (_("no `%s' found"), lang->la_name_of_this);
|
||||||
|
|
||||||
|
|
97
gdb/c-exp.y
97
gdb/c-exp.y
|
@ -923,8 +923,8 @@ exp : FALSEKEYWORD
|
||||||
|
|
||||||
block : BLOCKNAME
|
block : BLOCKNAME
|
||||||
{
|
{
|
||||||
if ($1.sym)
|
if ($1.sym.symbol)
|
||||||
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
|
$$ = SYMBOL_BLOCK_VALUE ($1.sym.symbol);
|
||||||
else
|
else
|
||||||
error (_("No file or function \"%s\"."),
|
error (_("No file or function \"%s\"."),
|
||||||
copy_name ($1.stoken));
|
copy_name ($1.stoken));
|
||||||
|
@ -938,7 +938,8 @@ block : BLOCKNAME
|
||||||
block : block COLONCOLON name
|
block : block COLONCOLON name
|
||||||
{ struct symbol *tem
|
{ struct symbol *tem
|
||||||
= lookup_symbol (copy_name ($3), $1,
|
= lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL).symbol;
|
||||||
|
|
||||||
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
||||||
error (_("No function \"%s\" in specified context."),
|
error (_("No function \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
|
@ -946,7 +947,7 @@ block : block COLONCOLON name
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename ENTRY
|
variable: name_not_typename ENTRY
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct symbol *sym = $1.sym.symbol;
|
||||||
|
|
||||||
if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
|
if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
|
||||||
|| !symbol_read_needs_frame (sym))
|
|| !symbol_read_needs_frame (sym))
|
||||||
|
@ -961,24 +962,24 @@ variable: name_not_typename ENTRY
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: block COLONCOLON name
|
variable: block COLONCOLON name
|
||||||
{ struct symbol *sym;
|
{ struct block_symbol sym
|
||||||
sym = lookup_symbol (copy_name ($3), $1,
|
= lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL);
|
||||||
if (sym == 0)
|
|
||||||
|
if (sym.symbol == 0)
|
||||||
error (_("No symbol \"%s\" in specified context."),
|
error (_("No symbol \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* block_found is set by lookup_symbol. */
|
write_exp_elt_block (pstate, sym.block);
|
||||||
write_exp_elt_block (pstate, block_found);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_sym (pstate, sym);
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1035,9 +1036,9 @@ variable: qualified_name
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct bound_minimal_symbol msymbol;
|
struct bound_minimal_symbol msymbol;
|
||||||
|
|
||||||
sym =
|
sym
|
||||||
lookup_symbol (name, (const struct block *) NULL,
|
= lookup_symbol (name, (const struct block *) NULL,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL).symbol;
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -1058,16 +1059,16 @@ variable: qualified_name
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename
|
variable: name_not_typename
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct block_symbol sym = $1.sym;
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -1075,7 +1076,7 @@ variable: name_not_typename
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (pstate, NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (pstate, sym);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
}
|
}
|
||||||
else if ($1.is_a_field_of_this)
|
else if ($1.is_a_field_of_this)
|
||||||
|
@ -1084,9 +1085,9 @@ variable: name_not_typename
|
||||||
not inadvertently convert from a method call
|
not inadvertently convert from a method call
|
||||||
to data ref. */
|
to data ref. */
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
write_exp_elt_opcode (pstate, OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (pstate, OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
||||||
|
@ -2817,7 +2818,7 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
|
||||||
VAR_DOMAIN,
|
VAR_DOMAIN,
|
||||||
(parse_language (par_state)->la_language
|
(parse_language (par_state)->la_language
|
||||||
== language_cplus ? &is_a_field_of_this
|
== language_cplus ? &is_a_field_of_this
|
||||||
: NULL))
|
: NULL)).symbol
|
||||||
!= NULL)
|
!= NULL)
|
||||||
{
|
{
|
||||||
/* The keyword is shadowed. */
|
/* The keyword is shadowed. */
|
||||||
|
@ -2838,7 +2839,8 @@ lex_one_token (struct parser_state *par_state, int *is_quoted_name)
|
||||||
saw_name_at_eof = 1;
|
saw_name_at_eof = 1;
|
||||||
|
|
||||||
yylval.ssym.stoken = yylval.sval;
|
yylval.ssym.stoken = yylval.sval;
|
||||||
yylval.ssym.sym = NULL;
|
yylval.ssym.sym.symbol = NULL;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
yylval.ssym.is_a_field_of_this = 0;
|
yylval.ssym.is_a_field_of_this = 0;
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
@ -2873,7 +2875,7 @@ static int
|
||||||
classify_name (struct parser_state *par_state, const struct block *block,
|
classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
int is_quoted_name)
|
int is_quoted_name)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol bsym;
|
||||||
char *copy;
|
char *copy;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
|
|
||||||
|
@ -2883,17 +2885,17 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
we can refer to it unconditionally below. */
|
we can refer to it unconditionally below. */
|
||||||
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
|
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
|
||||||
|
|
||||||
sym = lookup_symbol (copy, block, VAR_DOMAIN,
|
bsym = lookup_symbol (copy, block, VAR_DOMAIN,
|
||||||
parse_language (par_state)->la_name_of_this
|
parse_language (par_state)->la_name_of_this
|
||||||
? &is_a_field_of_this : NULL);
|
? &is_a_field_of_this : NULL);
|
||||||
|
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = bsym;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
}
|
}
|
||||||
else if (!sym)
|
else if (!bsym.symbol)
|
||||||
{
|
{
|
||||||
/* If we found a field of 'this', we might have erroneously
|
/* If we found a field of 'this', we might have erroneously
|
||||||
found a constructor where we wanted a type name. Handle this
|
found a constructor where we wanted a type name. Handle this
|
||||||
|
@ -2906,11 +2908,11 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
{
|
{
|
||||||
struct field_of_this_result inner_is_a_field_of_this;
|
struct field_of_this_result inner_is_a_field_of_this;
|
||||||
|
|
||||||
sym = lookup_symbol (copy, block, STRUCT_DOMAIN,
|
bsym = lookup_symbol (copy, block, STRUCT_DOMAIN,
|
||||||
&inner_is_a_field_of_this);
|
&inner_is_a_field_of_this);
|
||||||
if (sym != NULL)
|
if (bsym.symbol != NULL)
|
||||||
{
|
{
|
||||||
yylval.tsym.type = SYMBOL_TYPE (sym);
|
yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2934,18 +2936,20 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
yylval.tsym.type = SYMBOL_TYPE (sym);
|
yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if it's an ObjC classname. */
|
/* See if it's an ObjC classname. */
|
||||||
if (parse_language (par_state)->la_language == language_objc && !sym)
|
if (parse_language (par_state)->la_language == language_objc && !bsym.symbol)
|
||||||
{
|
{
|
||||||
CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
|
CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
|
||||||
if (Class)
|
if (Class)
|
||||||
{
|
{
|
||||||
|
struct symbol *sym;
|
||||||
|
|
||||||
yylval.theclass.theclass = Class;
|
yylval.theclass.theclass = Class;
|
||||||
sym = lookup_struct_typedef (copy, expression_context_block, 1);
|
sym = lookup_struct_typedef (copy, expression_context_block, 1);
|
||||||
if (sym)
|
if (sym)
|
||||||
|
@ -2957,26 +2961,27 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||||
/* Input names that aren't symbols but ARE valid hex numbers, when
|
/* Input names that aren't symbols but ARE valid hex numbers, when
|
||||||
the input radix permits them, can be names or numbers depending
|
the input radix permits them, can be names or numbers depending
|
||||||
on the parse. Note we support radixes > 16 here. */
|
on the parse. Note we support radixes > 16 here. */
|
||||||
if (!sym
|
if (!bsym.symbol
|
||||||
&& ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
|
&& ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
|
||||||
|| (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)))
|
|| (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)))
|
||||||
{
|
{
|
||||||
YYSTYPE newlval; /* Its value is ignored. */
|
YYSTYPE newlval; /* Its value is ignored. */
|
||||||
int hextype = parse_number (par_state, copy, yylval.sval.length,
|
int hextype = parse_number (par_state, copy, yylval.sval.length,
|
||||||
0, &newlval);
|
0, &newlval);
|
||||||
|
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = bsym;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
return NAME_OR_INT;
|
return NAME_OR_INT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Any other kind of symbol */
|
/* Any other kind of symbol */
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = bsym;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
|
|
||||||
if (sym == NULL
|
if (bsym.symbol == NULL
|
||||||
&& parse_language (par_state)->la_language == language_cplus
|
&& parse_language (par_state)->la_language == language_cplus
|
||||||
&& is_a_field_of_this.type == NULL
|
&& is_a_field_of_this.type == NULL
|
||||||
&& lookup_minimal_symbol (copy, NULL, NULL).minsym == NULL)
|
&& lookup_minimal_symbol (copy, NULL, NULL).minsym == NULL)
|
||||||
|
@ -3010,7 +3015,7 @@ classify_inner_name (struct parser_state *par_state,
|
||||||
/* If no symbol was found, search for a matching base class named
|
/* If no symbol was found, search for a matching base class named
|
||||||
COPY. This will allow users to enter qualified names of class members
|
COPY. This will allow users to enter qualified names of class members
|
||||||
relative to the `this' pointer. */
|
relative to the `this' pointer. */
|
||||||
if (yylval.ssym.sym == NULL)
|
if (yylval.ssym.sym.symbol == NULL)
|
||||||
{
|
{
|
||||||
struct type *base_type = cp_find_type_baseclass_by_name (type, copy);
|
struct type *base_type = cp_find_type_baseclass_by_name (type, copy);
|
||||||
|
|
||||||
|
@ -3023,7 +3028,7 @@ classify_inner_name (struct parser_state *par_state,
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (SYMBOL_CLASS (yylval.ssym.sym))
|
switch (SYMBOL_CLASS (yylval.ssym.sym.symbol))
|
||||||
{
|
{
|
||||||
case LOC_BLOCK:
|
case LOC_BLOCK:
|
||||||
case LOC_LABEL:
|
case LOC_LABEL:
|
||||||
|
@ -3042,7 +3047,7 @@ classify_inner_name (struct parser_state *par_state,
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
|
||||||
case LOC_TYPEDEF:
|
case LOC_TYPEDEF:
|
||||||
yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym);
|
yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol);
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -3302,8 +3307,8 @@ c_print_token (FILE *file, int type, YYSTYPE value)
|
||||||
case BLOCKNAME:
|
case BLOCKNAME:
|
||||||
fprintf (file, "ssym<name=%s, sym=%s, field_of_this=%d>",
|
fprintf (file, "ssym<name=%s, sym=%s, field_of_this=%d>",
|
||||||
copy_name (value.ssym.stoken),
|
copy_name (value.ssym.stoken),
|
||||||
(value.ssym.sym == NULL
|
(value.ssym.sym.symbol == NULL
|
||||||
? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym)),
|
? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym.symbol)),
|
||||||
value.ssym.is_a_field_of_this);
|
value.ssym.is_a_field_of_this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
|
||||||
|
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME(msymbol.minsym), block,
|
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME(msymbol.minsym), block,
|
||||||
VAR_DOMAIN, &is_this_fld);
|
VAR_DOMAIN, &is_this_fld).symbol;
|
||||||
|
|
||||||
if (wsym)
|
if (wsym)
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,13 +304,11 @@ convert_one_symbol (struct compile_c_instance *context,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
|
convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
|
||||||
struct symbol *sym, domain_enum domain)
|
struct block_symbol sym, domain_enum domain)
|
||||||
{
|
{
|
||||||
const struct block *static_block, *found_block;
|
const struct block *static_block;
|
||||||
int is_local_symbol;
|
int is_local_symbol;
|
||||||
|
|
||||||
found_block = block_found;
|
|
||||||
|
|
||||||
/* If we found a symbol and it is not in the static or global
|
/* If we found a symbol and it is not in the static or global
|
||||||
scope, then we should first convert any static or global scope
|
scope, then we should first convert any static or global scope
|
||||||
symbol of the same name. This lets this unusual case work:
|
symbol of the same name. This lets this unusual case work:
|
||||||
|
@ -323,24 +321,24 @@ convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static_block = block_static_block (found_block);
|
static_block = block_static_block (sym.block);
|
||||||
/* STATIC_BLOCK is NULL if FOUND_BLOCK is the global block. */
|
/* STATIC_BLOCK is NULL if FOUND_BLOCK is the global block. */
|
||||||
is_local_symbol = (found_block != static_block && static_block != NULL);
|
is_local_symbol = (sym.block != static_block && static_block != NULL);
|
||||||
if (is_local_symbol)
|
if (is_local_symbol)
|
||||||
{
|
{
|
||||||
struct symbol *global_sym;
|
struct block_symbol global_sym;
|
||||||
|
|
||||||
global_sym = lookup_symbol (identifier, NULL, domain, NULL);
|
global_sym = lookup_symbol (identifier, NULL, domain, NULL);
|
||||||
/* If the outer symbol is in the static block, we ignore it, as
|
/* If the outer symbol is in the static block, we ignore it, as
|
||||||
it cannot be referenced. */
|
it cannot be referenced. */
|
||||||
if (global_sym != NULL
|
if (global_sym.symbol != NULL
|
||||||
&& block_found != block_static_block (block_found))
|
&& global_sym.block != block_static_block (global_sym.block))
|
||||||
{
|
{
|
||||||
if (compile_debug)
|
if (compile_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"gcc_convert_symbol \"%s\": global symbol\n",
|
"gcc_convert_symbol \"%s\": global symbol\n",
|
||||||
identifier);
|
identifier);
|
||||||
convert_one_symbol (context, global_sym, 1, 0);
|
convert_one_symbol (context, global_sym.symbol, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +346,7 @@ convert_symbol_sym (struct compile_c_instance *context, const char *identifier,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"gcc_convert_symbol \"%s\": local symbol\n",
|
"gcc_convert_symbol \"%s\": local symbol\n",
|
||||||
identifier);
|
identifier);
|
||||||
convert_one_symbol (context, sym, 0, is_local_symbol);
|
convert_one_symbol (context, sym.symbol, 0, is_local_symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert a minimal symbol to its gcc form. CONTEXT is the compiler
|
/* Convert a minimal symbol to its gcc form. CONTEXT is the compiler
|
||||||
|
@ -444,10 +442,10 @@ gcc_convert_symbol (void *datum,
|
||||||
is to simply emit a gcc error. */
|
is to simply emit a gcc error. */
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = lookup_symbol (identifier, context->base.block, domain, NULL);
|
sym = lookup_symbol (identifier, context->base.block, domain, NULL);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
{
|
{
|
||||||
convert_symbol_sym (context, identifier, sym, domain);
|
convert_symbol_sym (context, identifier, sym, domain);
|
||||||
found = 1;
|
found = 1;
|
||||||
|
@ -495,7 +493,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
/* We only need global functions here. */
|
/* We only need global functions here. */
|
||||||
sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL);
|
sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL).symbol;
|
||||||
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
{
|
{
|
||||||
if (compile_debug)
|
if (compile_debug)
|
||||||
|
|
|
@ -676,7 +676,7 @@ compile_object_load (const char *object_file, const char *source_file,
|
||||||
|
|
||||||
func_sym = lookup_global_symbol_from_objfile (objfile,
|
func_sym = lookup_global_symbol_from_objfile (objfile,
|
||||||
GCC_FE_WRAPPER_FUNCTION,
|
GCC_FE_WRAPPER_FUNCTION,
|
||||||
VAR_DOMAIN);
|
VAR_DOMAIN).symbol;
|
||||||
if (func_sym == NULL)
|
if (func_sym == NULL)
|
||||||
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
|
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
|
||||||
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
|
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "buildsym.h"
|
#include "buildsym.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_nested_symbol_1 (struct type *container_type,
|
cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
const char *nested_name,
|
const char *nested_name,
|
||||||
const char *concatenated_name,
|
const char *concatenated_name,
|
||||||
|
@ -213,14 +213,14 @@ cp_is_in_anonymous (const char *symbol_name)
|
||||||
If IS_IN_ANONYMOUS is nonzero, the symbol in question is located
|
If IS_IN_ANONYMOUS is nonzero, the symbol in question is located
|
||||||
within an anonymous namespace. */
|
within an anonymous namespace. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_basic_lookup_symbol (const char *name, const struct block *block,
|
cp_basic_lookup_symbol (const char *name, const struct block *block,
|
||||||
const domain_enum domain, int is_in_anonymous)
|
const domain_enum domain, int is_in_anonymous)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = lookup_symbol_in_static_block (name, block, domain);
|
sym = lookup_symbol_in_static_block (name, block, domain);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
if (is_in_anonymous)
|
if (is_in_anonymous)
|
||||||
|
@ -232,12 +232,13 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
|
||||||
const struct block *global_block = block_global_block (block);
|
const struct block *global_block = block_global_block (block);
|
||||||
|
|
||||||
if (global_block != NULL)
|
if (global_block != NULL)
|
||||||
sym = lookup_symbol_in_block (name, global_block, domain);
|
{
|
||||||
|
sym.symbol = lookup_symbol_in_block (name, global_block, domain);
|
||||||
|
sym.block = global_block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sym = lookup_global_symbol (name, block, domain);
|
sym = lookup_global_symbol (name, block, domain);
|
||||||
}
|
|
||||||
|
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
@ -252,12 +253,12 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
|
||||||
If SEARCH is non-zero then see if we can determine "this" from BLOCK, and
|
If SEARCH is non-zero then see if we can determine "this" from BLOCK, and
|
||||||
if so then also search for NAME in that class. */
|
if so then also search for NAME in that class. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_bare_symbol (const struct language_defn *langdef,
|
cp_lookup_bare_symbol (const struct language_defn *langdef,
|
||||||
const char *name, const struct block *block,
|
const char *name, const struct block *block,
|
||||||
const domain_enum domain, int search)
|
const domain_enum domain, int search)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
/* Note: We can't do a simple assert for ':' not being in NAME because
|
/* Note: We can't do a simple assert for ':' not being in NAME because
|
||||||
':' may be in the args of a template spec. This isn't intended to be
|
':' may be in the args of a template spec. This isn't intended to be
|
||||||
|
@ -266,7 +267,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
|
||||||
gdb_assert (strchr (name, ':') == NULL);
|
gdb_assert (strchr (name, ':') == NULL);
|
||||||
|
|
||||||
sym = lookup_symbol_in_static_block (name, block, domain);
|
sym = lookup_symbol_in_static_block (name, block, domain);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
/* If we didn't find a definition for a builtin type in the static block,
|
/* If we didn't find a definition for a builtin type in the static block,
|
||||||
|
@ -283,30 +284,32 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
|
||||||
gdbarch = target_gdbarch ();
|
gdbarch = target_gdbarch ();
|
||||||
else
|
else
|
||||||
gdbarch = block_gdbarch (block);
|
gdbarch = block_gdbarch (block);
|
||||||
sym = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
|
sym.symbol
|
||||||
if (sym != NULL)
|
= language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
|
||||||
|
sym.block = NULL;
|
||||||
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym = lookup_global_symbol (name, block, domain);
|
sym = lookup_global_symbol (name, block, domain);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
if (search)
|
if (search)
|
||||||
{
|
{
|
||||||
struct symbol *lang_this;
|
struct block_symbol lang_this;
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
lang_this = lookup_language_this (language_def (language_cplus), block);
|
lang_this = lookup_language_this (language_def (language_cplus), block);
|
||||||
if (lang_this == NULL)
|
if (lang_this.symbol == NULL)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this)));
|
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol)));
|
||||||
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
|
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
|
||||||
This can happen for lambda functions compiled with clang++,
|
This can happen for lambda functions compiled with clang++,
|
||||||
which outputs no name for the container class. */
|
which outputs no name for the container class. */
|
||||||
if (TYPE_NAME (type) == NULL)
|
if (TYPE_NAME (type) == NULL)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
/* Look for symbol NAME in this class. */
|
/* Look for symbol NAME in this class. */
|
||||||
sym = cp_lookup_nested_symbol (type, name, block, domain);
|
sym = cp_lookup_nested_symbol (type, name, block, domain);
|
||||||
|
@ -324,17 +327,17 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
|
||||||
Note: At least in the case of Fortran, which also uses this code, there
|
Note: At least in the case of Fortran, which also uses this code, there
|
||||||
may be no text after the last "::". */
|
may be no text after the last "::". */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_search_static_and_baseclasses (const char *name,
|
cp_search_static_and_baseclasses (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain,
|
const domain_enum domain,
|
||||||
unsigned int prefix_len,
|
unsigned int prefix_len,
|
||||||
int is_in_anonymous)
|
int is_in_anonymous)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
char *klass, *nested;
|
char *klass, *nested;
|
||||||
struct cleanup *cleanup;
|
struct cleanup *cleanup;
|
||||||
struct symbol *klass_sym;
|
struct block_symbol klass_sym;
|
||||||
struct type *klass_type;
|
struct type *klass_type;
|
||||||
|
|
||||||
/* The test here uses <= instead of < because Fortran also uses this,
|
/* The test here uses <= instead of < because Fortran also uses this,
|
||||||
|
@ -361,12 +364,12 @@ cp_search_static_and_baseclasses (const char *name,
|
||||||
symbol_matches_domain (which should be replaced with something else,
|
symbol_matches_domain (which should be replaced with something else,
|
||||||
but it's what we have today). */
|
but it's what we have today). */
|
||||||
klass_sym = lookup_global_symbol (klass, block, VAR_DOMAIN);
|
klass_sym = lookup_global_symbol (klass, block, VAR_DOMAIN);
|
||||||
if (klass_sym == NULL)
|
if (klass_sym.symbol == NULL)
|
||||||
{
|
{
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
klass_type = SYMBOL_TYPE (klass_sym);
|
klass_type = SYMBOL_TYPE (klass_sym.symbol);
|
||||||
|
|
||||||
/* Look for a symbol named NESTED in this class.
|
/* Look for a symbol named NESTED in this class.
|
||||||
The caller is assumed to have already have done a basic lookup of NAME.
|
The caller is assumed to have already have done a basic lookup of NAME.
|
||||||
|
@ -387,7 +390,7 @@ cp_search_static_and_baseclasses (const char *name,
|
||||||
there is no scoping in which case we also try looking in the class of
|
there is no scoping in which case we also try looking in the class of
|
||||||
"this" if we can compute it. */
|
"this" if we can compute it. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
|
cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain, int search)
|
const domain_enum domain, int search)
|
||||||
|
@ -395,7 +398,7 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
|
||||||
char *concatenated_name = NULL;
|
char *concatenated_name = NULL;
|
||||||
int is_in_anonymous;
|
int is_in_anonymous;
|
||||||
unsigned int prefix_len;
|
unsigned int prefix_len;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
if (the_namespace[0] != '\0')
|
if (the_namespace[0] != '\0')
|
||||||
{
|
{
|
||||||
|
@ -419,7 +422,7 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
|
||||||
is_in_anonymous
|
is_in_anonymous
|
||||||
= the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
|
= the_namespace[0] != '\0' && cp_is_in_anonymous (the_namespace);
|
||||||
sym = cp_basic_lookup_symbol (name, block, domain, is_in_anonymous);
|
sym = cp_basic_lookup_symbol (name, block, domain, is_in_anonymous);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
if (search)
|
if (search)
|
||||||
|
@ -466,7 +469,7 @@ reset_directive_searched (void *data)
|
||||||
SEARCH_SCOPE_FIRST is an internal implementation detail: Callers must
|
SEARCH_SCOPE_FIRST is an internal implementation detail: Callers must
|
||||||
pass 0 for it. Internally we pass 1 when recursing. */
|
pass 0 for it. Internally we pass 1 when recursing. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_symbol_via_imports (const char *scope,
|
cp_lookup_symbol_via_imports (const char *scope,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
|
@ -476,17 +479,19 @@ cp_lookup_symbol_via_imports (const char *scope,
|
||||||
const int search_parents)
|
const int search_parents)
|
||||||
{
|
{
|
||||||
struct using_direct *current;
|
struct using_direct *current;
|
||||||
struct symbol *sym = NULL;
|
struct block_symbol sym;
|
||||||
int len;
|
int len;
|
||||||
int directive_match;
|
int directive_match;
|
||||||
struct cleanup *searched_cleanup;
|
struct cleanup *searched_cleanup;
|
||||||
|
|
||||||
|
sym.symbol = NULL;
|
||||||
|
|
||||||
/* First, try to find the symbol in the given namespace if requested. */
|
/* First, try to find the symbol in the given namespace if requested. */
|
||||||
if (search_scope_first)
|
if (search_scope_first)
|
||||||
sym = cp_lookup_symbol_in_namespace (scope, name,
|
sym = cp_lookup_symbol_in_namespace (scope, name,
|
||||||
block, domain, 1);
|
block, domain, 1);
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
/* Go through the using directives. If any of them add new names to
|
/* Go through the using directives. If any of them add new names to
|
||||||
|
@ -532,12 +537,12 @@ cp_lookup_symbol_via_imports (const char *scope,
|
||||||
/* If this is a DECLARATION_ONLY search or a symbol was found
|
/* If this is a DECLARATION_ONLY search or a symbol was found
|
||||||
or this import statement was an import declaration, the
|
or this import statement was an import declaration, the
|
||||||
search of this import is complete. */
|
search of this import is complete. */
|
||||||
if (declaration_only || sym != NULL || current->declaration)
|
if (declaration_only || sym.symbol != NULL || current->declaration)
|
||||||
{
|
{
|
||||||
current->searched = 0;
|
current->searched = 0;
|
||||||
discard_cleanups (searched_cleanup);
|
discard_cleanups (searched_cleanup);
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -575,12 +580,12 @@ cp_lookup_symbol_via_imports (const char *scope,
|
||||||
current->searched = 0;
|
current->searched = 0;
|
||||||
discard_cleanups (searched_cleanup);
|
discard_cleanups (searched_cleanup);
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function that searches an array of symbols for one named NAME. */
|
/* Helper function that searches an array of symbols for one named NAME. */
|
||||||
|
@ -604,14 +609,14 @@ search_symbol_list (const char *name, int num,
|
||||||
searches through the template parameters of the function and the
|
searches through the template parameters of the function and the
|
||||||
function's type. */
|
function's type. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
cp_lookup_symbol_imports_or_template (const char *scope,
|
cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *function = BLOCK_FUNCTION (block);
|
struct symbol *function = BLOCK_FUNCTION (block);
|
||||||
struct symbol *result;
|
struct block_symbol result;
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
|
@ -629,20 +634,20 @@ cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
{
|
{
|
||||||
struct template_symbol *templ
|
struct template_symbol *templ
|
||||||
= (struct template_symbol *) function;
|
= (struct template_symbol *) function;
|
||||||
|
struct symbol *sym = search_symbol_list (name,
|
||||||
result = search_symbol_list (name,
|
|
||||||
templ->n_template_arguments,
|
templ->n_template_arguments,
|
||||||
templ->template_arguments);
|
templ->template_arguments);
|
||||||
if (result != NULL)
|
|
||||||
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"cp_lookup_symbol_imports_or_template"
|
"cp_lookup_symbol_imports_or_template"
|
||||||
" (...) = %s\n",
|
" (...) = %s\n",
|
||||||
host_address_to_string (result));
|
host_address_to_string (sym));
|
||||||
}
|
}
|
||||||
return result;
|
return (struct block_symbol) {sym, block};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,6 +661,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
const struct language_defn *lang = language_def (language_cplus);
|
const struct language_defn *lang = language_def (language_cplus);
|
||||||
struct gdbarch *arch = symbol_arch (function);
|
struct gdbarch *arch = symbol_arch (function);
|
||||||
const struct block *parent = BLOCK_SUPERBLOCK (block);
|
const struct block *parent = BLOCK_SUPERBLOCK (block);
|
||||||
|
struct symbol *sym;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -674,21 +680,21 @@ cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
result
|
sym
|
||||||
= search_symbol_list (name,
|
= search_symbol_list (name,
|
||||||
TYPE_N_TEMPLATE_ARGUMENTS (context),
|
TYPE_N_TEMPLATE_ARGUMENTS (context),
|
||||||
TYPE_TEMPLATE_ARGUMENTS (context));
|
TYPE_TEMPLATE_ARGUMENTS (context));
|
||||||
if (result != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered
|
||||||
"cp_lookup_symbol_imports_or_template"
|
(gdb_stdlog,
|
||||||
" (...) = %s\n",
|
"cp_lookup_symbol_imports_or_template (...) = %s\n",
|
||||||
host_address_to_string (result));
|
host_address_to_string (sym));
|
||||||
}
|
}
|
||||||
return result;
|
return (struct block_symbol) {sym, parent};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,8 +707,8 @@ cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"cp_lookup_symbol_imports_or_template (...) = %s\n",
|
"cp_lookup_symbol_imports_or_template (...) = %s\n",
|
||||||
result != NULL
|
result.symbol != NULL
|
||||||
? host_address_to_string (result) : "NULL");
|
? host_address_to_string (result.symbol) : "NULL");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -711,23 +717,23 @@ cp_lookup_symbol_imports_or_template (const char *scope,
|
||||||
and its parents. SCOPE is the namespace scope of the context in which the
|
and its parents. SCOPE is the namespace scope of the context in which the
|
||||||
search is being evaluated. */
|
search is being evaluated. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
|
cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
while (block != NULL)
|
while (block != NULL)
|
||||||
{
|
{
|
||||||
sym = cp_lookup_symbol_via_imports (scope, name, block, domain, 0, 0, 1);
|
sym = cp_lookup_symbol_via_imports (scope, name, block, domain, 0, 0, 1);
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
block = BLOCK_SUPERBLOCK (block);
|
block = BLOCK_SUPERBLOCK (block);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Searches for NAME in the current namespace, and by applying
|
/* Searches for NAME in the current namespace, and by applying
|
||||||
|
@ -735,13 +741,13 @@ cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
|
||||||
SCOPE is the namespace scope of the context in which the search is
|
SCOPE is the namespace scope of the context in which the search is
|
||||||
being evaluated. */
|
being evaluated. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
cp_lookup_symbol_namespace (const char *scope,
|
cp_lookup_symbol_namespace (const char *scope,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
|
@ -755,14 +761,15 @@ cp_lookup_symbol_namespace (const char *scope,
|
||||||
sym = cp_lookup_symbol_in_namespace (scope, name, block, domain, 1);
|
sym = cp_lookup_symbol_in_namespace (scope, name, block, domain, 1);
|
||||||
|
|
||||||
/* Search for name in namespaces imported to this and parent blocks. */
|
/* Search for name in namespaces imported to this and parent blocks. */
|
||||||
if (sym == NULL)
|
if (sym.symbol == NULL)
|
||||||
sym = cp_lookup_symbol_via_all_imports (scope, name, block, domain);
|
sym = cp_lookup_symbol_via_all_imports (scope, name, block, domain);
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"cp_lookup_symbol_namespace (...) = %s\n",
|
"cp_lookup_symbol_namespace (...) = %s\n",
|
||||||
sym != NULL ? host_address_to_string (sym) : "NULL");
|
sym.symbol != NULL
|
||||||
|
? host_address_to_string (sym.symbol) : "NULL");
|
||||||
}
|
}
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
@ -782,7 +789,7 @@ cp_lookup_symbol_namespace (const char *scope,
|
||||||
"A::x", and if that call fails, then the first call looks for
|
"A::x", and if that call fails, then the first call looks for
|
||||||
"x". */
|
"x". */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_namespace_scope (const struct language_defn *langdef,
|
lookup_namespace_scope (const struct language_defn *langdef,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
|
@ -796,7 +803,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
|
||||||
{
|
{
|
||||||
/* Recursively search for names in child namespaces first. */
|
/* Recursively search for names in child namespaces first. */
|
||||||
|
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
int new_scope_len = scope_len;
|
int new_scope_len = scope_len;
|
||||||
|
|
||||||
/* If the current scope is followed by "::", skip past that. */
|
/* If the current scope is followed by "::", skip past that. */
|
||||||
|
@ -808,7 +815,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
|
||||||
new_scope_len += cp_find_first_component (scope + new_scope_len);
|
new_scope_len += cp_find_first_component (scope + new_scope_len);
|
||||||
sym = lookup_namespace_scope (langdef, name, block, domain,
|
sym = lookup_namespace_scope (langdef, name, block, domain,
|
||||||
scope, new_scope_len);
|
scope, new_scope_len);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,13 +846,13 @@ lookup_namespace_scope (const struct language_defn *langdef,
|
||||||
we're looking for, BLOCK is the block that we're searching within,
|
we're looking for, BLOCK is the block that we're searching within,
|
||||||
DOMAIN says what kind of symbols we're looking for. */
|
DOMAIN says what kind of symbols we're looking for. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
const char *scope = block_scope (block);
|
const char *scope = block_scope (block);
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
|
@ -862,14 +869,16 @@ cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
sym = lookup_namespace_scope (langdef, name, block, domain, scope, 0);
|
sym = lookup_namespace_scope (langdef, name, block, domain, scope, 0);
|
||||||
|
|
||||||
/* Search for name in namespaces imported to this and parent blocks. */
|
/* Search for name in namespaces imported to this and parent blocks. */
|
||||||
if (sym == NULL)
|
if (sym.symbol == NULL)
|
||||||
sym = cp_lookup_symbol_via_all_imports (scope, name, block, domain);
|
sym = cp_lookup_symbol_via_all_imports (scope, name, block, domain);
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"cp_lookup_symbol_nonlocal (...) = %s\n",
|
"cp_lookup_symbol_nonlocal (...) = %s\n",
|
||||||
sym != NULL ? host_address_to_string (sym) : "NULL");
|
(sym.symbol != NULL
|
||||||
|
? host_address_to_string (sym.symbol)
|
||||||
|
: "NULL"));
|
||||||
}
|
}
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
@ -905,17 +914,18 @@ cp_find_type_baseclass_by_name (struct type *parent_type, const char *name)
|
||||||
/* Search through the base classes of PARENT_TYPE for a symbol named
|
/* Search through the base classes of PARENT_TYPE for a symbol named
|
||||||
NAME in block BLOCK. */
|
NAME in block BLOCK. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
find_symbol_in_baseclass (struct type *parent_type, const char *name,
|
find_symbol_in_baseclass (struct type *parent_type, const char *name,
|
||||||
const struct block *block, const domain_enum domain,
|
const struct block *block, const domain_enum domain,
|
||||||
int is_in_anonymous)
|
int is_in_anonymous)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
struct cleanup *cleanup;
|
struct cleanup *cleanup;
|
||||||
char *concatenated_name;
|
char *concatenated_name;
|
||||||
|
|
||||||
sym = NULL;
|
sym.symbol = NULL;
|
||||||
|
sym.block = NULL;
|
||||||
concatenated_name = NULL;
|
concatenated_name = NULL;
|
||||||
cleanup = make_cleanup (free_current_contents, &concatenated_name);
|
cleanup = make_cleanup (free_current_contents, &concatenated_name);
|
||||||
|
|
||||||
|
@ -934,7 +944,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
|
||||||
|
|
||||||
sym = cp_lookup_nested_symbol_1 (base_type, name, concatenated_name,
|
sym = cp_lookup_nested_symbol_1 (base_type, name, concatenated_name,
|
||||||
block, domain, 1, is_in_anonymous);
|
block, domain, 1, is_in_anonymous);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,7 +964,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
|
||||||
If IS_IN_ANONYMOUS is non-zero then CONCATENATED_NAME is in an anonymous
|
If IS_IN_ANONYMOUS is non-zero then CONCATENATED_NAME is in an anonymous
|
||||||
namespace. */
|
namespace. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
cp_lookup_nested_symbol_1 (struct type *container_type,
|
cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
const char *nested_name,
|
const char *nested_name,
|
||||||
const char *concatenated_name,
|
const char *concatenated_name,
|
||||||
|
@ -962,7 +972,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
const domain_enum domain,
|
const domain_enum domain,
|
||||||
int basic_lookup, int is_in_anonymous)
|
int basic_lookup, int is_in_anonymous)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
/* NOTE: carlton/2003-11-10: We don't treat C++ class members
|
/* NOTE: carlton/2003-11-10: We don't treat C++ class members
|
||||||
of classes like, say, data or function members. Instead,
|
of classes like, say, data or function members. Instead,
|
||||||
|
@ -975,7 +985,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
{
|
{
|
||||||
sym = cp_basic_lookup_symbol (concatenated_name, block, domain,
|
sym = cp_basic_lookup_symbol (concatenated_name, block, domain,
|
||||||
is_in_anonymous);
|
is_in_anonymous);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -986,7 +996,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
|
|
||||||
/* First search in this symtab, what we want is possibly there. */
|
/* First search in this symtab, what we want is possibly there. */
|
||||||
sym = lookup_symbol_in_static_block (concatenated_name, block, domain);
|
sym = lookup_symbol_in_static_block (concatenated_name, block, domain);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
|
|
||||||
/* Nope. We now have to search all static blocks in all objfiles,
|
/* Nope. We now have to search all static blocks in all objfiles,
|
||||||
|
@ -997,7 +1007,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
if (!is_in_anonymous)
|
if (!is_in_anonymous)
|
||||||
{
|
{
|
||||||
sym = lookup_static_symbol (concatenated_name, domain);
|
sym = lookup_static_symbol (concatenated_name, domain);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,11 +1017,11 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
{
|
{
|
||||||
sym = find_symbol_in_baseclass (container_type, nested_name, block,
|
sym = find_symbol_in_baseclass (container_type, nested_name, block,
|
||||||
domain, is_in_anonymous);
|
domain, is_in_anonymous);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up a symbol named NESTED_NAME that is nested inside the C++
|
/* Look up a symbol named NESTED_NAME that is nested inside the C++
|
||||||
|
@ -1019,7 +1029,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
|
||||||
given by BLOCK, and in DOMAIN.
|
given by BLOCK, and in DOMAIN.
|
||||||
Return NULL if there is no such nested symbol. */
|
Return NULL if there is no such nested symbol. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
cp_lookup_nested_symbol (struct type *parent_type,
|
cp_lookup_nested_symbol (struct type *parent_type,
|
||||||
const char *nested_name,
|
const char *nested_name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
|
@ -1055,7 +1065,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
const char *parent_name = type_name_no_tag_or_error (saved_parent_type);
|
const char *parent_name = type_name_no_tag_or_error (saved_parent_type);
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
char *concatenated_name;
|
char *concatenated_name;
|
||||||
int is_in_anonymous;
|
int is_in_anonymous;
|
||||||
|
|
||||||
|
@ -1073,8 +1083,9 @@ cp_lookup_nested_symbol (struct type *parent_type,
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"cp_lookup_nested_symbol (...) = %s\n",
|
"cp_lookup_nested_symbol (...) = %s\n",
|
||||||
sym != NULL
|
(sym.symbol != NULL
|
||||||
? host_address_to_string (sym) : "NULL");
|
? host_address_to_string (sym.symbol)
|
||||||
|
: "NULL"));
|
||||||
}
|
}
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1098,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
|
||||||
"cp_lookup_nested_symbol (...) = NULL"
|
"cp_lookup_nested_symbol (...) = NULL"
|
||||||
" (func/method)\n");
|
" (func/method)\n");
|
||||||
}
|
}
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
|
|
|
@ -175,7 +175,7 @@ inspect_type (struct demangle_parse_info *info,
|
||||||
|
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
|
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0).symbol;
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
@ -457,7 +457,7 @@ replace_typedefs (struct demangle_parse_info *info,
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0);
|
sym = lookup_symbol (local_name, 0, VAR_DOMAIN, 0).symbol;
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
@ -1455,7 +1455,7 @@ cp_lookup_rtti_type (const char *name, struct block *block)
|
||||||
|
|
||||||
/* Use VAR_DOMAIN here as NAME may be a typedef. PR 18141, 18417.
|
/* Use VAR_DOMAIN here as NAME may be a typedef. PR 18141, 18417.
|
||||||
Classes "live" in both STRUCT_DOMAIN and VAR_DOMAIN. */
|
Classes "live" in both STRUCT_DOMAIN and VAR_DOMAIN. */
|
||||||
rtti_sym = lookup_symbol (name, block, VAR_DOMAIN, NULL);
|
rtti_sym = lookup_symbol (name, block, VAR_DOMAIN, NULL).symbol;
|
||||||
|
|
||||||
if (rtti_sym == NULL)
|
if (rtti_sym == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -192,24 +192,26 @@ extern void cp_add_using_directive (const char *dest,
|
||||||
extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
|
extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
|
||||||
struct objfile *objfile);
|
struct objfile *objfile);
|
||||||
|
|
||||||
extern struct symbol *cp_lookup_symbol_nonlocal
|
extern struct block_symbol cp_lookup_symbol_nonlocal
|
||||||
(const struct language_defn *langdef,
|
(const struct language_defn *langdef,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
extern struct symbol *cp_lookup_symbol_namespace (const char *the_namespace,
|
extern struct block_symbol
|
||||||
|
cp_lookup_symbol_namespace (const char *the_namespace,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
extern struct symbol *cp_lookup_symbol_imports_or_template
|
extern struct block_symbol cp_lookup_symbol_imports_or_template
|
||||||
(const char *scope,
|
(const char *scope,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
extern struct symbol *cp_lookup_nested_symbol (struct type *parent_type,
|
extern struct block_symbol
|
||||||
|
cp_lookup_nested_symbol (struct type *parent_type,
|
||||||
const char *nested_name,
|
const char *nested_name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
27
gdb/d-exp.y
27
gdb/d-exp.y
|
@ -1022,7 +1022,7 @@ d_type_from_name (struct stoken name)
|
||||||
char *copy = copy_name (name);
|
char *copy = copy_name (name);
|
||||||
|
|
||||||
sym = lookup_symbol (copy, expression_context_block,
|
sym = lookup_symbol (copy, expression_context_block,
|
||||||
STRUCT_DOMAIN, NULL);
|
STRUCT_DOMAIN, NULL).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ d_module_from_name (struct stoken name)
|
||||||
char *copy = copy_name (name);
|
char *copy = copy_name (name);
|
||||||
|
|
||||||
sym = lookup_symbol (copy, expression_context_block,
|
sym = lookup_symbol (copy, expression_context_block,
|
||||||
MODULE_DOMAIN, NULL);
|
MODULE_DOMAIN, NULL).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
|
|
||||||
|
@ -1053,23 +1053,24 @@ push_variable (struct parser_state *ps, struct stoken name)
|
||||||
{
|
{
|
||||||
char *copy = copy_name (name);
|
char *copy = copy_name (name);
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
struct symbol *sym;
|
struct block_symbol sym
|
||||||
sym = lookup_symbol (copy, expression_context_block, VAR_DOMAIN,
|
= lookup_symbol (copy, expression_context_block, VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this);
|
||||||
if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
|
||||||
|
if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found, innermost_block))
|
contained_in (sym.block, innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not another more inner frame
|
/* We want to use the selected frame, not another more inner frame
|
||||||
which happens to be in the same block. */
|
which happens to be in the same block. */
|
||||||
write_exp_elt_block (ps, NULL);
|
write_exp_elt_block (ps, NULL);
|
||||||
write_exp_elt_sym (ps, sym);
|
write_exp_elt_sym (ps, sym.symbol);
|
||||||
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1078,8 +1079,8 @@ push_variable (struct parser_state *ps, struct stoken name)
|
||||||
/* It hangs off of `this'. Must not inadvertently convert from a
|
/* It hangs off of `this'. Must not inadvertently convert from a
|
||||||
method call to data ref. */
|
method call to data ref. */
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found, innermost_block))
|
contained_in (sym.block, innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
write_exp_elt_opcode (ps, OP_THIS);
|
write_exp_elt_opcode (ps, OP_THIS);
|
||||||
write_exp_elt_opcode (ps, OP_THIS);
|
write_exp_elt_opcode (ps, OP_THIS);
|
||||||
write_exp_elt_opcode (ps, STRUCTOP_PTR);
|
write_exp_elt_opcode (ps, STRUCTOP_PTR);
|
||||||
|
@ -1180,10 +1181,10 @@ push_module_name (struct parser_state *ps, struct type *module,
|
||||||
|
|
||||||
copy = copy_name (name);
|
copy = copy_name (name);
|
||||||
sym = lookup_symbol_in_static_block (copy, expression_context_block,
|
sym = lookup_symbol_in_static_block (copy, expression_context_block,
|
||||||
VAR_DOMAIN);
|
VAR_DOMAIN).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
sym = lookup_global_symbol (copy, expression_context_block,
|
sym = lookup_global_symbol (copy, expression_context_block,
|
||||||
VAR_DOMAIN);
|
VAR_DOMAIN).symbol;
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1492,7 +1492,7 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||||
function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
|
function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
|
||||||
name,
|
name,
|
||||||
get_selected_block (0),
|
get_selected_block (0),
|
||||||
VAR_DOMAIN);
|
VAR_DOMAIN).symbol;
|
||||||
if (function == NULL)
|
if (function == NULL)
|
||||||
error (_("No symbol \"%s\" in namespace \"%s\"."),
|
error (_("No symbol \"%s\" in namespace \"%s\"."),
|
||||||
name, TYPE_TAG_NAME (type));
|
name, TYPE_TAG_NAME (type));
|
||||||
|
|
31
gdb/f-exp.y
31
gdb/f-exp.y
|
@ -509,23 +509,23 @@ exp : STRING_LITERAL
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename
|
variable: name_not_typename
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct block_symbol sym = $1.sym;
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not
|
/* We want to use the selected frame, not
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (pstate, NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (pstate, sym);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1198,7 +1198,7 @@ yylex (void)
|
||||||
The caller is not constrained to care about the distinction. */
|
The caller is not constrained to care about the distinction. */
|
||||||
{
|
{
|
||||||
char *tmp = copy_name (yylval.sval);
|
char *tmp = copy_name (yylval.sval);
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
enum domain_enum_tag lookup_domains[] =
|
enum domain_enum_tag lookup_domains[] =
|
||||||
{
|
{
|
||||||
|
@ -1215,17 +1215,18 @@ yylex (void)
|
||||||
way we can refer to it unconditionally below. */
|
way we can refer to it unconditionally below. */
|
||||||
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
|
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
|
||||||
|
|
||||||
sym = lookup_symbol (tmp, expression_context_block,
|
result = lookup_symbol (tmp, expression_context_block,
|
||||||
lookup_domains[i],
|
lookup_domains[i],
|
||||||
parse_language (pstate)->la_language
|
parse_language (pstate)->la_language
|
||||||
== language_cplus ? &is_a_field_of_this : NULL);
|
== language_cplus
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
? &is_a_field_of_this : NULL);
|
||||||
|
if (result.symbol && SYMBOL_CLASS (result.symbol) == LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
yylval.tsym.type = SYMBOL_TYPE (sym);
|
yylval.tsym.type = SYMBOL_TYPE (result.symbol);
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sym)
|
if (result.symbol)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1238,7 +1239,7 @@ yylex (void)
|
||||||
/* Input names that aren't symbols but ARE valid hex numbers,
|
/* Input names that aren't symbols but ARE valid hex numbers,
|
||||||
when the input radix permits them, can be names or numbers
|
when the input radix permits them, can be names or numbers
|
||||||
depending on the parse. Note we support radixes > 16 here. */
|
depending on the parse. Note we support radixes > 16 here. */
|
||||||
if (!sym
|
if (!result.symbol
|
||||||
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|
&& ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
|
||||||
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
|| (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
|
||||||
{
|
{
|
||||||
|
@ -1246,14 +1247,14 @@ yylex (void)
|
||||||
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = result;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
return NAME_OR_INT;
|
return NAME_OR_INT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Any other kind of symbol */
|
/* Any other kind of symbol */
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = result;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1420,7 +1420,7 @@ lookup_typename (const struct language_defn *language,
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
sym = lookup_symbol_in_language (name, block, VAR_DOMAIN,
|
sym = lookup_symbol_in_language (name, block, VAR_DOMAIN,
|
||||||
language->la_language, NULL);
|
language->la_language, NULL).symbol;
|
||||||
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
|
|
||||||
|
@ -1464,7 +1464,7 @@ lookup_struct (const char *name, const struct block *block)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1487,7 +1487,7 @@ lookup_union (const char *name, const struct block *block)
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct type *t;
|
struct type *t;
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
error (_("No union type named %s."), name);
|
error (_("No union type named %s."), name);
|
||||||
|
@ -1510,7 +1510,7 @@ lookup_enum (const char *name, const struct block *block)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
error (_("No enum type named %s."), name);
|
error (_("No enum type named %s."), name);
|
||||||
|
@ -1539,7 +1539,7 @@ lookup_template_type (char *name, struct type *type,
|
||||||
strcat (nam, TYPE_NAME (type));
|
strcat (nam, TYPE_NAME (type));
|
||||||
strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
|
strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
|
||||||
|
|
||||||
sym = lookup_symbol (nam, block, VAR_DOMAIN, 0);
|
sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
|
@ -2256,7 +2256,7 @@ check_typedef (struct type *type)
|
||||||
stub_noname_complaint ();
|
stub_noname_complaint ();
|
||||||
return make_qualified_type (type, instance_flags, NULL);
|
return make_qualified_type (type, instance_flags, NULL);
|
||||||
}
|
}
|
||||||
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
|
||||||
if (sym)
|
if (sym)
|
||||||
TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
|
TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym);
|
||||||
else /* TYPE_CODE_UNDEF */
|
else /* TYPE_CODE_UNDEF */
|
||||||
|
@ -2347,7 +2347,7 @@ check_typedef (struct type *type)
|
||||||
stub_noname_complaint ();
|
stub_noname_complaint ();
|
||||||
return make_qualified_type (type, instance_flags, NULL);
|
return make_qualified_type (type, instance_flags, NULL);
|
||||||
}
|
}
|
||||||
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
/* Same as above for opaque types, we can replace the stub
|
/* Same as above for opaque types, we can replace the stub
|
||||||
|
|
|
@ -1063,7 +1063,8 @@ gnuv3_get_typeid_type (struct gdbarch *gdbarch)
|
||||||
struct symbol *typeinfo;
|
struct symbol *typeinfo;
|
||||||
struct type *typeinfo_type;
|
struct type *typeinfo_type;
|
||||||
|
|
||||||
typeinfo = lookup_symbol ("std::type_info", NULL, STRUCT_DOMAIN, NULL);
|
typeinfo = lookup_symbol ("std::type_info", NULL, STRUCT_DOMAIN,
|
||||||
|
NULL).symbol;
|
||||||
if (typeinfo == NULL)
|
if (typeinfo == NULL)
|
||||||
typeinfo_type = gdbarch_data (gdbarch, std_type_info_gdbarch_data);
|
typeinfo_type = gdbarch_data (gdbarch, std_type_info_gdbarch_data);
|
||||||
else
|
else
|
||||||
|
|
32
gdb/go-exp.y
32
gdb/go-exp.y
|
@ -582,7 +582,7 @@ exp : FALSE_KEYWORD
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename ENTRY
|
variable: name_not_typename ENTRY
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct symbol *sym = $1.sym.symbol;
|
||||||
|
|
||||||
if (sym == NULL
|
if (sym == NULL
|
||||||
|| !SYMBOL_IS_ARGUMENT (sym)
|
|| !SYMBOL_IS_ARGUMENT (sym)
|
||||||
|
@ -598,16 +598,16 @@ variable: name_not_typename ENTRY
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename
|
variable: name_not_typename
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct block_symbol sym = $1.sym;
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -615,7 +615,7 @@ variable: name_not_typename
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (pstate, NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (pstate, sym);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
}
|
}
|
||||||
else if ($1.is_a_field_of_this)
|
else if ($1.is_a_field_of_this)
|
||||||
|
@ -1382,7 +1382,7 @@ package_name_p (const char *name, const struct block *block)
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this);
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol;
|
||||||
|
|
||||||
if (sym
|
if (sym
|
||||||
&& SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
&& SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
||||||
|
@ -1420,14 +1420,14 @@ static int
|
||||||
classify_packaged_name (const struct block *block)
|
classify_packaged_name (const struct block *block)
|
||||||
{
|
{
|
||||||
char *copy;
|
char *copy;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
|
|
||||||
copy = copy_name (yylval.sval);
|
copy = copy_name (yylval.sval);
|
||||||
|
|
||||||
sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
|
sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = sym;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
|
@ -1448,7 +1448,7 @@ static int
|
||||||
classify_name (struct parser_state *par_state, const struct block *block)
|
classify_name (struct parser_state *par_state, const struct block *block)
|
||||||
{
|
{
|
||||||
struct type *type;
|
struct type *type;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
char *copy;
|
char *copy;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
|
|
||||||
|
@ -1471,7 +1471,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
|
||||||
|
|
||||||
sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
|
sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = sym;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
|
@ -1496,7 +1496,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
|
||||||
xfree (current_package_name);
|
xfree (current_package_name);
|
||||||
sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
|
sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this);
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
yylval.ssym.stoken = sval;
|
yylval.ssym.stoken = sval;
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym = sym;
|
||||||
|
@ -1517,13 +1517,15 @@ classify_name (struct parser_state *par_state, const struct block *block)
|
||||||
0, &newlval);
|
0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = NULL;
|
yylval.ssym.sym.symbol = NULL;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
yylval.ssym.is_a_field_of_this = 0;
|
yylval.ssym.is_a_field_of_this = 0;
|
||||||
return NAME_OR_INT;
|
return NAME_OR_INT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yylval.ssym.sym = NULL;
|
yylval.ssym.sym.symbol = NULL;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
yylval.ssym.is_a_field_of_this = 0;
|
yylval.ssym.is_a_field_of_this = 0;
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
|
@ -911,7 +911,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
|
||||||
{
|
{
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
block = get_frame_block (frame, NULL);
|
block = get_frame_block (frame, NULL);
|
||||||
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
|
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL).symbol;
|
||||||
}
|
}
|
||||||
CATCH (ex, RETURN_MASK_ALL)
|
CATCH (ex, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -617,7 +617,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
|
||||||
|
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
|
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this).symbol;
|
||||||
}
|
}
|
||||||
CATCH (ex, RETURN_MASK_ALL)
|
CATCH (ex, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
@ -657,7 +657,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
|
||||||
|
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
symbol = lookup_global_symbol (name, NULL, domain);
|
symbol = lookup_global_symbol (name, NULL, domain).symbol;
|
||||||
}
|
}
|
||||||
CATCH (ex, RETURN_MASK_ALL)
|
CATCH (ex, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6087,7 +6087,8 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
|
||||||
CORE_ADDR handler;
|
CORE_ADDR handler;
|
||||||
struct breakpoint *bp;
|
struct breakpoint *bp;
|
||||||
|
|
||||||
vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL);
|
vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN,
|
||||||
|
NULL).symbol;
|
||||||
value = read_var_value (vsym, frame);
|
value = read_var_value (vsym, frame);
|
||||||
/* If the value was optimized out, revert to the old behavior. */
|
/* If the value was optimized out, revert to the old behavior. */
|
||||||
if (! value_optimized_out (value))
|
if (! value_optimized_out (value))
|
||||||
|
|
16
gdb/jv-exp.y
16
gdb/jv-exp.y
|
@ -1270,24 +1270,24 @@ push_variable (struct parser_state *par_state, struct stoken name)
|
||||||
{
|
{
|
||||||
char *tmp = copy_name (name);
|
char *tmp = copy_name (name);
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this);
|
||||||
if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
|
if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found, innermost_block))
|
contained_in (sym.block, innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
||||||
/* We want to use the selected frame, not another more inner frame
|
/* We want to use the selected frame, not another more inner frame
|
||||||
which happens to be in the same block. */
|
which happens to be in the same block. */
|
||||||
write_exp_elt_block (par_state, NULL);
|
write_exp_elt_block (par_state, NULL);
|
||||||
write_exp_elt_sym (par_state, sym);
|
write_exp_elt_sym (par_state, sym.symbol);
|
||||||
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1296,8 +1296,8 @@ push_variable (struct parser_state *par_state, struct stoken name)
|
||||||
/* it hangs off of `this'. Must not inadvertently convert from a
|
/* it hangs off of `this'. Must not inadvertently convert from a
|
||||||
method call to data ref. */
|
method call to data ref. */
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found, innermost_block))
|
contained_in (sym.block, innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
write_exp_elt_opcode (par_state, OP_THIS);
|
write_exp_elt_opcode (par_state, OP_THIS);
|
||||||
write_exp_elt_opcode (par_state, OP_THIS);
|
write_exp_elt_opcode (par_state, OP_THIS);
|
||||||
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
write_exp_elt_opcode (par_state, STRUCTOP_PTR);
|
||||||
|
|
|
@ -202,7 +202,8 @@ java_lookup_class (char *name)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN, NULL);
|
sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN,
|
||||||
|
NULL).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
/* FIXME - should search inferior's symbol table. */
|
/* FIXME - should search inferior's symbol table. */
|
||||||
|
@ -590,7 +591,7 @@ get_java_object_type (void)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN, NULL);
|
sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN, NULL).symbol;
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
error (_("cannot find java.lang.Object"));
|
error (_("cannot find java.lang.Object"));
|
||||||
return SYMBOL_TYPE (sym);
|
return SYMBOL_TYPE (sym);
|
||||||
|
|
|
@ -974,7 +974,7 @@ language_bool_type (const struct language_defn *la,
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
|
sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
|
||||||
NULL, VAR_DOMAIN, NULL);
|
NULL, VAR_DOMAIN, NULL).symbol;
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
struct type *type = SYMBOL_TYPE (sym);
|
struct type *type = SYMBOL_TYPE (sym);
|
||||||
|
@ -1075,10 +1075,9 @@ language_init_primitive_type_symbols (struct language_arch_info *lai,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: The result of symbol lookup is normally a symbol *and* the block
|
/* Note: The result of symbol lookup is normally a symbol *and* the block
|
||||||
it was found in (returned in global block_found). Builtin types don't
|
it was found in. Builtin types don't live in blocks. We *could* give
|
||||||
live in blocks. We *could* give them one, but there is no current need
|
them one, but there is no current need so to keep things simple symbol
|
||||||
so to keep things simple symbol lookup is extended to allow for
|
lookup is extended to allow for BLOCK_FOUND to be NULL. */
|
||||||
BLOCK_FOUND to be NULL. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See language.h. */
|
/* See language.h. */
|
||||||
|
|
|
@ -267,7 +267,8 @@ struct language_defn
|
||||||
the part of symbol lookup where C looks up static and global
|
the part of symbol lookup where C looks up static and global
|
||||||
variables. */
|
variables. */
|
||||||
|
|
||||||
struct symbol *(*la_lookup_symbol_nonlocal) (const struct language_defn *,
|
struct block_symbol (*la_lookup_symbol_nonlocal)
|
||||||
|
(const struct language_defn *,
|
||||||
const char *,
|
const char *,
|
||||||
const struct block *,
|
const struct block *,
|
||||||
const domain_enum);
|
const domain_enum);
|
||||||
|
|
|
@ -3254,7 +3254,7 @@ find_label_symbols (struct linespec_state *self,
|
||||||
return NULL;
|
return NULL;
|
||||||
fn_sym = BLOCK_FUNCTION (block);
|
fn_sym = BLOCK_FUNCTION (block);
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, LABEL_DOMAIN, 0);
|
sym = lookup_symbol (name, block, LABEL_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
|
@ -3269,7 +3269,7 @@ find_label_symbols (struct linespec_state *self,
|
||||||
{
|
{
|
||||||
set_current_program_space (SYMTAB_PSPACE (symbol_symtab (fn_sym)));
|
set_current_program_space (SYMTAB_PSPACE (symbol_symtab (fn_sym)));
|
||||||
block = SYMBOL_BLOCK_VALUE (fn_sym);
|
block = SYMBOL_BLOCK_VALUE (fn_sym);
|
||||||
sym = lookup_symbol (name, block, LABEL_DOMAIN, 0);
|
sym = lookup_symbol (name, block, LABEL_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
|
|
37
gdb/m2-exp.y
37
gdb/m2-exp.y
|
@ -564,7 +564,7 @@ fblock : BLOCKNAME
|
||||||
{ struct symbol *sym
|
{ struct symbol *sym
|
||||||
= lookup_symbol (copy_name ($1),
|
= lookup_symbol (copy_name ($1),
|
||||||
expression_context_block,
|
expression_context_block,
|
||||||
VAR_DOMAIN, 0);
|
VAR_DOMAIN, 0).symbol;
|
||||||
$$ = sym;}
|
$$ = sym;}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ fblock : BLOCKNAME
|
||||||
fblock : block COLONCOLON BLOCKNAME
|
fblock : block COLONCOLON BLOCKNAME
|
||||||
{ struct symbol *tem
|
{ struct symbol *tem
|
||||||
= lookup_symbol (copy_name ($3), $1,
|
= lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, 0);
|
VAR_DOMAIN, 0).symbol;
|
||||||
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
||||||
error (_("No function \"%s\" in specified context."),
|
error (_("No function \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
|
@ -595,44 +595,45 @@ variable: INTERNAL_VAR
|
||||||
|
|
||||||
/* GDB scope operator */
|
/* GDB scope operator */
|
||||||
variable: block COLONCOLON NAME
|
variable: block COLONCOLON NAME
|
||||||
{ struct symbol *sym;
|
{ struct block_symbol sym
|
||||||
sym = lookup_symbol (copy_name ($3), $1,
|
= lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, 0);
|
VAR_DOMAIN, 0);
|
||||||
if (sym == 0)
|
|
||||||
|
if (sym.symbol == 0)
|
||||||
error (_("No symbol \"%s\" in specified context."),
|
error (_("No symbol \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* block_found is set by lookup_symbol. */
|
write_exp_elt_block (pstate, sym.block);
|
||||||
write_exp_elt_block (pstate, block_found);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_sym (pstate, sym);
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Base case for variables. */
|
/* Base case for variables. */
|
||||||
variable: NAME
|
variable: NAME
|
||||||
{ struct symbol *sym;
|
{ struct block_symbol sym;
|
||||||
struct field_of_this_result is_a_field_of_this;
|
struct field_of_this_result is_a_field_of_this;
|
||||||
|
|
||||||
sym = lookup_symbol (copy_name ($1),
|
sym = lookup_symbol (copy_name ($1),
|
||||||
expression_context_block,
|
expression_context_block,
|
||||||
VAR_DOMAIN,
|
VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this);
|
||||||
if (sym)
|
|
||||||
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found,
|
contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -640,7 +641,7 @@ variable: NAME
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (pstate, NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (pstate, sym);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1028,7 +1029,7 @@ yylex (void)
|
||||||
|
|
||||||
if (lookup_symtab (tmp))
|
if (lookup_symtab (tmp))
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
|
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0).symbol;
|
||||||
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
if (lookup_typename (parse_language (pstate), parse_gdbarch (pstate),
|
if (lookup_typename (parse_language (pstate), parse_gdbarch (pstate),
|
||||||
|
|
|
@ -648,7 +648,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
|
||||||
if (SYMBOL_IS_ARGUMENT (sym))
|
if (SYMBOL_IS_ARGUMENT (sym))
|
||||||
sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
||||||
block, VAR_DOMAIN,
|
block, VAR_DOMAIN,
|
||||||
NULL);
|
NULL).symbol;
|
||||||
else
|
else
|
||||||
sym2 = sym;
|
sym2 = sym;
|
||||||
gdb_assert (sym2 != NULL);
|
gdb_assert (sym2 != NULL);
|
||||||
|
|
|
@ -85,7 +85,7 @@ lookup_struct_typedef (char *name, const struct block *block, int noerr)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0);
|
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1144,7 +1144,8 @@ find_imps (const char *method, VEC (const_char_ptr) **symbol_names)
|
||||||
add the selector itself as a symbol, if it exists. */
|
add the selector itself as a symbol, if it exists. */
|
||||||
if (selector_case && !VEC_empty (const_char_ptr, *symbol_names))
|
if (selector_case && !VEC_empty (const_char_ptr, *symbol_names))
|
||||||
{
|
{
|
||||||
struct symbol *sym = lookup_symbol (selector, NULL, VAR_DOMAIN, 0);
|
struct symbol *sym = lookup_symbol (selector, NULL, VAR_DOMAIN,
|
||||||
|
0).symbol;
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
VEC_safe_push (const_char_ptr, *symbol_names,
|
VEC_safe_push (const_char_ptr, *symbol_names,
|
||||||
|
|
60
gdb/p-exp.y
60
gdb/p-exp.y
|
@ -668,8 +668,8 @@ exp : THIS
|
||||||
|
|
||||||
block : BLOCKNAME
|
block : BLOCKNAME
|
||||||
{
|
{
|
||||||
if ($1.sym != 0)
|
if ($1.sym.symbol != 0)
|
||||||
$$ = SYMBOL_BLOCK_VALUE ($1.sym);
|
$$ = SYMBOL_BLOCK_VALUE ($1.sym.symbol);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct symtab *tem =
|
struct symtab *tem =
|
||||||
|
@ -687,7 +687,8 @@ block : BLOCKNAME
|
||||||
block : block COLONCOLON name
|
block : block COLONCOLON name
|
||||||
{ struct symbol *tem
|
{ struct symbol *tem
|
||||||
= lookup_symbol (copy_name ($3), $1,
|
= lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL).symbol;
|
||||||
|
|
||||||
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
|
||||||
error (_("No function \"%s\" in specified context."),
|
error (_("No function \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
|
@ -695,23 +696,24 @@ block : block COLONCOLON name
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: block COLONCOLON name
|
variable: block COLONCOLON name
|
||||||
{ struct symbol *sym;
|
{ struct block_symbol sym;
|
||||||
|
|
||||||
sym = lookup_symbol (copy_name ($3), $1,
|
sym = lookup_symbol (copy_name ($3), $1,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL);
|
||||||
if (sym == 0)
|
if (sym.symbol == 0)
|
||||||
error (_("No symbol \"%s\" in specified context."),
|
error (_("No symbol \"%s\" in specified context."),
|
||||||
copy_name ($3));
|
copy_name ($3));
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
/* block_found is set by lookup_symbol. */
|
write_exp_elt_block (pstate, sym.block);
|
||||||
write_exp_elt_block (pstate, block_found);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_sym (pstate, sym);
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
|
||||||
;
|
;
|
||||||
|
|
||||||
qualified_name: typebase COLONCOLON name
|
qualified_name: typebase COLONCOLON name
|
||||||
{
|
{
|
||||||
struct type *type = $1;
|
struct type *type = $1;
|
||||||
|
|
||||||
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
|
||||||
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
&& TYPE_CODE (type) != TYPE_CODE_UNION)
|
||||||
error (_("`%s' is not defined as an aggregate type."),
|
error (_("`%s' is not defined as an aggregate type."),
|
||||||
|
@ -733,7 +735,7 @@ variable: qualified_name
|
||||||
|
|
||||||
sym =
|
sym =
|
||||||
lookup_symbol (name, (const struct block *) NULL,
|
lookup_symbol (name, (const struct block *) NULL,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL).symbol;
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -757,16 +759,16 @@ variable: qualified_name
|
||||||
;
|
;
|
||||||
|
|
||||||
variable: name_not_typename
|
variable: name_not_typename
|
||||||
{ struct symbol *sym = $1.sym;
|
{ struct block_symbol sym = $1.sym;
|
||||||
|
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
if (symbol_read_needs_frame (sym))
|
if (symbol_read_needs_frame (sym.symbol))
|
||||||
{
|
{
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
|
@ -774,9 +776,9 @@ variable: name_not_typename
|
||||||
another more inner frame which happens to
|
another more inner frame which happens to
|
||||||
be in the same block. */
|
be in the same block. */
|
||||||
write_exp_elt_block (pstate, NULL);
|
write_exp_elt_block (pstate, NULL);
|
||||||
write_exp_elt_sym (pstate, sym);
|
write_exp_elt_sym (pstate, sym.symbol);
|
||||||
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
|
||||||
current_type = sym->type; }
|
current_type = sym.symbol->type; }
|
||||||
else if ($1.is_a_field_of_this)
|
else if ($1.is_a_field_of_this)
|
||||||
{
|
{
|
||||||
struct value * this_val;
|
struct value * this_val;
|
||||||
|
@ -785,9 +787,9 @@ variable: name_not_typename
|
||||||
not inadvertently convert from a method call
|
not inadvertently convert from a method call
|
||||||
to data ref. */
|
to data ref. */
|
||||||
if (innermost_block == 0
|
if (innermost_block == 0
|
||||||
|| contained_in (block_found,
|
|| contained_in (sym.block,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
innermost_block = block_found;
|
innermost_block = sym.block;
|
||||||
write_exp_elt_opcode (pstate, OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (pstate, OP_THIS);
|
write_exp_elt_opcode (pstate, OP_THIS);
|
||||||
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
|
||||||
|
@ -1508,7 +1510,7 @@ yylex (void)
|
||||||
static const char this_name[] = "this";
|
static const char this_name[] = "this";
|
||||||
|
|
||||||
if (lookup_symbol (this_name, expression_context_block,
|
if (lookup_symbol (this_name, expression_context_block,
|
||||||
VAR_DOMAIN, NULL))
|
VAR_DOMAIN, NULL).symbol)
|
||||||
{
|
{
|
||||||
free (uptokstart);
|
free (uptokstart);
|
||||||
return THIS;
|
return THIS;
|
||||||
|
@ -1558,7 +1560,7 @@ yylex (void)
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
else
|
else
|
||||||
sym = lookup_symbol (tmp, expression_context_block,
|
sym = lookup_symbol (tmp, expression_context_block,
|
||||||
VAR_DOMAIN, &is_a_field_of_this);
|
VAR_DOMAIN, &is_a_field_of_this).symbol;
|
||||||
/* second chance uppercased (as Free Pascal does). */
|
/* second chance uppercased (as Free Pascal does). */
|
||||||
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
|
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
|
||||||
{
|
{
|
||||||
|
@ -1573,7 +1575,7 @@ yylex (void)
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
else
|
else
|
||||||
sym = lookup_symbol (tmp, expression_context_block,
|
sym = lookup_symbol (tmp, expression_context_block,
|
||||||
VAR_DOMAIN, &is_a_field_of_this);
|
VAR_DOMAIN, &is_a_field_of_this).symbol;
|
||||||
}
|
}
|
||||||
/* Third chance Capitalized (as GPC does). */
|
/* Third chance Capitalized (as GPC does). */
|
||||||
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
|
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
|
||||||
|
@ -1595,7 +1597,7 @@ yylex (void)
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
else
|
else
|
||||||
sym = lookup_symbol (tmp, expression_context_block,
|
sym = lookup_symbol (tmp, expression_context_block,
|
||||||
VAR_DOMAIN, &is_a_field_of_this);
|
VAR_DOMAIN, &is_a_field_of_this).symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_a_field || (is_a_field_of_this.type != NULL))
|
if (is_a_field || (is_a_field_of_this.type != NULL))
|
||||||
|
@ -1605,7 +1607,8 @@ yylex (void)
|
||||||
tempbuf [namelen] = 0;
|
tempbuf [namelen] = 0;
|
||||||
yylval.sval.ptr = tempbuf;
|
yylval.sval.ptr = tempbuf;
|
||||||
yylval.sval.length = namelen;
|
yylval.sval.length = namelen;
|
||||||
yylval.ssym.sym = NULL;
|
yylval.ssym.sym.symbol = NULL;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
free (uptokstart);
|
free (uptokstart);
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
if (is_a_field)
|
if (is_a_field)
|
||||||
|
@ -1619,7 +1622,8 @@ yylex (void)
|
||||||
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
|| lookup_symtab (tmp))
|
|| lookup_symtab (tmp))
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym.symbol = sym;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
free (uptokstart);
|
free (uptokstart);
|
||||||
return BLOCKNAME;
|
return BLOCKNAME;
|
||||||
|
@ -1686,7 +1690,7 @@ yylex (void)
|
||||||
memcpy (tmp1, namestart, p - namestart);
|
memcpy (tmp1, namestart, p - namestart);
|
||||||
tmp1[p - namestart] = '\0';
|
tmp1[p - namestart] = '\0';
|
||||||
cur_sym = lookup_symbol (ncopy, expression_context_block,
|
cur_sym = lookup_symbol (ncopy, expression_context_block,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL).symbol;
|
||||||
if (cur_sym)
|
if (cur_sym)
|
||||||
{
|
{
|
||||||
if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
|
if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
|
||||||
|
@ -1734,7 +1738,8 @@ yylex (void)
|
||||||
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
|
||||||
if (hextype == INT)
|
if (hextype == INT)
|
||||||
{
|
{
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym.symbol = sym;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
|
||||||
free (uptokstart);
|
free (uptokstart);
|
||||||
return NAME_OR_INT;
|
return NAME_OR_INT;
|
||||||
|
@ -1743,7 +1748,8 @@ yylex (void)
|
||||||
|
|
||||||
free(uptokstart);
|
free(uptokstart);
|
||||||
/* Any other kind of symbol. */
|
/* Any other kind of symbol. */
|
||||||
yylval.ssym.sym = sym;
|
yylval.ssym.sym.symbol = sym;
|
||||||
|
yylval.ssym.sym.block = NULL;
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
|
||||||
if (msymbol.minsym != NULL)
|
if (msymbol.minsym != NULL)
|
||||||
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME (msymbol.minsym),
|
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME (msymbol.minsym),
|
||||||
block,
|
block,
|
||||||
VAR_DOMAIN, &is_this_fld);
|
VAR_DOMAIN, &is_this_fld).symbol;
|
||||||
|
|
||||||
if (wsym)
|
if (wsym)
|
||||||
{
|
{
|
||||||
|
|
|
@ -615,7 +615,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
|
||||||
void
|
void
|
||||||
write_dollar_variable (struct parser_state *ps, struct stoken str)
|
write_dollar_variable (struct parser_state *ps, struct stoken str)
|
||||||
{
|
{
|
||||||
struct symbol *sym = NULL;
|
struct block_symbol sym;
|
||||||
struct bound_minimal_symbol msym;
|
struct bound_minimal_symbol msym;
|
||||||
struct internalvar *isym = NULL;
|
struct internalvar *isym = NULL;
|
||||||
|
|
||||||
|
@ -672,11 +672,11 @@ write_dollar_variable (struct parser_state *ps, struct stoken str)
|
||||||
|
|
||||||
sym = lookup_symbol (copy_name (str), (struct block *) NULL,
|
sym = lookup_symbol (copy_name (str), (struct block *) NULL,
|
||||||
VAR_DOMAIN, NULL);
|
VAR_DOMAIN, NULL);
|
||||||
if (sym)
|
if (sym.symbol)
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
write_exp_elt_block (ps, block_found); /* set by lookup_symbol */
|
write_exp_elt_block (ps, sym.block);
|
||||||
write_exp_elt_sym (ps, sym);
|
write_exp_elt_sym (ps, sym.symbol);
|
||||||
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
write_exp_elt_opcode (ps, OP_VAR_VALUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ struct ttype
|
||||||
struct symtoken
|
struct symtoken
|
||||||
{
|
{
|
||||||
struct stoken stoken;
|
struct stoken stoken;
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
int is_a_field_of_this;
|
int is_a_field_of_this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1208,7 +1208,7 @@ address_info (char *exp, int from_tty)
|
||||||
error (_("Argument required."));
|
error (_("Argument required."));
|
||||||
|
|
||||||
sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
|
sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
|
||||||
&is_a_field_of_this);
|
&is_a_field_of_this).symbol;
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
if (is_a_field_of_this.type != NULL)
|
if (is_a_field_of_this.type != NULL)
|
||||||
|
|
|
@ -540,7 +540,7 @@ frapy_read_var (PyObject *self, PyObject *args)
|
||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
block = get_frame_block (frame, NULL);
|
block = get_frame_block (frame, NULL);
|
||||||
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
|
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL).symbol;
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -396,7 +396,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
|
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
|
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this).symbol;
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +449,7 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
|
|
||||||
TRY
|
TRY
|
||||||
{
|
{
|
||||||
symbol = lookup_global_symbol (name, NULL, domain);
|
symbol = lookup_global_symbol (name, NULL, domain).symbol;
|
||||||
}
|
}
|
||||||
CATCH (except, RETURN_MASK_ALL)
|
CATCH (except, RETURN_MASK_ALL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,7 +131,7 @@ skip_function_command (char *arg, int from_tty)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lookup_symbol (arg, NULL, VAR_DOMAIN, NULL) == NULL)
|
if (lookup_symbol (arg, NULL, VAR_DOMAIN, NULL).symbol == NULL)
|
||||||
{
|
{
|
||||||
fprintf_filtered (gdb_stderr,
|
fprintf_filtered (gdb_stderr,
|
||||||
_("No function found named %s.\n"), arg);
|
_("No function found named %s.\n"), arg);
|
||||||
|
|
|
@ -569,12 +569,12 @@ darwin_relocate_section_addresses (struct so_list *so,
|
||||||
so->addr_low = sec->addr;
|
so->addr_low = sec->addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
darwin_lookup_lib_symbol (struct objfile *objfile,
|
darwin_lookup_lib_symbol (struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
static bfd *
|
static bfd *
|
||||||
|
|
|
@ -389,7 +389,7 @@ spu_bfd_open (char *pathname)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup global symbol in a SPE executable. */
|
/* Lookup global symbol in a SPE executable. */
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
spu_lookup_lib_symbol (struct objfile *objfile,
|
spu_lookup_lib_symbol (struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
|
@ -399,7 +399,7 @@ spu_lookup_lib_symbol (struct objfile *objfile,
|
||||||
|
|
||||||
if (svr4_so_ops.lookup_lib_global_symbol != NULL)
|
if (svr4_so_ops.lookup_lib_global_symbol != NULL)
|
||||||
return svr4_so_ops.lookup_lib_global_symbol (objfile, name, domain);
|
return svr4_so_ops.lookup_lib_global_symbol (objfile, name, domain);
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable shared library breakpoint. */
|
/* Enable shared library breakpoint. */
|
||||||
|
|
|
@ -3211,7 +3211,7 @@ struct target_so_ops svr4_so_ops;
|
||||||
different rule for symbol lookup. The lookup begins here in the DSO, not in
|
different rule for symbol lookup. The lookup begins here in the DSO, not in
|
||||||
the main executable. */
|
the main executable. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
elf_lookup_lib_symbol (struct objfile *objfile,
|
elf_lookup_lib_symbol (struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
|
@ -3229,7 +3229,7 @@ elf_lookup_lib_symbol (struct objfile *objfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
|
if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
return lookup_global_symbol_from_objfile (objfile, name, domain);
|
return lookup_global_symbol_from_objfile (objfile, name, domain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1511,7 +1511,7 @@ show_auto_solib_add (struct ui_file *file, int from_tty,
|
||||||
/* Handler for library-specific lookup of global symbol NAME in OBJFILE. Call
|
/* Handler for library-specific lookup of global symbol NAME in OBJFILE. Call
|
||||||
the library-specific handler if it is installed for the current target. */
|
the library-specific handler if it is installed for the current target. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
solib_global_lookup (struct objfile *objfile,
|
solib_global_lookup (struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
|
@ -1520,7 +1520,7 @@ solib_global_lookup (struct objfile *objfile,
|
||||||
|
|
||||||
if (ops->lookup_lib_global_symbol != NULL)
|
if (ops->lookup_lib_global_symbol != NULL)
|
||||||
return ops->lookup_lib_global_symbol (objfile, name, domain);
|
return ops->lookup_lib_global_symbol (objfile, name, domain);
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the value for a specific symbol from dynamic symbol table. Look
|
/* Lookup the value for a specific symbol from dynamic symbol table. Look
|
||||||
|
|
|
@ -137,7 +137,8 @@ struct target_so_ops
|
||||||
unsigned o_flags, char **temp_pathname);
|
unsigned o_flags, char **temp_pathname);
|
||||||
|
|
||||||
/* Hook for looking up global symbols in a library-specific way. */
|
/* Hook for looking up global symbols in a library-specific way. */
|
||||||
struct symbol * (*lookup_lib_global_symbol) (struct objfile *objfile,
|
struct block_symbol (*lookup_lib_global_symbol)
|
||||||
|
(struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ extern bfd *solib_bfd_open (char *in_pathname);
|
||||||
extern struct target_so_ops *current_target_so_ops;
|
extern struct target_so_ops *current_target_so_ops;
|
||||||
|
|
||||||
/* Handler for library-specific global symbol lookup in solib.c. */
|
/* Handler for library-specific global symbol lookup in solib.c. */
|
||||||
struct symbol *solib_global_lookup (struct objfile *objfile,
|
struct block_symbol solib_global_lookup (struct objfile *objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ select_source_symtab (struct symtab *s)
|
||||||
|
|
||||||
/* Make the default place to list be the function `main'
|
/* Make the default place to list be the function `main'
|
||||||
if one exists. */
|
if one exists. */
|
||||||
if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0))
|
if (lookup_symbol (main_name (), 0, VAR_DOMAIN, 0).symbol)
|
||||||
{
|
{
|
||||||
sals = decode_line_with_current_source (main_name (),
|
sals = decode_line_with_current_source (main_name (),
|
||||||
DECODE_LINE_FUNFIRSTLINE);
|
DECODE_LINE_FUNFIRSTLINE);
|
||||||
|
|
|
@ -621,7 +621,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
|
||||||
struct symbol *nsym;
|
struct symbol *nsym;
|
||||||
|
|
||||||
nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
||||||
b, VAR_DOMAIN, NULL);
|
b, VAR_DOMAIN, NULL).symbol;
|
||||||
gdb_assert (nsym != NULL);
|
gdb_assert (nsym != NULL);
|
||||||
if (SYMBOL_CLASS (nsym) == LOC_REGISTER
|
if (SYMBOL_CLASS (nsym) == LOC_REGISTER
|
||||||
&& !SYMBOL_IS_ARGUMENT (nsym))
|
&& !SYMBOL_IS_ARGUMENT (nsym))
|
||||||
|
@ -2156,7 +2156,7 @@ iterate_over_block_arg_vars (const struct block *b,
|
||||||
are not combined in symbol-reading. */
|
are not combined in symbol-reading. */
|
||||||
|
|
||||||
sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
|
||||||
b, VAR_DOMAIN, NULL);
|
b, VAR_DOMAIN, NULL).symbol;
|
||||||
(*cb) (SYMBOL_PRINT_NAME (sym), sym2, cb_data);
|
(*cb) (SYMBOL_PRINT_NAME (sym), sym2, cb_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1696,7 +1696,7 @@ set_initial_language (void)
|
||||||
if (lang == language_unknown)
|
if (lang == language_unknown)
|
||||||
{
|
{
|
||||||
char *name = main_name ();
|
char *name = main_name ();
|
||||||
struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL);
|
struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol;
|
||||||
|
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
lang = SYMBOL_LANGUAGE (sym);
|
lang = SYMBOL_LANGUAGE (sym);
|
||||||
|
|
280
gdb/symtab.c
280
gdb/symtab.c
|
@ -68,19 +68,20 @@ static void rbreak_command (char *, int);
|
||||||
|
|
||||||
static int find_line_common (struct linetable *, int, int *, int);
|
static int find_line_common (struct linetable *, int, int *, int);
|
||||||
|
|
||||||
static struct symbol *lookup_symbol_aux (const char *name,
|
static struct block_symbol
|
||||||
|
lookup_symbol_aux (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain,
|
const domain_enum domain,
|
||||||
enum language language,
|
enum language language,
|
||||||
struct field_of_this_result *);
|
struct field_of_this_result *);
|
||||||
|
|
||||||
static
|
static
|
||||||
struct symbol *lookup_local_symbol (const char *name,
|
struct block_symbol lookup_local_symbol (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain,
|
const domain_enum domain,
|
||||||
enum language language);
|
enum language language);
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
||||||
const char *name, const domain_enum domain);
|
const char *name, const domain_enum domain);
|
||||||
|
|
||||||
|
@ -121,7 +122,9 @@ static const struct program_space_data *symbol_cache_key;
|
||||||
|
|
||||||
/* symbol_cache_lookup returns this if a previous lookup failed to find the
|
/* symbol_cache_lookup returns this if a previous lookup failed to find the
|
||||||
symbol in any objfile. */
|
symbol in any objfile. */
|
||||||
#define SYMBOL_LOOKUP_FAILED ((struct symbol *) 1)
|
#define SYMBOL_LOOKUP_FAILED \
|
||||||
|
((struct block_symbol) {(struct symbol *) 1, NULL})
|
||||||
|
#define SYMBOL_LOOKUP_FAILED_P(SIB) (SIB.symbol == (struct symbol *) 1)
|
||||||
|
|
||||||
/* Recording lookups that don't find the symbol is just as important, if not
|
/* Recording lookups that don't find the symbol is just as important, if not
|
||||||
more so, than recording found symbols. */
|
more so, than recording found symbols. */
|
||||||
|
@ -157,7 +160,7 @@ struct symbol_cache_slot
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct symbol *found;
|
struct block_symbol found;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -243,12 +246,6 @@ multiple_symbols_select_mode (void)
|
||||||
return multiple_symbols_mode;
|
return multiple_symbols_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Block in which the most recently searched-for symbol was found.
|
|
||||||
Might be better to make this a parameter to lookup_symbol and
|
|
||||||
value_of_this. */
|
|
||||||
|
|
||||||
const struct block *block_found;
|
|
||||||
|
|
||||||
/* Return the name of a domain_enum. */
|
/* Return the name of a domain_enum. */
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -1208,8 +1205,8 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
slot_name = SYMBOL_SEARCH_NAME (slot->value.found);
|
slot_name = SYMBOL_SEARCH_NAME (slot->value.found.symbol);
|
||||||
slot_domain = SYMBOL_DOMAIN (slot->value.found);
|
slot_domain = SYMBOL_DOMAIN (slot->value.found.symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NULL names match. */
|
/* NULL names match. */
|
||||||
|
@ -1240,7 +1237,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct symbol *sym = slot->value.found;
|
struct symbol *sym = slot->value.found.symbol;
|
||||||
|
|
||||||
if (strcmp_iw (slot_name, name) != 0)
|
if (strcmp_iw (slot_name, name) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1398,7 +1395,7 @@ set_symbol_cache_size_handler (char *args, int from_tty,
|
||||||
set to the cache and slot of the symbol to save the result of a full lookup
|
set to the cache and slot of the symbol to save the result of a full lookup
|
||||||
attempt. */
|
attempt. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
symbol_cache_lookup (struct symbol_cache *cache,
|
symbol_cache_lookup (struct symbol_cache *cache,
|
||||||
struct objfile *objfile_context, int block,
|
struct objfile *objfile_context, int block,
|
||||||
const char *name, domain_enum domain,
|
const char *name, domain_enum domain,
|
||||||
|
@ -1417,7 +1414,7 @@ symbol_cache_lookup (struct symbol_cache *cache,
|
||||||
{
|
{
|
||||||
*bsc_ptr = NULL;
|
*bsc_ptr = NULL;
|
||||||
*slot_ptr = NULL;
|
*slot_ptr = NULL;
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = hash_symbol_entry (objfile_context, name, domain);
|
hash = hash_symbol_entry (objfile_context, name, domain);
|
||||||
|
@ -1451,7 +1448,7 @@ symbol_cache_lookup (struct symbol_cache *cache,
|
||||||
name, domain_name (domain));
|
name, domain_name (domain));
|
||||||
}
|
}
|
||||||
++bsc->misses;
|
++bsc->misses;
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear out SLOT. */
|
/* Clear out SLOT. */
|
||||||
|
@ -1473,7 +1470,8 @@ static void
|
||||||
symbol_cache_mark_found (struct block_symbol_cache *bsc,
|
symbol_cache_mark_found (struct block_symbol_cache *bsc,
|
||||||
struct symbol_cache_slot *slot,
|
struct symbol_cache_slot *slot,
|
||||||
struct objfile *objfile_context,
|
struct objfile *objfile_context,
|
||||||
struct symbol *symbol)
|
struct symbol *symbol,
|
||||||
|
const struct block *block)
|
||||||
{
|
{
|
||||||
if (bsc == NULL)
|
if (bsc == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1484,7 +1482,8 @@ symbol_cache_mark_found (struct block_symbol_cache *bsc,
|
||||||
}
|
}
|
||||||
slot->state = SYMBOL_SLOT_FOUND;
|
slot->state = SYMBOL_SLOT_FOUND;
|
||||||
slot->objfile_context = objfile_context;
|
slot->objfile_context = objfile_context;
|
||||||
slot->value.found = symbol;
|
slot->value.found.symbol = symbol;
|
||||||
|
slot->value.found.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark symbol NAME, DOMAIN as not found in SLOT.
|
/* Mark symbol NAME, DOMAIN as not found in SLOT.
|
||||||
|
@ -1597,14 +1596,19 @@ symbol_cache_dump (const struct symbol_cache *cache)
|
||||||
domain_name (slot->value.not_found.domain));
|
domain_name (slot->value.not_found.domain));
|
||||||
break;
|
break;
|
||||||
case SYMBOL_SLOT_FOUND:
|
case SYMBOL_SLOT_FOUND:
|
||||||
|
{
|
||||||
|
struct symbol *found = slot->value.found.symbol;
|
||||||
|
const struct objfile *context = slot->objfile_context;
|
||||||
|
|
||||||
printf_filtered (" [%4u] = %s, %s %s\n", i,
|
printf_filtered (" [%4u] = %s, %s %s\n", i,
|
||||||
host_address_to_string (slot->objfile_context),
|
host_address_to_string (context),
|
||||||
SYMBOL_PRINT_NAME (slot->value.found),
|
SYMBOL_PRINT_NAME (found),
|
||||||
domain_name (SYMBOL_DOMAIN (slot->value.found)));
|
domain_name (SYMBOL_DOMAIN (found)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The "mt print symbol-cache" command. */
|
/* The "mt print symbol-cache" command. */
|
||||||
|
@ -1945,13 +1949,13 @@ demangle_for_lookup (const char *name, enum language lang,
|
||||||
variable and thus can probably assume it will never hit the C++
|
variable and thus can probably assume it will never hit the C++
|
||||||
code). */
|
code). */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_symbol_in_language (const char *name, const struct block *block,
|
lookup_symbol_in_language (const char *name, const struct block *block,
|
||||||
const domain_enum domain, enum language lang,
|
const domain_enum domain, enum language lang,
|
||||||
struct field_of_this_result *is_a_field_of_this)
|
struct field_of_this_result *is_a_field_of_this)
|
||||||
{
|
{
|
||||||
const char *modified_name;
|
const char *modified_name;
|
||||||
struct symbol *returnval;
|
struct block_symbol returnval;
|
||||||
struct cleanup *cleanup = demangle_for_lookup (name, lang, &modified_name);
|
struct cleanup *cleanup = demangle_for_lookup (name, lang, &modified_name);
|
||||||
|
|
||||||
returnval = lookup_symbol_aux (modified_name, block, domain, lang,
|
returnval = lookup_symbol_aux (modified_name, block, domain, lang,
|
||||||
|
@ -1963,7 +1967,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_symbol (const char *name, const struct block *block,
|
lookup_symbol (const char *name, const struct block *block,
|
||||||
domain_enum domain,
|
domain_enum domain,
|
||||||
struct field_of_this_result *is_a_field_of_this)
|
struct field_of_this_result *is_a_field_of_this)
|
||||||
|
@ -1975,12 +1979,12 @@ lookup_symbol (const char *name, const struct block *block,
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_language_this (const struct language_defn *lang,
|
lookup_language_this (const struct language_defn *lang,
|
||||||
const struct block *block)
|
const struct block *block)
|
||||||
{
|
{
|
||||||
if (lang->la_name_of_this == NULL || block == NULL)
|
if (lang->la_name_of_this == NULL || block == NULL)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
{
|
{
|
||||||
|
@ -2006,8 +2010,7 @@ lookup_language_this (const struct language_defn *lang,
|
||||||
host_address_to_string (sym),
|
host_address_to_string (sym),
|
||||||
host_address_to_string (block));
|
host_address_to_string (block));
|
||||||
}
|
}
|
||||||
block_found = block;
|
return (struct block_symbol) {sym, block};
|
||||||
return sym;
|
|
||||||
}
|
}
|
||||||
if (BLOCK_FUNCTION (block))
|
if (BLOCK_FUNCTION (block))
|
||||||
break;
|
break;
|
||||||
|
@ -2016,7 +2019,7 @@ lookup_language_this (const struct language_defn *lang,
|
||||||
|
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
fprintf_unfiltered (gdb_stdlog, " = NULL\n");
|
fprintf_unfiltered (gdb_stdlog, " = NULL\n");
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given TYPE, a structure/union,
|
/* Given TYPE, a structure/union,
|
||||||
|
@ -2067,12 +2070,12 @@ check_field (struct type *type, const char *name,
|
||||||
/* Behave like lookup_symbol except that NAME is the natural name
|
/* Behave like lookup_symbol except that NAME is the natural name
|
||||||
(e.g., demangled name) of the symbol that we're looking for. */
|
(e.g., demangled name) of the symbol that we're looking for. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_aux (const char *name, const struct block *block,
|
lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
const domain_enum domain, enum language language,
|
const domain_enum domain, enum language language,
|
||||||
struct field_of_this_result *is_a_field_of_this)
|
struct field_of_this_result *is_a_field_of_this)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
const struct language_defn *langdef;
|
const struct language_defn *langdef;
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
|
@ -2087,13 +2090,6 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
domain_name (domain), language_str (language));
|
domain_name (domain), language_str (language));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize block_found so that the language la_lookup_symbol_nonlocal
|
|
||||||
routines don't have to set it (to NULL) if a primitive type is found.
|
|
||||||
We do this early so that block_found is also NULL if no symbol is
|
|
||||||
found (though this is not part of the API, and callers cannot assume
|
|
||||||
this). */
|
|
||||||
block_found = NULL;
|
|
||||||
|
|
||||||
/* Make sure we do something sensible with is_a_field_of_this, since
|
/* Make sure we do something sensible with is_a_field_of_this, since
|
||||||
the callers that set this parameter to some non-null value will
|
the callers that set this parameter to some non-null value will
|
||||||
certainly use it later. If we don't set it, the contents of
|
certainly use it later. If we don't set it, the contents of
|
||||||
|
@ -2104,15 +2100,15 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
/* Search specified block and its superiors. Don't search
|
/* Search specified block and its superiors. Don't search
|
||||||
STATIC_BLOCK or GLOBAL_BLOCK. */
|
STATIC_BLOCK or GLOBAL_BLOCK. */
|
||||||
|
|
||||||
sym = lookup_local_symbol (name, block, domain, language);
|
result = lookup_local_symbol (name, block, domain, language);
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
||||||
host_address_to_string (sym));
|
host_address_to_string (result.symbol));
|
||||||
}
|
}
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If requested to do so by the caller and if appropriate for LANGUAGE,
|
/* If requested to do so by the caller and if appropriate for LANGUAGE,
|
||||||
|
@ -2125,11 +2121,11 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
means. */
|
means. */
|
||||||
if (is_a_field_of_this != NULL && domain != STRUCT_DOMAIN)
|
if (is_a_field_of_this != NULL && domain != STRUCT_DOMAIN)
|
||||||
{
|
{
|
||||||
struct symbol *sym = lookup_language_this (langdef, block);
|
result = lookup_language_this (langdef, block);
|
||||||
|
|
||||||
if (sym)
|
if (result.symbol)
|
||||||
{
|
{
|
||||||
struct type *t = sym->type;
|
struct type *t = result.symbol->type;
|
||||||
|
|
||||||
/* I'm not really sure that type of this can ever
|
/* I'm not really sure that type of this can ever
|
||||||
be typedefed; just be safe. */
|
be typedefed; just be safe. */
|
||||||
|
@ -2150,7 +2146,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"lookup_symbol_aux (...) = NULL\n");
|
"lookup_symbol_aux (...) = NULL\n");
|
||||||
}
|
}
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2158,33 +2154,35 @@ lookup_symbol_aux (const char *name, const struct block *block,
|
||||||
/* Now do whatever is appropriate for LANGUAGE to look
|
/* Now do whatever is appropriate for LANGUAGE to look
|
||||||
up static and global variables. */
|
up static and global variables. */
|
||||||
|
|
||||||
sym = langdef->la_lookup_symbol_nonlocal (langdef, name, block, domain);
|
result = langdef->la_lookup_symbol_nonlocal (langdef, name, block, domain);
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
||||||
host_address_to_string (sym));
|
host_address_to_string (result.symbol));
|
||||||
}
|
}
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now search all static file-level symbols. Not strictly correct,
|
/* Now search all static file-level symbols. Not strictly correct,
|
||||||
but more useful than an error. */
|
but more useful than an error. */
|
||||||
|
|
||||||
sym = lookup_static_symbol (name, domain);
|
result = lookup_static_symbol (name, domain);
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
fprintf_unfiltered (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
|
||||||
sym != NULL ? host_address_to_string (sym) : "NULL");
|
result.symbol != NULL
|
||||||
|
? host_address_to_string (result.symbol)
|
||||||
|
: "NULL");
|
||||||
}
|
}
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if the symbol is defined in BLOCK or its superiors.
|
/* Check to see if the symbol is defined in BLOCK or its superiors.
|
||||||
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
|
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_local_symbol (const char *name, const struct block *block,
|
lookup_local_symbol (const char *name, const struct block *block,
|
||||||
const domain_enum domain,
|
const domain_enum domain,
|
||||||
enum language language)
|
enum language language)
|
||||||
|
@ -2196,19 +2194,21 @@ lookup_local_symbol (const char *name, const struct block *block,
|
||||||
/* Check if either no block is specified or it's a global block. */
|
/* Check if either no block is specified or it's a global block. */
|
||||||
|
|
||||||
if (static_block == NULL)
|
if (static_block == NULL)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
while (block != static_block)
|
while (block != static_block)
|
||||||
{
|
{
|
||||||
sym = lookup_symbol_in_block (name, block, domain);
|
sym = lookup_symbol_in_block (name, block, domain);
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
return sym;
|
return (struct block_symbol) {sym, block};
|
||||||
|
|
||||||
if (language == language_cplus || language == language_fortran)
|
if (language == language_cplus || language == language_fortran)
|
||||||
{
|
{
|
||||||
sym = cp_lookup_symbol_imports_or_template (scope, name, block,
|
struct block_symbol sym
|
||||||
|
= cp_lookup_symbol_imports_or_template (scope, name, block,
|
||||||
domain);
|
domain);
|
||||||
if (sym != NULL)
|
|
||||||
|
if (sym.symbol != NULL)
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2219,7 +2219,7 @@ lookup_local_symbol (const char *name, const struct block *block,
|
||||||
|
|
||||||
/* We've reached the end of the function without finding a result. */
|
/* We've reached the end of the function without finding a result. */
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
@ -2275,7 +2275,6 @@ lookup_symbol_in_block (const char *name, const struct block *block,
|
||||||
fprintf_unfiltered (gdb_stdlog, " = %s\n",
|
fprintf_unfiltered (gdb_stdlog, " = %s\n",
|
||||||
host_address_to_string (sym));
|
host_address_to_string (sym));
|
||||||
}
|
}
|
||||||
block_found = block;
|
|
||||||
return fixup_symbol_section (sym, NULL);
|
return fixup_symbol_section (sym, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2286,7 +2285,7 @@ lookup_symbol_in_block (const char *name, const struct block *block,
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
|
@ -2297,14 +2296,14 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
||||||
objfile;
|
objfile;
|
||||||
objfile = objfile_separate_debug_iterate (main_objfile, objfile))
|
objfile = objfile_separate_debug_iterate (main_objfile, objfile))
|
||||||
{
|
{
|
||||||
struct symbol *sym = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK,
|
struct block_symbol result
|
||||||
name, domain);
|
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
|
||||||
|
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if the symbol is defined in one of the OBJFILE's
|
/* Check to see if the symbol is defined in one of the OBJFILE's
|
||||||
|
@ -2312,7 +2311,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
||||||
depending on whether or not we want to search global symbols or
|
depending on whether or not we want to search global symbols or
|
||||||
static symbols. */
|
static symbols. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
|
lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
|
||||||
const char *name, const domain_enum domain)
|
const char *name, const domain_enum domain)
|
||||||
{
|
{
|
||||||
|
@ -2334,27 +2333,29 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
|
||||||
{
|
{
|
||||||
const struct blockvector *bv;
|
const struct blockvector *bv;
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
|
|
||||||
bv = COMPUNIT_BLOCKVECTOR (cust);
|
bv = COMPUNIT_BLOCKVECTOR (cust);
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
||||||
sym = block_lookup_symbol_primary (block, name, domain);
|
result.symbol = block_lookup_symbol_primary (block, name, domain);
|
||||||
if (sym)
|
result.block = block;
|
||||||
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, " = %s (block %s)\n",
|
fprintf_unfiltered (gdb_stdlog, " = %s (block %s)\n",
|
||||||
host_address_to_string (sym),
|
host_address_to_string (result.symbol),
|
||||||
host_address_to_string (block));
|
host_address_to_string (block));
|
||||||
}
|
}
|
||||||
block_found = block;
|
result.symbol = fixup_symbol_section (result.symbol, objfile);
|
||||||
return fixup_symbol_section (sym, objfile);
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
fprintf_unfiltered (gdb_stdlog, " = NULL\n");
|
fprintf_unfiltered (gdb_stdlog, " = NULL\n");
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper around lookup_symbol_in_objfile_symtabs for search_symbols.
|
/* Wrapper around lookup_symbol_in_objfile_symtabs for search_symbols.
|
||||||
|
@ -2366,7 +2367,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
|
||||||
different. Here we're called from search_symbols where it will only
|
different. Here we're called from search_symbols where it will only
|
||||||
call us for the the objfile that contains a matching minsym. */
|
call us for the the objfile that contains a matching minsym. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
|
lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
|
||||||
const char *linkage_name,
|
const char *linkage_name,
|
||||||
domain_enum domain)
|
domain_enum domain)
|
||||||
|
@ -2386,22 +2387,22 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
|
||||||
cur_objfile;
|
cur_objfile;
|
||||||
cur_objfile = objfile_separate_debug_iterate (main_objfile, cur_objfile))
|
cur_objfile = objfile_separate_debug_iterate (main_objfile, cur_objfile))
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
|
|
||||||
sym = lookup_symbol_in_objfile_symtabs (cur_objfile, GLOBAL_BLOCK,
|
result = lookup_symbol_in_objfile_symtabs (cur_objfile, GLOBAL_BLOCK,
|
||||||
modified_name, domain);
|
modified_name, domain);
|
||||||
if (sym == NULL)
|
if (result.symbol == NULL)
|
||||||
sym = lookup_symbol_in_objfile_symtabs (cur_objfile, STATIC_BLOCK,
|
result = lookup_symbol_in_objfile_symtabs (cur_objfile, STATIC_BLOCK,
|
||||||
modified_name, domain);
|
modified_name, domain);
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A helper function that throws an exception when a symbol was found
|
/* A helper function that throws an exception when a symbol was found
|
||||||
|
@ -2424,17 +2425,17 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
|
||||||
/* A helper function for various lookup routines that interfaces with
|
/* A helper function for various lookup routines that interfaces with
|
||||||
the "quick" symbol table functions. */
|
the "quick" symbol table functions. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
|
lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
|
||||||
const char *name, const domain_enum domain)
|
const char *name, const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct compunit_symtab *cust;
|
struct compunit_symtab *cust;
|
||||||
const struct blockvector *bv;
|
const struct blockvector *bv;
|
||||||
const struct block *block;
|
const struct block *block;
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
|
|
||||||
if (!objfile->sf)
|
if (!objfile->sf)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
{
|
{
|
||||||
|
@ -2454,36 +2455,37 @@ lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"lookup_symbol_via_quick_fns (...) = NULL\n");
|
"lookup_symbol_via_quick_fns (...) = NULL\n");
|
||||||
}
|
}
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
bv = COMPUNIT_BLOCKVECTOR (cust);
|
bv = COMPUNIT_BLOCKVECTOR (cust);
|
||||||
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
block = BLOCKVECTOR_BLOCK (bv, block_index);
|
||||||
sym = block_lookup_symbol (block, name, domain);
|
result.symbol = block_lookup_symbol (block, name, domain);
|
||||||
if (!sym)
|
if (result.symbol == NULL)
|
||||||
error_in_psymtab_expansion (block_index, name, cust);
|
error_in_psymtab_expansion (block_index, name, cust);
|
||||||
|
|
||||||
if (symbol_lookup_debug > 1)
|
if (symbol_lookup_debug > 1)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"lookup_symbol_via_quick_fns (...) = %s (block %s)\n",
|
"lookup_symbol_via_quick_fns (...) = %s (block %s)\n",
|
||||||
host_address_to_string (sym),
|
host_address_to_string (result.symbol),
|
||||||
host_address_to_string (block));
|
host_address_to_string (block));
|
||||||
}
|
}
|
||||||
|
|
||||||
block_found = block;
|
result.symbol = fixup_symbol_section (result.symbol, objfile);
|
||||||
return fixup_symbol_section (sym, objfile);
|
result.block = block;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
const char *name,
|
const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
|
|
||||||
/* NOTE: carlton/2003-05-19: The comments below were written when
|
/* NOTE: carlton/2003-05-19: The comments below were written when
|
||||||
this (or what turned into this) was part of lookup_symbol_aux;
|
this (or what turned into this) was part of lookup_symbol_aux;
|
||||||
|
@ -2517,9 +2519,9 @@ basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
the current objfile. Searching the current objfile first is useful
|
the current objfile. Searching the current objfile first is useful
|
||||||
for both matching user expectations as well as performance. */
|
for both matching user expectations as well as performance. */
|
||||||
|
|
||||||
sym = lookup_symbol_in_static_block (name, block, domain);
|
result = lookup_symbol_in_static_block (name, block, domain);
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
return sym;
|
return result;
|
||||||
|
|
||||||
/* If we didn't find a definition for a builtin type in the static block,
|
/* If we didn't find a definition for a builtin type in the static block,
|
||||||
search for it now. This is actually the right thing to do and can be
|
search for it now. This is actually the right thing to do and can be
|
||||||
|
@ -2535,9 +2537,11 @@ basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
gdbarch = target_gdbarch ();
|
gdbarch = target_gdbarch ();
|
||||||
else
|
else
|
||||||
gdbarch = block_gdbarch (block);
|
gdbarch = block_gdbarch (block);
|
||||||
sym = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name);
|
result.symbol = language_lookup_primitive_type_as_symbol (langdef,
|
||||||
if (sym != NULL)
|
gdbarch, name);
|
||||||
return sym;
|
result.block = NULL;
|
||||||
|
if (result.symbol != NULL)
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lookup_global_symbol (name, block, domain);
|
return lookup_global_symbol (name, block, domain);
|
||||||
|
@ -2545,7 +2549,7 @@ basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_symbol_in_static_block (const char *name,
|
lookup_symbol_in_static_block (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
|
@ -2554,7 +2558,7 @@ lookup_symbol_in_static_block (const char *name,
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
if (static_block == NULL)
|
if (static_block == NULL)
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
|
@ -2576,7 +2580,7 @@ lookup_symbol_in_static_block (const char *name,
|
||||||
"lookup_symbol_in_static_block (...) = %s\n",
|
"lookup_symbol_in_static_block (...) = %s\n",
|
||||||
sym != NULL ? host_address_to_string (sym) : "NULL");
|
sym != NULL ? host_address_to_string (sym) : "NULL");
|
||||||
}
|
}
|
||||||
return sym;
|
return (struct block_symbol) {sym, static_block};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform the standard symbol lookup of NAME in OBJFILE:
|
/* Perform the standard symbol lookup of NAME in OBJFILE:
|
||||||
|
@ -2584,11 +2588,11 @@ lookup_symbol_in_static_block (const char *name,
|
||||||
2) Search the "quick" symtabs (partial or .gdb_index).
|
2) Search the "quick" symtabs (partial or .gdb_index).
|
||||||
BLOCK_INDEX is one of GLOBAL_BLOCK or STATIC_BLOCK. */
|
BLOCK_INDEX is one of GLOBAL_BLOCK or STATIC_BLOCK. */
|
||||||
|
|
||||||
static struct symbol *
|
static struct block_symbol
|
||||||
lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
||||||
const char *name, const domain_enum domain)
|
const char *name, const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol *result;
|
struct block_symbol result;
|
||||||
|
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
|
@ -2602,14 +2606,14 @@ lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
||||||
|
|
||||||
result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
|
result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
|
||||||
name, domain);
|
name, domain);
|
||||||
if (result != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (symbol_lookup_debug)
|
if (symbol_lookup_debug)
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"lookup_symbol_in_objfile (...) = %s"
|
"lookup_symbol_in_objfile (...) = %s"
|
||||||
" (in symtabs)\n",
|
" (in symtabs)\n",
|
||||||
host_address_to_string (result));
|
host_address_to_string (result.symbol));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2620,22 +2624,22 @@ lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
"lookup_symbol_in_objfile (...) = %s%s\n",
|
"lookup_symbol_in_objfile (...) = %s%s\n",
|
||||||
result != NULL
|
result.symbol != NULL
|
||||||
? host_address_to_string (result)
|
? host_address_to_string (result.symbol)
|
||||||
: "NULL",
|
: "NULL",
|
||||||
result != NULL ? " (via quick fns)" : "");
|
result.symbol != NULL ? " (via quick fns)" : "");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_static_symbol (const char *name, const domain_enum domain)
|
lookup_static_symbol (const char *name, const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol_cache *cache = get_symbol_cache (current_program_space);
|
struct symbol_cache *cache = get_symbol_cache (current_program_space);
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct symbol *result;
|
struct block_symbol result;
|
||||||
struct block_symbol_cache *bsc;
|
struct block_symbol_cache *bsc;
|
||||||
struct symbol_cache_slot *slot;
|
struct symbol_cache_slot *slot;
|
||||||
|
|
||||||
|
@ -2643,27 +2647,28 @@ lookup_static_symbol (const char *name, const domain_enum domain)
|
||||||
NULL for OBJFILE_CONTEXT. */
|
NULL for OBJFILE_CONTEXT. */
|
||||||
result = symbol_cache_lookup (cache, NULL, STATIC_BLOCK, name, domain,
|
result = symbol_cache_lookup (cache, NULL, STATIC_BLOCK, name, domain,
|
||||||
&bsc, &slot);
|
&bsc, &slot);
|
||||||
if (result != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (result == SYMBOL_LOOKUP_FAILED)
|
if (SYMBOL_LOOKUP_FAILED_P (result))
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL_OBJFILES (objfile)
|
ALL_OBJFILES (objfile)
|
||||||
{
|
{
|
||||||
result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain);
|
result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain);
|
||||||
if (result != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
/* Still pass NULL for OBJFILE_CONTEXT here. */
|
/* Still pass NULL for OBJFILE_CONTEXT here. */
|
||||||
symbol_cache_mark_found (bsc, slot, NULL, result);
|
symbol_cache_mark_found (bsc, slot, NULL, result.symbol,
|
||||||
|
result.block);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Still pass NULL for OBJFILE_CONTEXT here. */
|
/* Still pass NULL for OBJFILE_CONTEXT here. */
|
||||||
symbol_cache_mark_not_found (bsc, slot, NULL, name, domain);
|
symbol_cache_mark_not_found (bsc, slot, NULL, name, domain);
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private data to be used with lookup_symbol_global_iterator_cb. */
|
/* Private data to be used with lookup_symbol_global_iterator_cb. */
|
||||||
|
@ -2677,8 +2682,8 @@ struct global_sym_lookup_data
|
||||||
domain_enum domain;
|
domain_enum domain;
|
||||||
|
|
||||||
/* The field where the callback should store the symbol if found.
|
/* The field where the callback should store the symbol if found.
|
||||||
It should be initialized to NULL before the search is started. */
|
It should be initialized to {NULL, NULL} before the search is started. */
|
||||||
struct symbol *result;
|
struct block_symbol result;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A callback function for gdbarch_iterate_over_objfiles_in_search_order.
|
/* A callback function for gdbarch_iterate_over_objfiles_in_search_order.
|
||||||
|
@ -2693,25 +2698,26 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
|
||||||
struct global_sym_lookup_data *data =
|
struct global_sym_lookup_data *data =
|
||||||
(struct global_sym_lookup_data *) cb_data;
|
(struct global_sym_lookup_data *) cb_data;
|
||||||
|
|
||||||
gdb_assert (data->result == NULL);
|
gdb_assert (data->result.symbol == NULL
|
||||||
|
&& data->result.block == NULL);
|
||||||
|
|
||||||
data->result = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK,
|
data->result = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK,
|
||||||
data->name, data->domain);
|
data->name, data->domain);
|
||||||
|
|
||||||
/* If we found a match, tell the iterator to stop. Otherwise,
|
/* If we found a match, tell the iterator to stop. Otherwise,
|
||||||
keep going. */
|
keep going. */
|
||||||
return (data->result != NULL);
|
return (data->result.symbol != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See symtab.h. */
|
/* See symtab.h. */
|
||||||
|
|
||||||
struct symbol *
|
struct block_symbol
|
||||||
lookup_global_symbol (const char *name,
|
lookup_global_symbol (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain)
|
const domain_enum domain)
|
||||||
{
|
{
|
||||||
struct symbol_cache *cache = get_symbol_cache (current_program_space);
|
struct symbol_cache *cache = get_symbol_cache (current_program_space);
|
||||||
struct symbol *sym;
|
struct block_symbol result;
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
struct global_sym_lookup_data lookup_data;
|
struct global_sym_lookup_data lookup_data;
|
||||||
struct block_symbol_cache *bsc;
|
struct block_symbol_cache *bsc;
|
||||||
|
@ -2721,21 +2727,21 @@ lookup_global_symbol (const char *name,
|
||||||
|
|
||||||
/* First see if we can find the symbol in the cache.
|
/* First see if we can find the symbol in the cache.
|
||||||
This works because we use the current objfile to qualify the lookup. */
|
This works because we use the current objfile to qualify the lookup. */
|
||||||
sym = symbol_cache_lookup (cache, objfile, GLOBAL_BLOCK, name, domain,
|
result = symbol_cache_lookup (cache, objfile, GLOBAL_BLOCK, name, domain,
|
||||||
&bsc, &slot);
|
&bsc, &slot);
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (sym == SYMBOL_LOOKUP_FAILED)
|
if (SYMBOL_LOOKUP_FAILED_P (result))
|
||||||
return NULL;
|
return (struct block_symbol) {NULL, NULL};
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call library-specific lookup procedure. */
|
/* Call library-specific lookup procedure. */
|
||||||
if (objfile != NULL)
|
if (objfile != NULL)
|
||||||
sym = solib_global_lookup (objfile, name, domain);
|
result = solib_global_lookup (objfile, name, domain);
|
||||||
|
|
||||||
/* If that didn't work go a global search (of global blocks, heh). */
|
/* If that didn't work go a global search (of global blocks, heh). */
|
||||||
if (sym == NULL)
|
if (result.symbol == NULL)
|
||||||
{
|
{
|
||||||
memset (&lookup_data, 0, sizeof (lookup_data));
|
memset (&lookup_data, 0, sizeof (lookup_data));
|
||||||
lookup_data.name = name;
|
lookup_data.name = name;
|
||||||
|
@ -2743,15 +2749,15 @@ lookup_global_symbol (const char *name,
|
||||||
gdbarch_iterate_over_objfiles_in_search_order
|
gdbarch_iterate_over_objfiles_in_search_order
|
||||||
(objfile != NULL ? get_objfile_arch (objfile) : target_gdbarch (),
|
(objfile != NULL ? get_objfile_arch (objfile) : target_gdbarch (),
|
||||||
lookup_symbol_global_iterator_cb, &lookup_data, objfile);
|
lookup_symbol_global_iterator_cb, &lookup_data, objfile);
|
||||||
sym = lookup_data.result;
|
result = lookup_data.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sym != NULL)
|
if (result.symbol != NULL)
|
||||||
symbol_cache_mark_found (bsc, slot, objfile, sym);
|
symbol_cache_mark_found (bsc, slot, objfile, result.symbol, result.block);
|
||||||
else
|
else
|
||||||
symbol_cache_mark_not_found (bsc, slot, objfile, name, domain);
|
symbol_cache_mark_not_found (bsc, slot, objfile, name, domain);
|
||||||
|
|
||||||
return sym;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -4602,7 +4608,7 @@ search_symbols (const char *regexp, enum search_domain kind,
|
||||||
(MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) == NULL)
|
(MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) == NULL)
|
||||||
: (lookup_symbol_in_objfile_from_linkage_name
|
: (lookup_symbol_in_objfile_from_linkage_name
|
||||||
(objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
|
(objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
|
||||||
== NULL))
|
.symbol == NULL))
|
||||||
found_misc = 1;
|
found_misc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4705,7 +4711,7 @@ search_symbols (const char *regexp, enum search_domain kind,
|
||||||
{
|
{
|
||||||
if (lookup_symbol_in_objfile_from_linkage_name
|
if (lookup_symbol_in_objfile_from_linkage_name
|
||||||
(objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
|
(objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
|
||||||
== NULL)
|
.symbol == NULL)
|
||||||
{
|
{
|
||||||
/* match */
|
/* match */
|
||||||
struct symbol_search *psr = (struct symbol_search *)
|
struct symbol_search *psr = (struct symbol_search *)
|
||||||
|
|
58
gdb/symtab.h
58
gdb/symtab.h
|
@ -782,6 +782,19 @@ struct symbol
|
||||||
struct symbol *hash_next;
|
struct symbol *hash_next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Several lookup functions return both a symbol and the block in which the
|
||||||
|
symbol is found. This structure is used in these cases. */
|
||||||
|
|
||||||
|
struct block_symbol
|
||||||
|
{
|
||||||
|
/* The symbol that was found, or NULL if no symbol was found. */
|
||||||
|
struct symbol *symbol;
|
||||||
|
|
||||||
|
/* If SYMBOL is not NULL, then this is the block in which the symbol is
|
||||||
|
defined. */
|
||||||
|
const struct block *block;
|
||||||
|
};
|
||||||
|
|
||||||
extern const struct symbol_impl *symbol_impls;
|
extern const struct symbol_impl *symbol_impls;
|
||||||
|
|
||||||
/* Note: There is no accessor macro for symbol.owner because it is
|
/* Note: There is no accessor macro for symbol.owner because it is
|
||||||
|
@ -1141,10 +1154,6 @@ DEF_VEC_P (compunit_symtab_ptr);
|
||||||
|
|
||||||
extern int currently_reading_symtab;
|
extern int currently_reading_symtab;
|
||||||
|
|
||||||
/* The block in which the most recently looked up symbol was found. */
|
|
||||||
|
|
||||||
extern const struct block *block_found;
|
|
||||||
|
|
||||||
/* symtab.c lookup functions */
|
/* symtab.c lookup functions */
|
||||||
|
|
||||||
extern const char multiple_symbols_ask[];
|
extern const char multiple_symbols_ask[];
|
||||||
|
@ -1190,11 +1199,10 @@ struct field_of_this_result
|
||||||
C++: if IS_A_FIELD_OF_THIS is non-NULL on entry, check to see if
|
C++: if IS_A_FIELD_OF_THIS is non-NULL on entry, check to see if
|
||||||
NAME is a field of the current implied argument `this'. If so fill in the
|
NAME is a field of the current implied argument `this'. If so fill in the
|
||||||
fields of IS_A_FIELD_OF_THIS, otherwise the fields are set to NULL.
|
fields of IS_A_FIELD_OF_THIS, otherwise the fields are set to NULL.
|
||||||
BLOCK_FOUND is set to the block in which NAME is found (in the case of
|
|
||||||
a field of `this', value_of_this sets BLOCK_FOUND to the proper value).
|
|
||||||
The symbol's section is fixed up if necessary. */
|
The symbol's section is fixed up if necessary. */
|
||||||
|
|
||||||
extern struct symbol *lookup_symbol_in_language (const char *,
|
extern struct block_symbol
|
||||||
|
lookup_symbol_in_language (const char *,
|
||||||
const struct block *,
|
const struct block *,
|
||||||
const domain_enum,
|
const domain_enum,
|
||||||
enum language,
|
enum language,
|
||||||
|
@ -1202,7 +1210,8 @@ extern struct symbol *lookup_symbol_in_language (const char *,
|
||||||
|
|
||||||
/* Same as lookup_symbol_in_language, but using the current language. */
|
/* Same as lookup_symbol_in_language, but using the current language. */
|
||||||
|
|
||||||
extern struct symbol *lookup_symbol (const char *, const struct block *,
|
extern struct block_symbol lookup_symbol (const char *,
|
||||||
|
const struct block *,
|
||||||
const domain_enum,
|
const domain_enum,
|
||||||
struct field_of_this_result *);
|
struct field_of_this_result *);
|
||||||
|
|
||||||
|
@ -1210,7 +1219,7 @@ extern struct symbol *lookup_symbol (const char *, const struct block *,
|
||||||
that can't think of anything better to do.
|
that can't think of anything better to do.
|
||||||
This implements the C lookup rules. */
|
This implements the C lookup rules. */
|
||||||
|
|
||||||
extern struct symbol *
|
extern struct block_symbol
|
||||||
basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
basic_lookup_symbol_nonlocal (const struct language_defn *langdef,
|
||||||
const char *,
|
const char *,
|
||||||
const struct block *,
|
const struct block *,
|
||||||
|
@ -1221,18 +1230,17 @@ extern struct symbol *
|
||||||
|
|
||||||
/* Lookup a symbol in the static block associated to BLOCK, if there
|
/* Lookup a symbol in the static block associated to BLOCK, if there
|
||||||
is one; do nothing if BLOCK is NULL or a global block.
|
is one; do nothing if BLOCK is NULL or a global block.
|
||||||
Upon success sets BLOCK_FOUND and fixes up the symbol's section
|
Upon success fixes up the symbol's section if necessary. */
|
||||||
if necessary. */
|
|
||||||
|
|
||||||
extern struct symbol *lookup_symbol_in_static_block (const char *name,
|
extern struct block_symbol
|
||||||
|
lookup_symbol_in_static_block (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
/* Search all static file-level symbols for NAME from DOMAIN.
|
/* Search all static file-level symbols for NAME from DOMAIN.
|
||||||
Upon success sets BLOCK_FOUND and fixes up the symbol's section
|
Upon success fixes up the symbol's section if necessary. */
|
||||||
if necessary. */
|
|
||||||
|
|
||||||
extern struct symbol *lookup_static_symbol (const char *name,
|
extern struct block_symbol lookup_static_symbol (const char *name,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
/* Lookup a symbol in all files' global blocks.
|
/* Lookup a symbol in all files' global blocks.
|
||||||
|
@ -1244,25 +1252,26 @@ extern struct symbol *lookup_static_symbol (const char *name,
|
||||||
if the target requires it.
|
if the target requires it.
|
||||||
See gdbarch_iterate_over_objfiles_in_search_order.
|
See gdbarch_iterate_over_objfiles_in_search_order.
|
||||||
|
|
||||||
Upon success sets BLOCK_FOUND and fixes up the symbol's section
|
Upon success fixes up the symbol's section if necessary. */
|
||||||
if necessary. */
|
|
||||||
|
|
||||||
extern struct symbol *lookup_global_symbol (const char *name,
|
extern struct block_symbol
|
||||||
|
lookup_global_symbol (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
/* Lookup a symbol in block BLOCK.
|
/* Lookup a symbol in block BLOCK.
|
||||||
Upon success sets BLOCK_FOUND and fixes up the symbol's section
|
Upon success fixes up the symbol's section if necessary. */
|
||||||
if necessary. */
|
|
||||||
|
|
||||||
extern struct symbol *lookup_symbol_in_block (const char *name,
|
extern struct symbol *
|
||||||
|
lookup_symbol_in_block (const char *name,
|
||||||
const struct block *block,
|
const struct block *block,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
||||||
/* Look up the `this' symbol for LANG in BLOCK. Return the symbol if
|
/* Look up the `this' symbol for LANG in BLOCK. Return the symbol if
|
||||||
found, or NULL if not found. */
|
found, or NULL if not found. */
|
||||||
|
|
||||||
extern struct symbol *lookup_language_this (const struct language_defn *lang,
|
extern struct block_symbol
|
||||||
|
lookup_language_this (const struct language_defn *lang,
|
||||||
const struct block *block);
|
const struct block *block);
|
||||||
|
|
||||||
/* Lookup a [struct, union, enum] by name, within a specified block. */
|
/* Lookup a [struct, union, enum] by name, within a specified block. */
|
||||||
|
@ -1524,10 +1533,9 @@ extern enum language main_language (void);
|
||||||
/* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global blocks.
|
/* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global blocks.
|
||||||
This searches MAIN_OBJFILE as well as any associated separate debug info
|
This searches MAIN_OBJFILE as well as any associated separate debug info
|
||||||
objfiles of MAIN_OBJFILE.
|
objfiles of MAIN_OBJFILE.
|
||||||
Upon success sets BLOCK_FOUND and fixes up the symbol's section
|
Upon success fixes up the symbol's section if necessary. */
|
||||||
if necessary. */
|
|
||||||
|
|
||||||
extern struct symbol *
|
extern struct block_symbol
|
||||||
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
|
||||||
const char *name,
|
const char *name,
|
||||||
const domain_enum domain);
|
const domain_enum domain);
|
||||||
|
|
26
gdb/valops.c
26
gdb/valops.c
|
@ -127,21 +127,21 @@ show_overload_resolution (struct ui_file *file, int from_tty,
|
||||||
struct value *
|
struct value *
|
||||||
find_function_in_inferior (const char *name, struct objfile **objf_p)
|
find_function_in_inferior (const char *name, struct objfile **objf_p)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
|
|
||||||
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
|
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
|
||||||
if (sym != NULL)
|
if (sym.symbol != NULL)
|
||||||
{
|
{
|
||||||
if (SYMBOL_CLASS (sym) != LOC_BLOCK)
|
if (SYMBOL_CLASS (sym.symbol) != LOC_BLOCK)
|
||||||
{
|
{
|
||||||
error (_("\"%s\" exists in this program but is not a function."),
|
error (_("\"%s\" exists in this program but is not a function."),
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objf_p)
|
if (objf_p)
|
||||||
*objf_p = symbol_objfile (sym);
|
*objf_p = symbol_objfile (sym.symbol);
|
||||||
|
|
||||||
return value_of_variable (sym, NULL);
|
return value_of_variable (sym.symbol, sym.block);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3457,7 +3457,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
{
|
{
|
||||||
struct symbol *s =
|
struct symbol *s =
|
||||||
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
|
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
|
||||||
0, VAR_DOMAIN, 0);
|
0, VAR_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3488,7 +3488,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
||||||
{
|
{
|
||||||
struct symbol *s =
|
struct symbol *s =
|
||||||
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
|
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
|
||||||
0, VAR_DOMAIN, 0);
|
0, VAR_DOMAIN, 0).symbol;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3564,19 +3564,19 @@ value_maybe_namespace_elt (const struct type *curtype,
|
||||||
enum noside noside)
|
enum noside noside)
|
||||||
{
|
{
|
||||||
const char *namespace_name = TYPE_TAG_NAME (curtype);
|
const char *namespace_name = TYPE_TAG_NAME (curtype);
|
||||||
struct symbol *sym;
|
struct block_symbol sym;
|
||||||
struct value *result;
|
struct value *result;
|
||||||
|
|
||||||
sym = cp_lookup_symbol_namespace (namespace_name, name,
|
sym = cp_lookup_symbol_namespace (namespace_name, name,
|
||||||
get_selected_block (0), VAR_DOMAIN);
|
get_selected_block (0), VAR_DOMAIN);
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym.symbol == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
|
else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
&& (SYMBOL_CLASS (sym) == LOC_TYPEDEF))
|
&& (SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF))
|
||||||
result = allocate_value (SYMBOL_TYPE (sym));
|
result = allocate_value (SYMBOL_TYPE (sym.symbol));
|
||||||
else
|
else
|
||||||
result = value_of_variable (sym, get_selected_block (0));
|
result = value_of_variable (sym.symbol, sym.block);
|
||||||
|
|
||||||
if (want_address)
|
if (want_address)
|
||||||
result = value_addr (result);
|
result = value_addr (result);
|
||||||
|
@ -3740,7 +3740,7 @@ value_of_this (const struct language_defn *lang)
|
||||||
|
|
||||||
b = get_frame_block (frame, NULL);
|
b = get_frame_block (frame, NULL);
|
||||||
|
|
||||||
sym = lookup_language_this (lang, b);
|
sym = lookup_language_this (lang, b).symbol;
|
||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
error (_("current stack frame does not contain a variable named `%s'"),
|
error (_("current stack frame does not contain a variable named `%s'"),
|
||||||
lang->la_name_of_this);
|
lang->la_name_of_this);
|
||||||
|
|
|
@ -2953,9 +2953,9 @@ value_static_field (struct type *type, int fieldno)
|
||||||
{
|
{
|
||||||
const char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
|
const char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
|
||||||
/* TYPE_FIELD_NAME (type, fieldno); */
|
/* TYPE_FIELD_NAME (type, fieldno); */
|
||||||
struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
|
struct block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
|
||||||
|
|
||||||
if (sym == NULL)
|
if (sym.symbol == NULL)
|
||||||
{
|
{
|
||||||
/* With some compilers, e.g. HP aCC, static data members are
|
/* With some compilers, e.g. HP aCC, static data members are
|
||||||
reported as non-debuggable symbols. */
|
reported as non-debuggable symbols. */
|
||||||
|
@ -2971,7 +2971,7 @@ value_static_field (struct type *type, int fieldno)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
retval = value_of_variable (sym, NULL);
|
retval = value_of_variable (sym.symbol, sym.block);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -3141,7 +3141,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct bound_minimal_symbol msym;
|
struct bound_minimal_symbol msym;
|
||||||
|
|
||||||
sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0);
|
sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0).symbol;
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
memset (&msym, 0, sizeof (msym));
|
memset (&msym, 0, sizeof (msym));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue