static htab_t syscm_get_symbol_map (struct symbol *symbol) { htab_t htab; if (SYMBOL_OBJFILE_OWNED (symbol)) { struct objfile *objfile = symbol_objfile (symbol); htab = objfile_data (objfile, syscm_objfile_data_key); if (htab == NULL) { htab = gdbscm_create_eqable_gsmob_ptr_map (syscm_hash_symbol_smob, syscm_eq_symbol_smob); set_objfile_data (objfile, syscm_objfile_data_key, htab); } } else { struct gdbarch *gdbarch = symbol_arch (symbol); struct syscm_gdbarch_data *data = gdbarch_data (gdbarch, syscm_gdbarch_data_key); htab = data->htab; } return htab; }
struct block_symbol cp_lookup_symbol_imports_or_template (const char *scope, const char *name, const struct block *block, const domain_enum domain) { struct symbol *function = BLOCK_FUNCTION (block); struct block_symbol result; if (symbol_lookup_debug) { fprintf_unfiltered (gdb_stdlog, "cp_lookup_symbol_imports_or_template" " (%s, %s, %s, %s)\n", scope, name, host_address_to_string (block), domain_name (domain)); } if (function != NULL && SYMBOL_LANGUAGE (function) == language_cplus) { /* Search the function's template parameters. */ if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function)) { struct template_symbol *templ = (struct template_symbol *) function; struct symbol *sym = search_symbol_list (name, templ->n_template_arguments, templ->template_arguments); if (sym != NULL) { if (symbol_lookup_debug) { fprintf_unfiltered (gdb_stdlog, "cp_lookup_symbol_imports_or_template" " (...) = %s\n", host_address_to_string (sym)); } return (struct block_symbol) {sym, block}; } } /* Search the template parameters of the function's defining context. */ if (SYMBOL_NATURAL_NAME (function)) { struct type *context; char *name_copy = xstrdup (SYMBOL_NATURAL_NAME (function)); struct cleanup *cleanups = make_cleanup (xfree, name_copy); const struct language_defn *lang = language_def (language_cplus); struct gdbarch *arch = symbol_arch (function); const struct block *parent = BLOCK_SUPERBLOCK (block); struct symbol *sym; while (1) { unsigned int prefix_len = cp_entire_prefix_len (name_copy); if (prefix_len == 0) context = NULL; else { name_copy[prefix_len] = '\0'; context = lookup_typename (lang, arch, name_copy, parent, 1); } if (context == NULL) break; sym = search_symbol_list (name, TYPE_N_TEMPLATE_ARGUMENTS (context), TYPE_TEMPLATE_ARGUMENTS (context)); if (sym != NULL) { do_cleanups (cleanups); if (symbol_lookup_debug) { fprintf_unfiltered (gdb_stdlog, "cp_lookup_symbol_imports_or_template (...) = %s\n", host_address_to_string (sym)); } return (struct block_symbol) {sym, parent}; } } do_cleanups (cleanups); } }