This commit further simplifies find_symbol_at_address by moving
the special handling in case of -readnow down to readnow_functions.
Running all tests in gdb.rust with and without -readnow shown no
regressions (tested on Debian, x86_64).
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33555
Approved-By: Tom Tromey <tom@tromey.com>
}
return true;
}
+
+ struct symbol *find_symbol_by_address (struct objfile *objfile,
+ CORE_ADDR address) override
+ {
+ for (compunit_symtab &symtab : objfile->compunits ())
+ {
+ struct symbol *sym = symtab.symbol_at_address (address);
+ if (sym != nullptr)
+ return sym;
+ }
+
+ return nullptr;
+ }
};
/* See read.h. */
{
for (objfile &objfile : current_program_space->objfiles ())
{
- /* If this objfile was read with -readnow, then we need to
- search the symtabs directly. */
- if ((objfile.flags & OBJF_READNOW) != 0)
- {
- for (compunit_symtab &symtab : objfile.compunits ())
- {
- struct symbol *sym
- = symtab.symbol_at_address (address);
- if (sym != nullptr)
- return sym;
- }
- }
- else
- {
- struct symbol *sym = objfile.find_symbol_by_address (address);
- if (sym != nullptr)
- return sym;
- }
+ struct symbol *sym = objfile.find_symbol_by_address (address);
+ if (sym != nullptr)
+ return sym;
}
return NULL;