aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-01-13 09:27:54 -0700
committerTom Tromey <tromey@adacore.com>2023-02-08 08:20:12 -0700
commitdae58e04442670270fe116ff1f2e38a2b184b4a1 (patch)
tree04e2d5d13c4f771bb1d717c322aa48f76b4e3376 /gdb/symtab.c
parent5abbfa982215a5bcd2bf2c0b92cbb005464dc927 (diff)
downloadgdb-dae58e04442670270fe116ff1f2e38a2b184b4a1.zip
gdb-dae58e04442670270fe116ff1f2e38a2b184b4a1.tar.gz
gdb-dae58e04442670270fe116ff1f2e38a2b184b4a1.tar.bz2
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.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index bf3a3e3..d3b2edf 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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",
host_address_to_string (sym));
- return fixup_symbol_section (sym, NULL);
+ return sym;
}
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)",
host_address_to_string (other.symbol),
host_address_to_string (other.block));
- other.symbol = fixup_symbol_section (other.symbol, objfile);
return other;
}
@@ -2443,7 +2442,6 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
host_address_to_string (result.symbol),
host_address_to_string (block));
- result.symbol = fixup_symbol_section (result.symbol, objfile);
result.block = block;
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);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- fixup_symbol_section (sym, obj_file);
if (matching_obj_sections (sym->obj_section (obj_file),
section))
break;
@@ -3668,7 +3665,6 @@ find_function_start_sal (CORE_ADDR func_addr, obj_section *section,
symtab_and_line
find_function_start_sal (symbol *sym, bool funfirstline)
{
- fixup_symbol_section (sym, NULL);
symtab_and_line sal
= find_function_start_sal_1 (sym->value_block ()->entry_pc (),
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);
if (sym != NULL)
{
- fixup_symbol_section (sym, NULL);
-
objfile = sym->objfile ();
pc = sym->value_block ()->entry_pc ();
section = sym->obj_section (objfile);