diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-10-23 14:05:02 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-10-25 11:34:59 -0400 |
commit | 23e6f781518fd600041fc12ce68a19c00b9018de (patch) | |
tree | f7095389ccec610db8db3429d6c114ffadc28050 /gdb | |
parent | 53beac2e23bcffe632bb837c97003998e6986ce9 (diff) | |
download | fsf-binutils-gdb-23e6f781518fd600041fc12ce68a19c00b9018de.zip fsf-binutils-gdb-23e6f781518fd600041fc12ce68a19c00b9018de.tar.gz fsf-binutils-gdb-23e6f781518fd600041fc12ce68a19c00b9018de.tar.bz2 |
gdb: make get_msymbol_address a private method of minimal_symbol
get_msymbol_address is only used in minimal_symbol::value_address. Make
it a private helper method.
Change-Id: I3f30e1b9d89ace6682fb08a7ebb91746db0ccf0f
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/symtab.c | 12 | ||||
-rw-r--r-- | gdb/symtab.h | 16 |
2 files changed, 13 insertions, 15 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 46547f8..96bc481 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -439,7 +439,7 @@ CORE_ADDR minimal_symbol::value_address (objfile *objfile) const { if (this->maybe_copied (objfile)) - return get_msymbol_address (objfile, this); + return this->get_maybe_copied_address (objfile); else return (CORE_ADDR (this->unrelocated_address ()) + objfile->section_offsets[this->section_index ()]); @@ -6533,18 +6533,18 @@ get_symbol_address (const struct symbol *sym) /* See symtab.h. */ CORE_ADDR -get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym) +minimal_symbol::get_maybe_copied_address (objfile *objf) const { - gdb_assert (minsym->maybe_copied (objf)); + gdb_assert (this->maybe_copied (objf)); gdb_assert ((objf->flags & OBJF_MAINLINE) == 0); - const char *linkage_name = minsym->linkage_name (); + const char *linkage_name = this->linkage_name (); 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 ()]); + return (this->m_value.address + + objf->section_offsets[this->section_index ()]); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 3657433..07f13e8 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -716,15 +716,6 @@ enum minimal_symbol_type #define MINSYM_TYPE_BITS 4 gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS)); -/* Return the address of MINSYM, which comes from OBJF. The - MAYBE_COPIED flag must be set on MINSYM. If MINSYM appears in the - main program's minimal symbols, then that minsym's address is - returned; otherwise, MINSYM's address is returned. This should - generally only be used via the MSYMBOL_VALUE_ADDRESS macro. */ - -extern CORE_ADDR get_msymbol_address (struct objfile *objf, - const struct minimal_symbol *minsym); - /* Define a simple structure used to hold some very basic information about all defined global symbols (text, data, bss, abs, etc). The only required information is the general_symbol_info. @@ -885,6 +876,13 @@ struct minimal_symbol : public general_symbol_info address in this symbol is used. */ bool maybe_copied (objfile *objfile) const; + +private: + /* Return the address of this minimal symbol, in the context of OBJF. The + MAYBE_COPIED flag must be set. If the minimal symbol appears in the + main program's minimal symbols, then that minsym's address is + returned; otherwise, this minimal symbol's address is returned. */ + CORE_ADDR get_maybe_copied_address (objfile *objf) const; }; #include "minsyms.h" |