aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-10-15 13:28:57 -0600
committerTom Tromey <tromey@redhat.com>2014-02-26 12:11:17 -0700
commit2273f0ac95a79ce29ef42025c63f90e82cf907d7 (patch)
tree11a8d5d14c815bc74dacecdc0374fb082512ab13 /gdb/mdebugread.c
parent77e371c079408e265f1dfd2b0620dd8e76c23371 (diff)
downloadgdb-2273f0ac95a79ce29ef42025c63f90e82cf907d7.zip
gdb-2273f0ac95a79ce29ef42025c63f90e82cf907d7.tar.gz
gdb-2273f0ac95a79ce29ef42025c63f90e82cf907d7.tar.bz2
change minsyms not to be relocated at read-time
This removes the runtime offsets from minsyms. Instead, these offsets will now be applied whenever the minsym's address is computed. This patch redefines MSYMBOL_VALUE_ADDRESS to actually use the offsets from the given objfile. Then, it updates all the symbol readers, changing them so that they do not add in the section offset when creating the symbol. This change also lets us remove relocation of minsyms from objfile_relocate1 and also msymbols_sort. 2014-02-26 Tom Tromey <tromey@redhat.com> * minsyms.c (msymbols_sort): Remove. * minsyms.h (msymbols_sort): Remove. * objfiles.c (objfile_relocate1): Don't relocate minsyms. * symtab.h (MSYMBOL_VALUE_ADDRESS): Use objfile offsets. * elfread.c (elf_symtab_read): Don't add section offsets. * xcoffread.c (record_minimal_symbol): Don't add section offset to minimal symbol address. * somread.c (text_offset, data_offset): Remove. (som_symtab_read): Don't add section offsets to minimal symbol addresses. * coff-pe-read.c (add_pe_forwarded_sym, read_pe_exported_syms): Don't add section offsets to minimal symbols. * coffread.c (coff_symtab_read): Don't add section offsets to minimal symbol addresses. * machoread.c (macho_symtab_add_minsym): Don't add section offset to minimal symbol addresses. * mipsread.c (read_alphacoff_dynamic_symtab): Don't add section offset to minimal symbol addresses. * mdebugread.c (parse_partial_symbols): Don't add section offset to minimal symbol addresses. * dbxread.c (read_dbx_dynamic_symtab): Don't add section offset to minimal symbol addresses.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 5cb8d86..94af07b 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2519,14 +2519,10 @@ parse_partial_symbols (struct objfile *objfile)
{
case stProc:
/* Beginnning of Procedure */
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stStaticProc:
/* Load time only static procs */
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stGlobal:
/* External symbol */
@@ -2539,20 +2535,14 @@ parse_partial_symbols (struct objfile *objfile)
else if (SC_IS_DATA (ext_in->asym.sc))
{
ms_type = mst_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- get_section_index (objfile, ".sbss"));
}
else
ms_type = mst_abs;
@@ -2585,8 +2575,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
}
else if (SC_IS_DATA (ext_in->asym.sc))
{
@@ -2594,8 +2582,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
@@ -2603,8 +2589,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
@@ -2614,7 +2598,6 @@ parse_partial_symbols (struct objfile *objfile)
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index);
}
else
ms_type = mst_abs;
@@ -2748,8 +2731,6 @@ parse_partial_symbols (struct objfile *objfile)
CORE_ADDR procaddr;
long isym;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
if (sh.st == stStaticProc)
{
namestring = debug_info->ss + fh->issBase + sh.iss;
@@ -2757,6 +2738,8 @@ parse_partial_symbols (struct objfile *objfile)
mst_file_text, sh.sc,
objfile);
}
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
procaddr = sh.value;
isym = AUX_GET_ISYM (fh->fBigendian,
@@ -2796,22 +2779,22 @@ parse_partial_symbols (struct objfile *objfile)
case scPData:
case scXData:
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_data, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_DATA (objfile));
break;
default:
/* FIXME! Shouldn't this use cases for bss,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_bss, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_BSS (objfile));
break;
}
}
@@ -3435,6 +3418,7 @@ parse_partial_symbols (struct objfile *objfile)
{
char *name;
enum address_class class;
+ CORE_ADDR minsym_value;
(*swap_sym_in) (cur_bfd,
((char *) debug_info->external_sym
@@ -3460,6 +3444,8 @@ parse_partial_symbols (struct objfile *objfile)
name = debug_info->ss + fh->issBase + sh.iss;
+ minsym_value = sh.value;
+
switch (sh.sc)
{
case scText:
@@ -3492,7 +3478,7 @@ parse_partial_symbols (struct objfile *objfile)
int new_sdx;
case stStaticProc:
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_text,
SECT_OFF_TEXT (objfile),
objfile);
@@ -3578,12 +3564,12 @@ parse_partial_symbols (struct objfile *objfile)
case stStatic: /* Variable */
if (SC_IS_DATA (sh.sc))
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_data,
SECT_OFF_DATA (objfile),
objfile);
else
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_bss,
SECT_OFF_BSS (objfile),
objfile);