gdb: make get_symbol_address a private method of symbol
get_symbol_address is only used symbol::value_address, make it a private helper method. Change-Id: I318ddcfcf1269d95045b8efe9137812df9c5113c Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
parent
23e6f78151
commit
f9b96f673e
2 changed files with 13 additions and 14 deletions
10
gdb/symtab.c
10
gdb/symtab.c
|
@ -6517,17 +6517,17 @@ symbol::set_symtab (struct symtab *symtab)
|
|||
/* See symtab.h. */
|
||||
|
||||
CORE_ADDR
|
||||
get_symbol_address (const struct symbol *sym)
|
||||
symbol::get_maybe_copied_address () const
|
||||
{
|
||||
gdb_assert (sym->maybe_copied);
|
||||
gdb_assert (sym->aclass () == LOC_STATIC);
|
||||
gdb_assert (this->maybe_copied);
|
||||
gdb_assert (this->aclass () == LOC_STATIC);
|
||||
|
||||
const char *linkage_name = sym->linkage_name ();
|
||||
const char *linkage_name = this->linkage_name ();
|
||||
bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (linkage_name,
|
||||
false);
|
||||
if (minsym.minsym != nullptr)
|
||||
return minsym.value_address ();
|
||||
return sym->m_value.address;
|
||||
return this->m_value.address;
|
||||
}
|
||||
|
||||
/* See symtab.h. */
|
||||
|
|
17
gdb/symtab.h
17
gdb/symtab.h
|
@ -630,14 +630,6 @@ struct general_symbol_info
|
|||
|
||||
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
|
||||
|
||||
/* Return the address of SYM. The MAYBE_COPIED flag must be set on
|
||||
SYM. If SYM appears in the main program's minimal symbols, then
|
||||
that minsym's address is returned; otherwise, SYM's address is
|
||||
returned. This should generally only be used via the
|
||||
SYMBOL_VALUE_ADDRESS macro. */
|
||||
|
||||
extern CORE_ADDR get_symbol_address (const struct symbol *sym);
|
||||
|
||||
/* Try to determine the demangled name for a symbol, based on the
|
||||
language of that symbol. If the language is set to language_auto,
|
||||
it will attempt to find any demangling algorithm that works and
|
||||
|
@ -1359,7 +1351,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
|
|||
CORE_ADDR value_address () const
|
||||
{
|
||||
if (this->maybe_copied)
|
||||
return get_symbol_address (this);
|
||||
return this->get_maybe_copied_address ();
|
||||
else
|
||||
return m_value.address;
|
||||
}
|
||||
|
@ -1520,6 +1512,13 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
|
|||
void *aux_value = nullptr;
|
||||
|
||||
struct symbol *hash_next = nullptr;
|
||||
|
||||
private:
|
||||
/* Return the address of this symbol. The MAYBE_COPIED flag must be set.
|
||||
If the symbol appears in the main program's minimal symbols, then
|
||||
that minsym's address is returned; otherwise, this symbol's address is
|
||||
returned. */
|
||||
CORE_ADDR get_maybe_copied_address () const;
|
||||
};
|
||||
|
||||
/* Several lookup functions return both a symbol and the block in which the
|
||||
|
|
Loading…
Add table
Reference in a new issue