aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-23 14:05:03 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-25 11:34:59 -0400
commitf9b96f673e6c442fe81cd1b5c27cb83ae50ae63b (patch)
treed5f57af71b6f7ad9271d33b3954b9bbe834da11c
parent23e6f781518fd600041fc12ce68a19c00b9018de (diff)
downloadgdb-f9b96f673e6c442fe81cd1b5c27cb83ae50ae63b.zip
gdb-f9b96f673e6c442fe81cd1b5c27cb83ae50ae63b.tar.gz
gdb-f9b96f673e6c442fe81cd1b5c27cb83ae50ae63b.tar.bz2
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>
-rw-r--r--gdb/symtab.c10
-rw-r--r--gdb/symtab.h17
2 files changed, 13 insertions, 14 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 96bc481..5ec56f4 100644
--- a/gdb/symtab.c
+++ b/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. */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 07f13e8..8dfc873 100644
--- a/gdb/symtab.h
+++ b/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