mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
Remove most calls to fixup_symbol_section
Nearly every call to fixup_symbol_section in gdb is incorrect, and if any such call has an effect, it's purely by happenstance. fixup_section has a long comment explaining that the call should only be made before runtime section offsets are applied. And, the loop in this code (the fallback loop -- the minsym lookup code is "ok") is careful to remove these offsets before comparing addresses. However, aside from a single call in dwarf2/read.c, every call in gdb is actually done after section offsets have been applied. So, these calls are incorrect. Now, these calls could be made when the symbol is created. I considered this approach, but I reasoned that the code has been this way for many years, seemingly without ill effect. So, instead I chose to simply remove the offending calls.
This commit is contained in:
@ -5389,9 +5389,7 @@ match_data::operator() (struct block_symbol *bsym)
|
|||||||
if (sym == NULL)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
if (!found_sym && arg_sym != NULL)
|
if (!found_sym && arg_sym != NULL)
|
||||||
add_defn_to_vec (*resultp,
|
add_defn_to_vec (*resultp, arg_sym, block);
|
||||||
fixup_symbol_section (arg_sym, objfile),
|
|
||||||
block);
|
|
||||||
found_sym = false;
|
found_sym = false;
|
||||||
arg_sym = NULL;
|
arg_sym = NULL;
|
||||||
}
|
}
|
||||||
@ -5404,9 +5402,7 @@ match_data::operator() (struct block_symbol *bsym)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_sym = true;
|
found_sym = true;
|
||||||
add_defn_to_vec (*resultp,
|
add_defn_to_vec (*resultp, sym, block);
|
||||||
fixup_symbol_section (sym, objfile),
|
|
||||||
block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -5808,9 +5804,7 @@ ada_lookup_symbol (const char *name, const struct block *block0,
|
|||||||
if (candidates.empty ())
|
if (candidates.empty ())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
block_symbol info = candidates[0];
|
return candidates[0];
|
||||||
info.symbol = fixup_symbol_section (info.symbol, NULL);
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6098,9 +6092,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_sym = true;
|
found_sym = true;
|
||||||
add_defn_to_vec (result,
|
add_defn_to_vec (result, sym, block);
|
||||||
fixup_symbol_section (sym, objfile),
|
|
||||||
block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6113,9 +6105,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||||||
|
|
||||||
if (!found_sym && arg_sym != NULL)
|
if (!found_sym && arg_sym != NULL)
|
||||||
{
|
{
|
||||||
add_defn_to_vec (result,
|
add_defn_to_vec (result, arg_sym, block);
|
||||||
fixup_symbol_section (arg_sym, objfile),
|
|
||||||
block);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lookup_name.ada ().wild_match_p ())
|
if (!lookup_name.ada ().wild_match_p ())
|
||||||
@ -6152,9 +6142,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_sym = true;
|
found_sym = true;
|
||||||
add_defn_to_vec (result,
|
add_defn_to_vec (result, sym, block);
|
||||||
fixup_symbol_section (sym, objfile),
|
|
||||||
block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6165,9 +6153,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
|
|||||||
They aren't parameters, right? */
|
They aren't parameters, right? */
|
||||||
if (!found_sym && arg_sym != NULL)
|
if (!found_sym && arg_sym != NULL)
|
||||||
{
|
{
|
||||||
add_defn_to_vec (result,
|
add_defn_to_vec (result, arg_sym, block);
|
||||||
fixup_symbol_section (arg_sym, objfile),
|
|
||||||
block);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9210,11 +9210,8 @@ resolve_sal_pc (struct symtab_and_line *sal)
|
|||||||
{
|
{
|
||||||
sym = block_linkage_function (b);
|
sym = block_linkage_function (b);
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
sal->section
|
||||||
fixup_symbol_section (sym, sal->symtab->compunit ()->objfile ());
|
= sym->obj_section (sal->symtab->compunit ()->objfile ());
|
||||||
sal->section
|
|
||||||
= sym->obj_section (sal->symtab->compunit ()->objfile ());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* It really is worthwhile to have the section, so we'll
|
/* It really is worthwhile to have the section, so we'll
|
||||||
|
@ -1106,7 +1106,6 @@ jump_command (const char *arg, int from_tty)
|
|||||||
{
|
{
|
||||||
struct obj_section *section;
|
struct obj_section *section;
|
||||||
|
|
||||||
fixup_symbol_section (sfn, 0);
|
|
||||||
section = sfn->obj_section (sfn->objfile ());
|
section = sfn->obj_section (sfn->objfile ());
|
||||||
if (section_is_overlay (section)
|
if (section_is_overlay (section)
|
||||||
&& !section_is_mapped (section))
|
&& !section_is_mapped (section))
|
||||||
|
@ -582,8 +582,6 @@ static void
|
|||||||
relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
||||||
const section_offsets &delta)
|
const section_offsets &delta)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, objfile);
|
|
||||||
|
|
||||||
/* The RS6000 code from which this was taken skipped
|
/* The RS6000 code from which this was taken skipped
|
||||||
any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
|
any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
|
||||||
But I'm leaving out that test, on the theory that
|
But I'm leaving out that test, on the theory that
|
||||||
|
@ -2252,7 +2252,7 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
|
|||||||
{
|
{
|
||||||
symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = %s",
|
symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = %s",
|
||||||
host_address_to_string (sym));
|
host_address_to_string (sym));
|
||||||
return fixup_symbol_section (sym, NULL);
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = NULL");
|
symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = NULL");
|
||||||
@ -2337,7 +2337,6 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
|
|||||||
("lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
|
("lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
|
||||||
host_address_to_string (other.symbol),
|
host_address_to_string (other.symbol),
|
||||||
host_address_to_string (other.block));
|
host_address_to_string (other.block));
|
||||||
other.symbol = fixup_symbol_section (other.symbol, objfile);
|
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2443,7 +2442,6 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
|
|||||||
host_address_to_string (result.symbol),
|
host_address_to_string (result.symbol),
|
||||||
host_address_to_string (block));
|
host_address_to_string (block));
|
||||||
|
|
||||||
result.symbol = fixup_symbol_section (result.symbol, objfile);
|
|
||||||
result.block = block;
|
result.block = block;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -2925,7 +2923,6 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
|
|||||||
const struct block *b = bv->block (b_index);
|
const struct block *b = bv->block (b_index);
|
||||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, obj_file);
|
|
||||||
if (matching_obj_sections (sym->obj_section (obj_file),
|
if (matching_obj_sections (sym->obj_section (obj_file),
|
||||||
section))
|
section))
|
||||||
break;
|
break;
|
||||||
@ -3668,7 +3665,6 @@ find_function_start_sal (CORE_ADDR func_addr, obj_section *section,
|
|||||||
symtab_and_line
|
symtab_and_line
|
||||||
find_function_start_sal (symbol *sym, bool funfirstline)
|
find_function_start_sal (symbol *sym, bool funfirstline)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, NULL);
|
|
||||||
symtab_and_line sal
|
symtab_and_line sal
|
||||||
= find_function_start_sal_1 (sym->value_block ()->entry_pc (),
|
= find_function_start_sal_1 (sym->value_block ()->entry_pc (),
|
||||||
sym->obj_section (sym->objfile ()),
|
sym->obj_section (sym->objfile ()),
|
||||||
@ -3796,8 +3792,6 @@ skip_prologue_sal (struct symtab_and_line *sal)
|
|||||||
sym = find_pc_sect_function (sal->pc, sal->section);
|
sym = find_pc_sect_function (sal->pc, sal->section);
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, NULL);
|
|
||||||
|
|
||||||
objfile = sym->objfile ();
|
objfile = sym->objfile ();
|
||||||
pc = sym->value_block ()->entry_pc ();
|
pc = sym->value_block ()->entry_pc ();
|
||||||
section = sym->obj_section (objfile);
|
section = sym->obj_section (objfile);
|
||||||
|
Reference in New Issue
Block a user