aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-12-16 13:25:48 -0700
committerTom Tromey <tromey@adacore.com>2023-05-12 13:25:28 -0600
commit47ef0ac717f93b330dc475647f069bf64f7da862 (patch)
treefa5635dc5ab9f95cffe81bd1cf4f6f31f6eda308 /gdb/symtab.c
parentefe2296bde30c22124ed31b70b7d860339927471 (diff)
downloadbinutils-47ef0ac717f93b330dc475647f069bf64f7da862.zip
binutils-47ef0ac717f93b330dc475647f069bf64f7da862.tar.gz
binutils-47ef0ac717f93b330dc475647f069bf64f7da862.tar.bz2
Introduce lookup_minimal_symbol_linkage
This introduces a new function, lookup_minimal_symbol_linkage, and refactors a couple other existing functions to call it. This function will be used in a subsequent patch.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 5e85c53..2a15a61 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6496,17 +6496,10 @@ get_symbol_address (const struct symbol *sym)
gdb_assert (sym->aclass () == LOC_STATIC);
const char *linkage_name = sym->linkage_name ();
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- if (objfile->separate_debug_objfile_backlink != nullptr)
- continue;
-
- bound_minimal_symbol minsym
- = lookup_minimal_symbol_linkage (linkage_name, objfile);
- if (minsym.minsym != nullptr)
- return minsym.value_address ();
- }
+ bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (linkage_name,
+ false);
+ if (minsym.minsym != nullptr)
+ return minsym.value_address ();
return sym->m_value.address;
}
@@ -6519,18 +6512,10 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym)
gdb_assert ((objf->flags & OBJF_MAINLINE) == 0);
const char *linkage_name = minsym->linkage_name ();
-
- for (objfile *objfile : current_program_space->objfiles ())
- {
- if (objfile->separate_debug_objfile_backlink == nullptr
- && (objfile->flags & OBJF_MAINLINE) != 0)
- {
- bound_minimal_symbol found
- = lookup_minimal_symbol_linkage (linkage_name, objfile);
- if (found.minsym != nullptr)
- return found.value_address ();
- }
- }
+ bound_minimal_symbol found = lookup_minimal_symbol_linkage (linkage_name,
+ true);
+ if (found.minsym != nullptr)
+ return found.value_address ();
return (minsym->m_value.address
+ objf->section_offsets[minsym->section_index ()]);
}