diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-01-28 08:09:50 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-04-11 10:45:36 -0400 |
commit | 4aeddc50d7a06294cc124dfd8f43992ffa0b7382 (patch) | |
tree | 82c6a016c94112c6e5dc7cf763cc5641d91e6b6e /gdb/symtab.c | |
parent | 96d368d10456f5a599db759aab20e84a61f361f9 (diff) | |
download | gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.zip gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.tar.gz gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.tar.bz2 |
gdb: remove symbol value macros
Remove all macros related to getting and setting some symbol value:
#define SYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define SYMBOL_VALUE_ADDRESS(symbol) \
#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
#define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0)
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
#define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
Replace them with equivalent methods on the appropriate objects.
Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 3cc2d4f..d15eec8 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -414,6 +414,19 @@ compunit_language (const struct compunit_symtab *cust) return symtab->language (); } +/* The relocated address of the minimal symbol, using the section + offsets from OBJFILE. */ + +CORE_ADDR +minimal_symbol::value_address (objfile *objfile) const +{ + if (this->maybe_copied) + return get_msymbol_address (objfile, this); + else + return (this->value_raw_address () + + objfile->section_offsets[this->section_index ()]); +} + /* See symtab.h. */ bool @@ -1805,10 +1818,10 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) { case LOC_STATIC: case LOC_LABEL: - addr = SYMBOL_VALUE_ADDRESS (sym); + addr = sym->value_address (); break; case LOC_BLOCK: - addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + addr = BLOCK_ENTRY_PC (sym->value_block ()); break; default: @@ -3083,7 +3096,7 @@ find_symbol_at_address (CORE_ADDR address) ALL_BLOCK_SYMBOLS (b, iter, sym) { if (sym->aclass () == LOC_STATIC - && SYMBOL_VALUE_ADDRESS (sym) == addr) + && sym->value_address () == addr) return sym; } } @@ -3245,8 +3258,8 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) msymbol->linkage_name ()); */ ; /* fall through */ - else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) - == BMSYMBOL_VALUE_ADDRESS (msymbol)) + else if (mfunsym.value_address () + == msymbol.value_address ()) /* Avoid infinite recursion */ /* See above comment about why warning is commented out. */ /* warning ("In stub for %s; unable to find real function/line info", @@ -3258,12 +3271,12 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) /* Detect an obvious case of infinite recursion. If this should occur, we'd like to know about it, so error out, fatally. */ - if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc) + if (mfunsym.value_address () == pc) internal_error (__FILE__, __LINE__, _("Infinite recursion detected in find_pc_sect_line;" "please file a bug report")); - return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0); + return find_pc_line (mfunsym.value_address (), 0); } } @@ -3766,7 +3779,7 @@ find_function_start_sal (symbol *sym, bool funfirstline) { fixup_symbol_section (sym, NULL); symtab_and_line sal - = find_function_start_sal_1 (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)), + = find_function_start_sal_1 (BLOCK_ENTRY_PC (sym->value_block ()), sym->obj_section (symbol_objfile (sym)), funfirstline); sal.symbol = sym; @@ -3895,7 +3908,7 @@ skip_prologue_sal (struct symtab_and_line *sal) fixup_symbol_section (sym, NULL); objfile = symbol_objfile (sym); - pc = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + pc = BLOCK_ENTRY_PC (sym->value_block ()); section = sym->obj_section (objfile); name = sym->linkage_name (); } @@ -3908,7 +3921,7 @@ skip_prologue_sal (struct symtab_and_line *sal) return; objfile = msymbol.objfile; - pc = BMSYMBOL_VALUE_ADDRESS (msymbol); + pc = msymbol.value_address (); section = msymbol.minsym->obj_section (objfile); name = msymbol.minsym->linkage_name (); } @@ -3971,8 +3984,8 @@ skip_prologue_sal (struct symtab_and_line *sal) /* Check if gdbarch_skip_prologue left us in mid-line, and the next line is still part of the same function. */ if (skip && start_sal.pc != pc - && (sym ? (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end - && start_sal.end < BLOCK_END (SYMBOL_BLOCK_VALUE (sym))) + && (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end + && start_sal.end < BLOCK_END (sym->value_block ())) : (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym == lookup_minimal_symbol_by_pc_section (pc, section).minsym))) { @@ -4169,7 +4182,7 @@ find_function_alias_target (bound_minimal_symbol msymbol) symbol *sym = find_pc_function (func_addr); if (sym != NULL && sym->aclass () == LOC_BLOCK - && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == func_addr) + && BLOCK_ENTRY_PC (sym->value_block ()) == func_addr) return sym; return NULL; @@ -4822,8 +4835,7 @@ global_symbol_searcher::expand_symtabs the symbols tables are expanded. */ if (kind == FUNCTIONS_DOMAIN ? (find_pc_compunit_symtab - (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) - == NULL) + (msymbol->value_address (objfile)) == NULL) : (lookup_symbol_in_objfile_from_linkage_name (objfile, msymbol->linkage_name (), VAR_DOMAIN) @@ -4945,8 +4957,7 @@ global_symbol_searcher::add_matching_msymbols symbol might be found via find_pc_symtab. */ if (kind != FUNCTIONS_DOMAIN || (find_pc_compunit_symtab - (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) - == NULL)) + (msymbol->value_address (objfile)) == NULL)) { if (lookup_symbol_in_objfile_from_linkage_name (objfile, msymbol->linkage_name (), @@ -5168,11 +5179,11 @@ print_msymbol_info (struct bound_minimal_symbol msymbol) char *tmp; if (gdbarch_addr_bit (gdbarch) <= 32) - tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol) + tmp = hex_string_custom (msymbol.value_address () & (CORE_ADDR) 0xffffffff, 8); else - tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol), + tmp = hex_string_custom (msymbol.value_address (), 16); ui_file_style sym_style = (msymbol.minsym->text_p () @@ -5780,7 +5791,7 @@ find_gnu_ifunc (const symbol *sym) symbol_name_match_type::SEARCH_NAME); struct objfile *objfile = symbol_objfile (sym); - CORE_ADDR address = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + CORE_ADDR address = BLOCK_ENTRY_PC (sym->value_block ()); minimal_symbol *ifunc = NULL; iterate_over_minimal_symbols (objfile, lookup_name, @@ -5789,7 +5800,7 @@ find_gnu_ifunc (const symbol *sym) if (MSYMBOL_TYPE (minsym) == mst_text_gnu_ifunc || MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) { - CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym); + CORE_ADDR msym_addr = minsym->value_address (objfile); if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) { struct gdbarch *gdbarch = objfile->arch (); @@ -6634,9 +6645,9 @@ get_symbol_address (const struct symbol *sym) bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (linkage_name, objfile); if (minsym.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (minsym); + return minsym.value_address (); } - return sym->value.address; + return sym->m_value.address; } /* See symtab.h. */ @@ -6657,10 +6668,10 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym) bound_minimal_symbol found = lookup_minimal_symbol_linkage (linkage_name, objfile); if (found.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (found); + return found.value_address (); } } - return (minsym->value.address + return (minsym->m_value.address + objf->section_offsets[minsym->section_index ()]); } |