/* Program space key for finding name and language of "main". */
-static const program_space_key<main_info> main_progspace_key;
+static const registry<program_space>::key<main_info> main_progspace_key;
/* The default symbol cache size.
There is no extra cpu cost for large N (except when flushing the cache,
/* Program space key for finding its symbol cache. */
-static const program_space_key<symbol_cache> symbol_cache_key;
+static const registry<program_space>::key<symbol_cache> symbol_cache_key;
/* When non-zero, print debugging messages related to symtab creation. */
unsigned int symtab_create_debug = 0;
/* See symtab.h. */
enum language
-compunit_language (const struct compunit_symtab *cust)
+compunit_symtab::language () const
{
- struct symtab *symtab = cust->primary_filetab ();
+ struct symtab *symtab = primary_filetab ();
-/* The language of the compunit symtab is the language of its primary
- source file. */
+ /* The language of the compunit symtab is the language of its
+ primary source file. */
return symtab->language ();
}
if (eq_symbol_entry (slot, objfile_context, name, domain))
{
- if (symbol_lookup_debug)
- gdb_printf (gdb_stdlog,
- "%s block symbol cache hit%s for %s, %s\n",
- block == GLOBAL_BLOCK ? "Global" : "Static",
- slot->state == SYMBOL_SLOT_NOT_FOUND
- ? " (not found)" : "",
- name, domain_name (domain));
+ symbol_lookup_debug_printf ("%s block symbol cache hit%s for %s, %s",
+ block == GLOBAL_BLOCK ? "Global" : "Static",
+ slot->state == SYMBOL_SLOT_NOT_FOUND
+ ? " (not found)" : "", name,
+ domain_name (domain));
++bsc->hits;
if (slot->state == SYMBOL_SLOT_NOT_FOUND)
return SYMBOL_LOOKUP_FAILED;
/* Symbol is not present in the cache. */
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "%s block symbol cache miss for %s, %s\n",
- block == GLOBAL_BLOCK ? "Global" : "Static",
- name, domain_name (domain));
- }
+ symbol_lookup_debug_printf ("%s block symbol cache miss for %s, %s",
+ block == GLOBAL_BLOCK ? "Global" : "Static",
+ name, domain_name (domain));
++bsc->misses;
return {};
}
addr = sym->value_address ();
break;
case LOC_BLOCK:
- addr = BLOCK_ENTRY_PC (sym->value_block ());
+ addr = sym->value_block ()->entry_pc ();
break;
default:
const domain_enum domain, enum language lang,
struct field_of_this_result *is_a_field_of_this)
{
+ SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
+
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (name, lang, storage);
if (lang->name_of_this () == NULL || block == NULL)
return {};
- if (symbol_lookup_debug > 1)
- {
- struct objfile *objfile = block_objfile (block);
-
- gdb_printf (gdb_stdlog,
- "lookup_language_this (%s, %s (objfile %s))",
- lang->name (), host_address_to_string (block),
- objfile_debug_name (objfile));
- }
+ symbol_lookup_debug_printf_v ("lookup_language_this (%s, %s (objfile %s))",
+ lang->name (), host_address_to_string (block),
+ objfile_debug_name (block_objfile (block)));
while (block)
{
VAR_DOMAIN);
if (sym != NULL)
{
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog, " = %s (%s, block %s)\n",
- sym->print_name (),
- host_address_to_string (sym),
- host_address_to_string (block));
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_language_this (...) = %s (%s, block %s)",
+ sym->print_name (), host_address_to_string (sym),
+ host_address_to_string (block));
return (struct block_symbol) {sym, block};
}
if (block->function ())
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
- if (symbol_lookup_debug > 1)
- gdb_printf (gdb_stdlog, " = NULL\n");
+ symbol_lookup_debug_printf_v ("lookup_language_this (...) = NULL");
return {};
}
const domain_enum domain, enum language language,
struct field_of_this_result *is_a_field_of_this)
{
+ SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
+
struct block_symbol result;
const struct language_defn *langdef;
struct objfile *objfile = (block == nullptr
? nullptr : block_objfile (block));
- gdb_printf (gdb_stdlog,
- "lookup_symbol_aux (%s, %s (objfile %s), %s, %s)\n",
- name, host_address_to_string (block),
- objfile != NULL
- ? objfile_debug_name (objfile) : "NULL",
- domain_name (domain), language_str (language));
+ symbol_lookup_debug_printf
+ ("demangled symbol name = \"%s\", block @ %s (objfile %s)",
+ name, host_address_to_string (block),
+ objfile != NULL ? objfile_debug_name (objfile) : "NULL");
+ symbol_lookup_debug_printf
+ ("domain name = \"%s\", language = \"%s\")",
+ domain_name (domain), language_str (language));
}
/* Make sure we do something sensible with is_a_field_of_this, since
result = lookup_local_symbol (name, match_type, block, domain, language);
if (result.symbol != NULL)
{
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
- host_address_to_string (result.symbol));
- }
+ symbol_lookup_debug_printf
+ ("found symbol @ %s (using lookup_local_symbol)",
+ host_address_to_string (result.symbol));
return result;
}
be typedefed; just be safe. */
t = check_typedef (t);
if (t->is_pointer_or_reference ())
- t = TYPE_TARGET_TYPE (t);
+ t = t->target_type ();
if (t->code () != TYPE_CODE_STRUCT
&& t->code () != TYPE_CODE_UNION)
if (check_field (t, name, is_a_field_of_this))
{
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_aux (...) = NULL\n");
- }
+ symbol_lookup_debug_printf ("no symbol found");
return {};
}
}
result = langdef->lookup_symbol_nonlocal (name, block, domain);
if (result.symbol != NULL)
{
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
- host_address_to_string (result.symbol));
- }
+ symbol_lookup_debug_printf
+ ("found symbol @ %s (using language lookup_symbol_nonlocal)",
+ host_address_to_string (result.symbol));
return result;
}
but more useful than an error. */
result = lookup_static_symbol (name, domain);
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog, "lookup_symbol_aux (...) = %s\n",
- result.symbol != NULL
- ? host_address_to_string (result.symbol)
- : "NULL");
- }
+ symbol_lookup_debug_printf
+ ("found symbol @ %s (using lookup_static_symbol)",
+ result.symbol != NULL ? host_address_to_string (result.symbol) : "NULL");
return result;
}
if (block->function () != NULL && block_inlined_p (block))
break;
- block = BLOCK_SUPERBLOCK (block);
+ block = block->superblock ();
}
/* We've reached the end of the function without finding a result. */
{
struct symbol *sym;
- if (symbol_lookup_debug > 1)
+ if (symbol_lookup_debug)
{
- struct objfile *objfile = (block == nullptr
- ? nullptr : block_objfile (block));
+ struct objfile *objfile
+ = block == nullptr ? nullptr : block_objfile (block);
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_block (%s, %s (objfile %s), %s)",
- name, host_address_to_string (block),
- objfile_debug_name (objfile),
- domain_name (domain));
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_in_block (%s, %s (objfile %s), %s)",
+ name, host_address_to_string (block),
+ objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
+ domain_name (domain));
}
sym = block_lookup_symbol (block, name, match_type, domain);
if (sym)
{
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog, " = %s\n",
- host_address_to_string (sym));
- }
+ symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = %s",
+ host_address_to_string (sym));
return fixup_symbol_section (sym, NULL);
}
- if (symbol_lookup_debug > 1)
- gdb_printf (gdb_stdlog, " = NULL\n");
+ symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = NULL");
return NULL;
}
{
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_objfile_symtabs (%s, %s, %s, %s)",
- objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK
- ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
- name, domain_name (domain));
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_in_objfile_symtabs (%s, %s, %s, %s)",
+ objfile_debug_name (objfile),
+ block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
+ name, domain_name (domain));
struct block_symbol other;
other.symbol = NULL;
struct block_symbol result;
bv = cust->blockvector ();
- block = BLOCKVECTOR_BLOCK (bv, block_index);
+ block = bv->block (block_index);
result.symbol = block_lookup_symbol_primary (block, name, domain);
result.block = block;
if (result.symbol == NULL)
if (other.symbol != NULL)
{
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog, " = %s (block %s)\n",
- host_address_to_string (other.symbol),
- host_address_to_string (other.block));
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
+ host_address_to_string (other.symbol),
+ host_address_to_string (other.block));
other.symbol = fixup_symbol_section (other.symbol, objfile);
return other;
}
- if (symbol_lookup_debug > 1)
- gdb_printf (gdb_stdlog, " = NULL\n");
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_in_objfile_symtabs (...) = NULL");
return {};
}
const struct block *block;
struct block_symbol result;
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_via_quick_fns (%s, %s, %s, %s)\n",
- objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK
- ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
- name, domain_name (domain));
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_via_quick_fns (%s, %s, %s, %s)",
+ objfile_debug_name (objfile),
+ block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
+ name, domain_name (domain));
cust = objfile->lookup_symbol (block_index, name, domain);
if (cust == NULL)
{
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_via_quick_fns (...) = NULL\n");
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_via_quick_fns (...) = NULL");
return {};
}
bv = cust->blockvector ();
- block = BLOCKVECTOR_BLOCK (bv, block_index);
+ block = bv->block (block_index);
result.symbol = block_lookup_symbol (block, name,
symbol_name_match_type::FULL, domain);
if (result.symbol == NULL)
error_in_psymtab_expansion (block_index, name, cust);
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_via_quick_fns (...) = %s (block %s)\n",
- host_address_to_string (result.symbol),
- host_address_to_string (block));
- }
+ symbol_lookup_debug_printf_v
+ ("lookup_symbol_via_quick_fns (...) = %s (block %s)",
+ host_address_to_string (result.symbol),
+ host_address_to_string (block));
result.symbol = fixup_symbol_section (result.symbol, objfile);
result.block = block;
struct objfile *objfile = (block == nullptr
? nullptr : block_objfile (block));
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_static_block (%s, %s (objfile %s),"
- " %s)\n",
- name,
- host_address_to_string (block),
- objfile_debug_name (objfile),
- domain_name (domain));
+ symbol_lookup_debug_printf
+ ("lookup_symbol_in_static_block (%s, %s (objfile %s), %s)",
+ name, host_address_to_string (block),
+ objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
+ domain_name (domain));
}
sym = lookup_symbol_in_block (name,
symbol_name_match_type::FULL,
static_block, domain);
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_static_block (...) = %s\n",
- sym != NULL ? host_address_to_string (sym) : "NULL");
- }
+ symbol_lookup_debug_printf ("lookup_symbol_in_static_block (...) = %s",
+ sym != NULL
+ ? host_address_to_string (sym) : "NULL");
return (struct block_symbol) {sym, static_block};
}
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_objfile (%s, %s, %s, %s)\n",
- objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK
- ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
- name, domain_name (domain));
- }
+ symbol_lookup_debug_printf ("lookup_symbol_in_objfile (%s, %s, %s, %s)",
+ objfile_debug_name (objfile),
+ block_index == GLOBAL_BLOCK
+ ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
+ name, domain_name (domain));
result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
name, domain);
if (result.symbol != NULL)
{
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_objfile (...) = %s"
- " (in symtabs)\n",
- host_address_to_string (result.symbol));
- }
+ symbol_lookup_debug_printf
+ ("lookup_symbol_in_objfile (...) = %s (in symtabs)",
+ host_address_to_string (result.symbol));
return result;
}
result = lookup_symbol_via_quick_fns (objfile, block_index,
name, domain);
- if (symbol_lookup_debug)
- {
- gdb_printf (gdb_stdlog,
- "lookup_symbol_in_objfile (...) = %s%s\n",
- result.symbol != NULL
- ? host_address_to_string (result.symbol)
- : "NULL",
- result.symbol != NULL ? " (via quick fns)" : "");
- }
+ symbol_lookup_debug_printf ("lookup_symbol_in_objfile (...) = %s%s",
+ result.symbol != NULL
+ ? host_address_to_string (result.symbol)
+ : "NULL",
+ result.symbol != NULL ? " (via quick fns)"
+ : "");
return result;
}
-/* Find the language for partial symbol with NAME. */
-
-static enum language
-find_quick_global_symbol_language (const char *name, const domain_enum domain)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- {
- bool symbol_found_p;
- enum language lang
- = objfile->lookup_global_symbol_language (name, domain, &symbol_found_p);
- if (symbol_found_p)
- return lang;
- }
-
- return language_unknown;
-}
-
-/* Private data to be used with lookup_symbol_global_iterator_cb. */
-
-struct global_or_static_sym_lookup_data
-{
- /* The name of the symbol we are searching for. */
- const char *name;
-
- /* The domain to use for our search. */
- domain_enum domain;
-
- /* The block index in which to search. */
- enum block_enum block_index;
-
- /* The field where the callback should store the symbol if found.
- It should be initialized to {NULL, NULL} before the search is started. */
- struct block_symbol result;
-};
-
-/* A callback function for gdbarch_iterate_over_objfiles_in_search_order.
- It searches by name for a symbol in the block given by BLOCK_INDEX of the
- given OBJFILE. The arguments for the search are passed via CB_DATA, which
- in reality is a pointer to struct global_or_static_sym_lookup_data. */
-
-static int
-lookup_symbol_global_or_static_iterator_cb (struct objfile *objfile,
- void *cb_data)
-{
- struct global_or_static_sym_lookup_data *data =
- (struct global_or_static_sym_lookup_data *) cb_data;
-
- gdb_assert (data->result.symbol == NULL
- && data->result.block == NULL);
-
- data->result = lookup_symbol_in_objfile (objfile, data->block_index,
- data->name, data->domain);
-
- /* If we found a match, tell the iterator to stop. Otherwise,
- keep going. */
- return (data->result.symbol != NULL);
-}
-
/* This function contains the common code of lookup_{global,static}_symbol.
OBJFILE is only used if BLOCK_INDEX is GLOBAL_SCOPE, in which case it is
the objfile to start the lookup in. */
{
struct symbol_cache *cache = get_symbol_cache (current_program_space);
struct block_symbol result;
- struct global_or_static_sym_lookup_data lookup_data;
struct block_symbol_cache *bsc;
struct symbol_cache_slot *slot;
/* Do a global search (of global blocks, heh). */
if (result.symbol == NULL)
- {
- memset (&lookup_data, 0, sizeof (lookup_data));
- lookup_data.name = name;
- lookup_data.block_index = block_index;
- lookup_data.domain = domain;
- gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? objfile->arch () : target_gdbarch (),
- lookup_symbol_global_or_static_iterator_cb, &lookup_data, objfile);
- result = lookup_data.result;
- }
+ gdbarch_iterate_over_objfiles_in_search_order
+ (objfile != NULL ? objfile->arch () : target_gdbarch (),
+ [&result, block_index, name, domain] (struct objfile *objfile_iter)
+ {
+ result = lookup_symbol_in_objfile (objfile_iter, block_index,
+ name, domain);
+ return result.symbol != nullptr;
+ },
+ objfile);
if (result.symbol != NULL)
symbol_cache_mark_found (bsc, slot, objfile, result.symbol, result.block);
return NULL;
bv = cust->blockvector ();
- block = BLOCKVECTOR_BLOCK (bv, block_index);
+ block = bv->block (block_index);
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
block_find_non_opaque_type, NULL);
if (sym == NULL)
for (compunit_symtab *cust : objfile->compunits ())
{
bv = cust->blockvector ();
- block = BLOCKVECTOR_BLOCK (bv, block_index);
+ block = bv->block (block_index);
sym = block_find_symbol (block, name, STRUCT_DOMAIN,
block_find_non_opaque_type, NULL);
if (sym != NULL)
for (compunit_symtab *cust : obj_file->compunits ())
{
const struct blockvector *bv = cust->blockvector ();
- const struct block *global_block
- = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ const struct block *global_block = bv->global_block ();
CORE_ADDR start = global_block->start ();
CORE_ADDR end = global_block->end ();
bool in_range_p = start <= pc && pc < end;
if (!in_range_p)
continue;
- if (BLOCKVECTOR_MAP (bv))
+ if (bv->map () != nullptr)
{
- if (addrmap_find (BLOCKVECTOR_MAP (bv), pc) == nullptr)
+ if (bv->map ()->find (pc) == nullptr)
continue;
return cust;
b_index <= STATIC_BLOCK && sym == NULL;
++b_index)
{
- const struct block *b = BLOCKVECTOR_BLOCK (bv, b_index);
+ const struct block *b = bv->block (b_index);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
fixup_symbol_section (sym, obj_file);
for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
{
- const struct block *b = BLOCKVECTOR_BLOCK (bv, i);
+ const struct block *b = bv->block (i);
struct block_iterator iter;
struct symbol *sym;
should occur, we'd like to know about it, so error out,
fatally. */
if (mfunsym.value_address () == pc)
- internal_error (__FILE__, __LINE__,
- _("Infinite recursion detected in find_pc_sect_line;"
+ internal_error (_("Infinite recursion detected in find_pc_sect_line;"
"please file a bug report"));
return find_pc_line (mfunsym.value_address (), 0);
else if (alt)
val.end = alt->pc;
else
- val.end = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)->end ();
+ val.end = bv->global_block ()->end ();
}
val.section = section;
return val;
{
fixup_symbol_section (sym, NULL);
symtab_and_line sal
- = find_function_start_sal_1 (BLOCK_ENTRY_PC (sym->value_block ()),
+ = find_function_start_sal_1 (sym->value_block ()->entry_pc (),
sym->obj_section (sym->objfile ()),
funfirstline);
sal.symbol = sym;
fixup_symbol_section (sym, NULL);
objfile = sym->objfile ();
- pc = BLOCK_ENTRY_PC (sym->value_block ());
+ pc = sym->value_block ()->entry_pc ();
section = sym->obj_section (objfile);
name = sym->linkage_name ();
}
/* Check if gdbarch_skip_prologue left us in mid-line, and the next
line is still part of the same function. */
if (skip && start_sal.pc != pc
- && (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end
+ && (sym ? (sym->value_block ()->entry_pc () <= start_sal.end
&& start_sal.end < sym->value_block()->end ())
: (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym
== lookup_minimal_symbol_by_pc_section (pc, section).minsym)))
function_block = b;
else if (b->function () != NULL)
break;
- b = BLOCK_SUPERBLOCK (b);
+ b = b->superblock ();
}
if (function_block != NULL
&& function_block->function ()->line () != 0)
bl = NULL;
break;
}
- bl = BLOCK_SUPERBLOCK (bl);
+ bl = bl->superblock ();
}
if (bl != NULL)
break;
symbol *sym = find_pc_function (func_addr);
if (sym != NULL
&& sym->aclass () == LOC_BLOCK
- && BLOCK_ENTRY_PC (sym->value_block ()) == func_addr)
+ && sym->value_block ()->entry_pc () == func_addr)
return sym;
return NULL;
struct type *sym_type;
std::string printed_sym_type_name;
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- "treg_matches_sym_type_name\n sym %s\n",
- sym->natural_name ());
- }
+ symbol_lookup_debug_printf_v ("treg_matches_sym_type_name, sym %s",
+ sym->natural_name ());
sym_type = sym->type ();
if (sym_type == NULL)
printed_sym_type_name = type_to_string (sym_type);
}
-
- if (symbol_lookup_debug > 1)
- {
- gdb_printf (gdb_stdlog,
- " sym_type_name %s\n",
- printed_sym_type_name.c_str ());
- }
-
+ symbol_lookup_debug_printf_v ("sym_type_name %s",
+ printed_sym_type_name.c_str ());
if (printed_sym_type_name.empty ())
return false;
{
struct block_iterator iter;
struct symbol *sym;
- const struct block *b = BLOCKVECTOR_BLOCK (bv, block);
+ const struct block *b = bv->block (block);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (m_symbol_name_regexp != NULL)
{
const char *symbol_name_regexp = m_symbol_name_regexp;
+ std::string symbol_name_regexp_holder;
/* Make sure spacing is right for C++ operators.
This is just a courtesy to make the matching less sensitive
/* If wrong number of spaces, fix it. */
if (fix >= 0)
{
- char *tmp = (char *) alloca (8 + fix + strlen (opname) + 1);
-
- sprintf (tmp, "operator%.*s%s", fix, " ", opname);
- symbol_name_regexp = tmp;
+ symbol_name_regexp_holder
+ = string_printf ("operator%.*s%s", fix, " ", opname);
+ symbol_name_regexp = symbol_name_regexp_holder.c_str ();
}
}
symbol_name_match_type::SEARCH_NAME);
struct objfile *objfile = sym->objfile ();
- CORE_ADDR address = BLOCK_ENTRY_PC (sym->value_block ());
+ CORE_ADDR address = sym->value_block ()->entry_pc ();
minimal_symbol *ifunc = NULL;
iterate_over_minimal_symbols (objfile, lookup_name,
enum type_code code)
{
struct symbol *sym;
- const struct block *b;
struct block_iterator iter;
int i;
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
{
QUIT;
- b = BLOCKVECTOR_BLOCK (cust->blockvector (), i);
+
+ const struct block *b = cust->blockvector ()->block (i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (completion_skip_symbol (mode, sym))
are in scope for a nested function. */
if (b->function () != NULL && block_inlined_p (b))
break;
- b = BLOCK_SUPERBLOCK (b);
+ b = b->superblock ();
}
/* Add fields from the file's types; symbols will be added below. */
Fallback to "main". */
/* Try to find language for main in psymtabs. */
- enum language lang
- = find_quick_global_symbol_language ("main", VAR_DOMAIN);
- if (lang != language_unknown)
- {
- set_main_name ("main", lang);
- return;
- }
+ bool symbol_found_p = false;
+ gdbarch_iterate_over_objfiles_in_search_order
+ (target_gdbarch (),
+ [&symbol_found_p] (objfile *obj)
+ {
+ language lang
+ = obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
+ &symbol_found_p);
+ if (symbol_found_p)
+ {
+ set_main_name ("main", lang);
+ return 1;
+ }
+
+ return 0;
+ }, nullptr);
+
+ if (symbol_found_p)
+ return;
set_main_name ("main", language_unknown);
}