diff options
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 ()]); } |