@@ -993,7 +993,7 @@ find_stab_function_addr (const char *namestring, const char *filename,
msym = lookup_minimal_symbol (p, NULL, objfile);
}
- return msym.minsym == NULL ? 0 : BMSYMBOL_VALUE_ADDRESS (msym);
+ return msym.minsym == NULL ? 0 : MSYMBOL_VALUE_RAW_ADDRESS (msym.minsym);
}
static void
@@ -1187,18 +1187,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
|| (namestring[(nsl = strlen (namestring)) - 1] == 'o'
&& namestring[nsl - 2] == '.'))
{
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
-
if (past_first_source_file && pst
/* The gould NP1 uses low values for .o and -l symbols
which are not the address. */
- && nlist.n_value >= PSYMTAB_TEXTLOW (pst))
+ && nlist.n_value >= PSYMTAB_RAW_TEXTLOW (pst))
{
dbx_end_psymtab (objfile, pst, psymtab_include_list,
includes_used, symnum * symbol_size,
- nlist.n_value > PSYMTAB_TEXTHIGH (pst)
- ? nlist.n_value : PSYMTAB_TEXTHIGH (pst),
+ nlist.n_value > PSYMTAB_RAW_TEXTHIGH (pst)
+ ? nlist.n_value : PSYMTAB_RAW_TEXTHIGH (pst),
dependency_list, dependencies_used,
textlow_not_set);
pst = (struct partial_symtab *) 0;
@@ -1285,8 +1282,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
static const char *dirname_nso;
int prev_textlow_not_set;
- valu = nlist.n_value + ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
+ valu = nlist.n_value;
prev_textlow_not_set = textlow_not_set;
@@ -1313,8 +1309,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
{
dbx_end_psymtab (objfile, pst, psymtab_include_list,
includes_used, symnum * symbol_size,
- (valu > PSYMTAB_TEXTHIGH (pst)
- ? valu : PSYMTAB_TEXTHIGH (pst)),
+ (valu > PSYMTAB_RAW_TEXTHIGH (pst)
+ ? valu : PSYMTAB_RAW_TEXTHIGH (pst)),
dependency_list, dependencies_used,
prev_textlow_not_set);
pst = (struct partial_symtab *) 0;
@@ -1489,7 +1485,8 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
function relative stabs, or the address of the function's
end for old style stabs. */
valu = nlist.n_value + last_function_start;
- if (PSYMTAB_TEXTHIGH (pst) == 0 || valu > PSYMTAB_TEXTHIGH (pst))
+ if (PSYMTAB_RAW_TEXTHIGH (pst) == 0
+ || valu > PSYMTAB_RAW_TEXTHIGH (pst))
SET_PSYMTAB_TEXTHIGH (pst, valu);
break;
}
@@ -1529,25 +1526,22 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
switch (p[1])
{
case 'S':
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- data_sect_index);
-
if (gdbarch_static_transform_name_p (gdbarch))
gdbarch_static_transform_name (gdbarch, namestring);
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_STATIC,
+ data_sect_index,
&objfile->static_psymbols,
nlist.n_value, psymtab_language, objfile);
continue;
case 'G':
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- data_sect_index);
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_STATIC,
+ data_sect_index,
&objfile->global_psymbols,
nlist.n_value, psymtab_language, objfile);
continue;
@@ -1564,14 +1558,14 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
&& namestring[0] != ' '))
{
add_psymbol_to_list (sym_name, sym_len, 1,
- STRUCT_DOMAIN, LOC_TYPEDEF,
+ STRUCT_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
add_psymbol_to_list (sym_name, sym_len, 1,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
p += 1;
@@ -1583,7 +1577,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
if (p != namestring) /* a name is there, not just :T... */
{
add_psymbol_to_list (sym_name, sym_len, 1,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
}
@@ -1644,7 +1638,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
add_psymbol_to_list (p, q - p, 1,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols, 0,
psymtab_language, objfile);
/* Point past the name. */
@@ -1662,7 +1656,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
case 'c':
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (sym_name, sym_len, 1,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols, 0,
psymtab_language, objfile);
continue;
@@ -1678,14 +1672,11 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
/* Kludges for ELF/STABS with Sun ACC. */
last_function_name = namestring;
/* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (nlist.n_value == ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))
+ if (nlist.n_value == 0
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
CORE_ADDR minsym_valu =
@@ -1719,16 +1710,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
the partial symbol table. */
if (pst
&& (textlow_not_set
- || (nlist.n_value < PSYMTAB_TEXTLOW (pst)
- && (nlist.n_value
- != ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))))))
+ || (nlist.n_value < PSYMTAB_RAW_TEXTLOW (pst)
+ && (nlist.n_value != 0))))
{
SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
textlow_not_set = 0;
}
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
nlist.n_value, psymtab_language, objfile);
continue;
@@ -1747,14 +1737,11 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- nlist.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
/* Kludges for ELF/STABS with Sun ACC. */
last_function_name = namestring;
/* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (nlist.n_value == ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))
+ if (nlist.n_value == 0
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
CORE_ADDR minsym_valu =
@@ -1788,16 +1775,15 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
the partial symbol table. */
if (pst
&& (textlow_not_set
- || (nlist.n_value < PSYMTAB_TEXTLOW (pst)
- && (nlist.n_value
- != ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile))))))
+ || (nlist.n_value < PSYMTAB_RAW_TEXTLOW (pst)
+ && (nlist.n_value != 0))))
{
SET_PSYMTAB_TEXTLOW (pst, nlist.n_value);
textlow_not_set = 0;
}
add_psymbol_to_list (sym_name, sym_len, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
nlist.n_value, psymtab_language, objfile);
continue;
@@ -1973,15 +1959,14 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
/* Don't set pst->texthigh lower than it already is. */
CORE_ADDR text_end =
(lowest_text_address == (CORE_ADDR) -1
- ? (text_addr + ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile)))
+ ? text_addr
: lowest_text_address)
+ text_size;
dbx_end_psymtab (objfile, pst, psymtab_include_list, includes_used,
symnum * symbol_size,
- (text_end > PSYMTAB_TEXTHIGH (pst)
- ? text_end : PSYMTAB_TEXTHIGH (pst)),
+ (text_end > PSYMTAB_RAW_TEXTHIGH (pst)
+ ? text_end : PSYMTAB_RAW_TEXTHIGH (pst)),
dependency_list, dependencies_used, textlow_not_set);
}
@@ -2055,7 +2040,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
a reliable texthigh by taking the address plus size of the
last function in the file. */
- if (PSYMTAB_TEXTHIGH (pst) == 0 && last_function_name
+ if (PSYMTAB_RAW_TEXTHIGH (pst) == 0 && last_function_name
&& gdbarch_sofun_address_maybe_missing (gdbarch))
{
int n;
@@ -2082,7 +2067,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
}
if (minsym.minsym)
- SET_PSYMTAB_TEXTHIGH (pst, (BMSYMBOL_VALUE_ADDRESS (minsym)
+ SET_PSYMTAB_TEXTHIGH (pst, (MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym)
+ MSYMBOL_SIZE (minsym.minsym)));
last_function_name = NULL;
@@ -2092,7 +2077,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
;
/* This test will be true if the last .o file is only data. */
else if (textlow_not_set)
- SET_PSYMTAB_TEXTLOW (pst, PSYMTAB_TEXTHIGH (pst));
+ SET_PSYMTAB_TEXTLOW (pst, PSYMTAB_RAW_TEXTHIGH (pst));
else
{
struct partial_symtab *p1;
@@ -2105,7 +2090,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
ALL_OBJFILE_PSYMTABS (objfile, p1)
{
if (!p1->texthigh_valid && p1->textlow_valid && p1 != pst)
- SET_PSYMTAB_TEXTHIGH (p1, PSYMTAB_TEXTLOW (pst));
+ SET_PSYMTAB_TEXTHIGH (p1, PSYMTAB_RAW_TEXTLOW (pst));
}
}
@@ -2296,8 +2281,8 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
sym_offset = LDSYMOFF (pst);
sym_size = LDSYMLEN (pst);
- text_offset = PSYMTAB_TEXTLOW (pst);
- text_size = PSYMTAB_TEXTHIGH (pst) - PSYMTAB_TEXTLOW (pst);
+ text_offset = PSYMTAB_TEXTLOW (objfile, pst);
+ text_size = PSYMTAB_TEXTHIGH (objfile, pst) - PSYMTAB_TEXTLOW (objfile, pst);
section_offsets = objfile->section_offsets;
dbxread_objfile = objfile;
@@ -427,12 +427,8 @@ static void
add_address_entry (struct objfile *objfile, data_buf &addr_vec,
CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
{
- CORE_ADDR baseaddr;
-
- baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-
- addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start - baseaddr);
- addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, end - baseaddr);
+ addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start);
+ addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, end);
addr_vec.append_data (MAYBE_SWAP (cu_index));
}
@@ -3178,8 +3178,8 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
continue;
}
- lo = gdbarch_adjust_dwarf2_addr (gdbarch, lo + baseaddr);
- hi = gdbarch_adjust_dwarf2_addr (gdbarch, hi + baseaddr);
+ lo = gdbarch_adjust_dwarf2_addr (gdbarch, lo + baseaddr) - baseaddr;
+ hi = gdbarch_adjust_dwarf2_addr (gdbarch, hi + baseaddr) - baseaddr;
addrmap_set_empty (mutable_map, lo, hi - 1,
dwarf2_per_objfile->get_cu (cu_index));
}
@@ -3337,8 +3337,10 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile,
continue;
}
ULONGEST end = start + length;
- start = gdbarch_adjust_dwarf2_addr (gdbarch, start + baseaddr);
- end = gdbarch_adjust_dwarf2_addr (gdbarch, end + baseaddr);
+ start = (gdbarch_adjust_dwarf2_addr (gdbarch, start + baseaddr)
+ - baseaddr);
+ end = (gdbarch_adjust_dwarf2_addr (gdbarch, end + baseaddr)
+ - baseaddr);
addrmap_set_empty (mutable_map, start, end - 1, per_cu);
}
}
@@ -4106,14 +4108,6 @@ dw2_dump (struct objfile *objfile)
}
static void
-dw2_relocate (struct objfile *objfile,
- const struct section_offsets *new_offsets,
- const struct section_offsets *delta)
-{
- /* There's nothing to relocate here. */
-}
-
-static void
dw2_expand_symtabs_for_function (struct objfile *objfile,
const char *func_name)
{
@@ -5240,8 +5234,10 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile,
if (!objfile->psymtabs_addrmap)
return NULL;
+ CORE_ADDR baseaddr;
+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
data = (struct dwarf2_per_cu_data *) addrmap_find (objfile->psymtabs_addrmap,
- pc);
+ pc - baseaddr);
if (!data)
return NULL;
@@ -5338,7 +5334,6 @@ const struct quick_symbol_functions dwarf2_gdb_index_functions =
dw2_lookup_symbol,
dw2_print_stats,
dw2_dump,
- dw2_relocate,
dw2_expand_symtabs_for_function,
dw2_expand_all_symtabs,
dw2_expand_symtabs_with_fullname,
@@ -6159,7 +6154,6 @@ const struct quick_symbol_functions dwarf2_debug_names_functions =
dw2_debug_names_lookup_symbol,
dw2_print_stats,
dw2_debug_names_dump,
- dw2_relocate,
dw2_debug_names_expand_symtabs_for_function,
dw2_expand_all_symtabs,
dw2_expand_symtabs_with_fullname,
@@ -6557,7 +6551,7 @@ dwarf2_build_include_psymtabs (struct dwarf2_cu *cu,
/* NOTE: pst->dirname is DW_AT_comp_dir (if present). */
dwarf_decode_lines (lh.get (), pst->dirname, cu, pst,
- PSYMTAB_TEXTLOW (pst), 1);
+ PSYMTAB_RAW_TEXTLOW (pst), 1);
}
static hashval_t
@@ -7941,14 +7935,17 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
&best_highpc, cu, pst);
if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
- /* Store the contiguous range if it is not empty; it can be empty for
- CUs with no code. */
- addrmap_set_empty (objfile->psymtabs_addrmap,
- gdbarch_adjust_dwarf2_addr (gdbarch,
- best_lowpc + baseaddr),
- gdbarch_adjust_dwarf2_addr (gdbarch,
- best_highpc + baseaddr) - 1,
- pst);
+ {
+ CORE_ADDR low
+ = (gdbarch_adjust_dwarf2_addr (gdbarch, best_lowpc + baseaddr)
+ - baseaddr);
+ CORE_ADDR high
+ = (gdbarch_adjust_dwarf2_addr (gdbarch, best_highpc + baseaddr)
+ - baseaddr - 1);
+ /* Store the contiguous range if it is not empty; it can be
+ empty for CUs with no code. */
+ addrmap_set_empty (objfile->psymtabs_addrmap, low, high, pst);
+ }
/* Check if comp unit has_children.
If so, read the rest of the partial symbols from this comp unit.
@@ -7981,10 +7978,12 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
}
SET_PSYMTAB_TEXTLOW (pst,
gdbarch_adjust_dwarf2_addr (gdbarch,
- best_lowpc + baseaddr));
+ best_lowpc + baseaddr)
+ - baseaddr);
SET_PSYMTAB_TEXTHIGH (pst,
gdbarch_adjust_dwarf2_addr (gdbarch,
- best_highpc + baseaddr));
+ best_highpc + baseaddr)
+ - baseaddr);
end_psymtab_common (objfile, pst);
@@ -8021,8 +8020,8 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
", %d global, %d static syms\n",
per_cu->is_debug_types ? "type" : "comp",
sect_offset_str (per_cu->sect_off),
- paddress (gdbarch, PSYMTAB_TEXTLOW (pst)),
- paddress (gdbarch, PSYMTAB_TEXTHIGH (pst)),
+ paddress (gdbarch, PSYMTAB_TEXTLOW (objfile, pst)),
+ paddress (gdbarch, PSYMTAB_TEXTHIGH (objfile, pst)),
pst->n_global_syms, pst->n_static_syms);
}
}
@@ -8817,7 +8816,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
{
case DW_TAG_inlined_subroutine:
case DW_TAG_subprogram:
- addr = gdbarch_adjust_dwarf2_addr (gdbarch, pdi->lowpc + baseaddr);
+ addr = (gdbarch_adjust_dwarf2_addr (gdbarch, pdi->lowpc + baseaddr)
+ - baseaddr);
if (pdi->is_external || cu->language == language_ada)
{
/* brobecker/2007-12-26: Normally, only "external" DIEs are part
@@ -8827,16 +8827,20 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
- addr, cu->language, objfile);
+ addr,
+ cu->language, objfile);
}
else
{
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
- addr, cu->language, objfile);
+ addr,
+ cu->language, objfile);
}
if (pdi->main_subprogram && actual_name != NULL)
@@ -8852,7 +8856,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
list = &objfile->static_psymbols;
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
- list, 0, cu->language, objfile);
+ -1, list, 0, cu->language, objfile);
}
break;
case DW_TAG_variable:
@@ -8887,8 +8891,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
- addr + baseaddr,
+ addr,
cu->language, objfile);
}
else
@@ -8906,8 +8911,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
- has_loc ? addr + baseaddr : (CORE_ADDR) 0,
+ has_loc ? addr : 0,
cu->language, objfile);
}
break;
@@ -8916,7 +8922,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
case DW_TAG_subrange_type:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, cu->language, objfile);
break;
@@ -8924,14 +8930,14 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
case DW_TAG_namespace:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->global_psymbols,
0, cu->language, objfile);
break;
case DW_TAG_module:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
- MODULE_DOMAIN, LOC_TYPEDEF,
+ MODULE_DOMAIN, LOC_TYPEDEF, -1,
&objfile->global_psymbols,
0, cu->language, objfile);
break;
@@ -8955,7 +8961,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
static vs. global. */
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
- STRUCT_DOMAIN, LOC_TYPEDEF,
+ STRUCT_DOMAIN, LOC_TYPEDEF, -1,
cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
@@ -8965,7 +8971,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
case DW_TAG_enumerator:
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
@@ -9048,10 +9054,12 @@ add_partial_subprogram (struct partial_die_info *pdi,
baseaddr = ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
- lowpc = gdbarch_adjust_dwarf2_addr (gdbarch,
- pdi->lowpc + baseaddr);
- highpc = gdbarch_adjust_dwarf2_addr (gdbarch,
- pdi->highpc + baseaddr);
+ lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
+ pdi->lowpc + baseaddr)
+ - baseaddr);
+ highpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
+ pdi->highpc + baseaddr)
+ - baseaddr);
addrmap_set_empty (objfile->psymtabs_addrmap, lowpc, highpc - 1,
cu->per_cu->v.psymtab);
}
@@ -18296,7 +18304,7 @@ load_partial_dies (const struct die_reader_specs *reader,
{
if (building_psymtab && pdi.name != NULL)
add_psymbol_to_list (pdi.name, strlen (pdi.name), 0,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, cu->language, objfile);
info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr);
@@ -18332,7 +18340,7 @@ load_partial_dies (const struct die_reader_specs *reader,
_("malformed enumerator DIE ignored"));
else if (building_psymtab)
add_psymbol_to_list (pdi.name, strlen (pdi.name), 0,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
cu->language == language_cplus
? &objfile->global_psymbols
: &objfile->static_psymbols,
@@ -2177,12 +2177,9 @@ parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
numbers can go back and forth, apparently we can live
with that and do not need to reorder our linetables. */
-static void parse_lines (FDR *, PDR *, struct linetable *, int,
- struct partial_symtab *, CORE_ADDR);
-
static void
parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
- struct partial_symtab *pst, CORE_ADDR lowest_pdr_addr)
+ CORE_ADDR textlow, CORE_ADDR lowest_pdr_addr)
{
unsigned char *base;
int j, k;
@@ -2213,7 +2210,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
halt = base + fh->cbLine;
base += pr->cbLineOffset;
- adr = PSYMTAB_TEXTLOW (pst) + pr->adr - lowest_pdr_addr;
+ adr = textlow + pr->adr - lowest_pdr_addr;
l = adr >> 2; /* in words */
for (lineno = pr->lnLow; base < halt;)
@@ -2646,12 +2643,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Determine the start address for this object file from the
file header and relocate it, except for Irix 5.2 zero fh->adr. */
if (fh->cpd)
- {
- textlow = fh->adr;
- if (relocatable || textlow != 0)
- textlow += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
- }
+ textlow = fh->adr;
else
textlow = 0;
pst = start_psymtab_common (objfile,
@@ -2699,7 +2691,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
psymtab_language = prev_language;
PST_PRIVATE (pst)->pst_language = psymtab_language;
- SET_PSYMTAB_TEXTHIGH (pst, PSYMTAB_TEXTLOW (pst));
+ SET_PSYMTAB_TEXTHIGH (pst, PSYMTAB_RAW_TEXTLOW (pst));
/* For stabs-in-ecoff files, the second symbol must be @stab.
This symbol is emitted by mips-tfile to signal that the
@@ -2745,8 +2737,6 @@ parse_partial_symbols (minimal_symbol_reader &reader,
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,
@@ -2765,9 +2755,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Kludge for Irix 5.2 zero fh->adr. */
if (!relocatable
&& (!pst->textlow_valid
- || procaddr < PSYMTAB_TEXTLOW (pst)))
+ || procaddr < PSYMTAB_RAW_TEXTLOW (pst)))
SET_PSYMTAB_TEXTLOW (pst, procaddr);
- if (high > PSYMTAB_TEXTHIGH (pst))
+ if (high > PSYMTAB_RAW_TEXTHIGH (pst))
SET_PSYMTAB_TEXTHIGH (pst, high);
}
}
@@ -2790,8 +2780,6 @@ parse_partial_symbols (minimal_symbol_reader &reader,
record_minimal_symbol (reader, namestring, sh.value,
mst_file_data, sh.sc,
objfile);
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
break;
default:
@@ -2801,8 +2789,6 @@ parse_partial_symbols (minimal_symbol_reader &reader,
record_minimal_symbol (reader, namestring, sh.value,
mst_file_bss, sh.sc,
objfile);
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
break;
}
}
@@ -2855,22 +2841,16 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case N_TEXT | N_EXT:
case N_NBTEXT | N_EXT:
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
goto record_it;
case N_DATA | N_EXT:
case N_NBDATA | N_EXT:
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
goto record_it;
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
case N_SETV | N_EXT: /* FIXME, is this in BSS? */
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
goto record_it;
case N_ABS | N_EXT:
@@ -2893,8 +2873,6 @@ parse_partial_symbols (minimal_symbol_reader &reader,
continue;
case N_DATA:
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
goto record_it;
case N_UNDF | N_EXT:
@@ -3095,27 +3073,24 @@ parse_partial_symbols (minimal_symbol_reader &reader,
switch (p[1])
{
case 'S':
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
-
if (gdbarch_static_transform_name_p (gdbarch))
namestring = gdbarch_static_transform_name
(gdbarch, namestring);
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_DATA (objfile),
&objfile->static_psymbols,
sh.value,
psymtab_language, objfile);
continue;
case 'G':
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
/* The addresses in these entries are reported
to be wrong. See the code that reads 'G's
for symtabs. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_DATA (objfile),
&objfile->global_psymbols,
sh.value,
psymtab_language, objfile);
@@ -3134,6 +3109,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
{
add_psymbol_to_list (namestring, p - namestring, 1,
STRUCT_DOMAIN, LOC_TYPEDEF,
+ -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
if (p[2] == 't')
@@ -3142,6 +3118,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
add_psymbol_to_list (namestring,
p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
+ -1,
&objfile->static_psymbols,
0, psymtab_language,
objfile);
@@ -3155,6 +3132,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
{
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
+ -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
}
@@ -3219,6 +3197,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
symtabs. */
add_psymbol_to_list (p, q - p, 1,
VAR_DOMAIN, LOC_CONST,
+ -1,
&objfile->static_psymbols,
0, psymtab_language,
objfile);
@@ -3236,7 +3215,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case 'c':
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (namestring, p - namestring, 1,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
continue;
@@ -3252,10 +3231,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
sh.value,
psymtab_language, objfile);
@@ -3276,10 +3254,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
sh.value,
psymtab_language, objfile);
@@ -3352,7 +3329,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
continue;
case N_RBRAC:
- if (sh.value > PSYMTAB_TEXTHIGH (save_pst))
+ if (sh.value > PSYMTAB_RAW_TEXTHIGH (save_pst))
SET_PSYMTAB_TEXTHIGH (save_pst, sh.value);
continue;
case N_EINCL:
@@ -3409,6 +3386,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
char *name;
enum address_class theclass;
CORE_ADDR minsym_value;
+ short section = -1;
(*swap_sym_in) (cur_bfd,
((char *) debug_info->external_sym
@@ -3443,21 +3421,18 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* The value of a stEnd symbol is the displacement from the
corresponding start symbol value, do not relocate it. */
if (sh.st != stEnd)
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
+ section = SECT_OFF_TEXT (objfile);
break;
case scData:
case scSData:
case scRData:
case scPData:
case scXData:
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
+ section = SECT_OFF_DATA (objfile);
break;
case scBss:
case scSBss:
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
+ section = SECT_OFF_BSS (objfile);
break;
}
@@ -3522,11 +3497,13 @@ parse_partial_symbols (minimal_symbol_reader &reader,
if (sh.st == stProc)
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, LOC_BLOCK,
+ section,
&objfile->global_psymbols,
sh.value, psymtab_language, objfile);
else
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, LOC_BLOCK,
+ section,
&objfile->static_psymbols,
sh.value, psymtab_language, objfile);
@@ -3544,11 +3521,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Kludge for Irix 5.2 zero fh->adr. */
if (!relocatable
&& (!pst->textlow_valid
- || procaddr < PSYMTAB_TEXTLOW (pst)))
+ || procaddr < PSYMTAB_RAW_TEXTLOW (pst)))
SET_PSYMTAB_TEXTLOW (pst, procaddr);
high = procaddr + sh.value;
- if (high > PSYMTAB_TEXTHIGH (pst))
+ if (high > PSYMTAB_RAW_TEXTHIGH (pst))
SET_PSYMTAB_TEXTHIGH (pst, high);
continue;
@@ -3592,7 +3569,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
&& sh.index != cur_sdx + 2)
{
add_psymbol_to_list (name, strlen (name), 1,
- STRUCT_DOMAIN, LOC_TYPEDEF,
+ STRUCT_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
}
@@ -3632,7 +3609,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
}
/* Use this gdb symbol. */
add_psymbol_to_list (name, strlen (name), 1,
- VAR_DOMAIN, theclass,
+ VAR_DOMAIN, theclass, section,
&objfile->static_psymbols,
sh.value, psymtab_language, objfile);
skip:
@@ -3650,6 +3627,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
SYMR *psh;
char *name;
CORE_ADDR svalue;
+ short section;
if (ext_ptr->ifd != f_idx)
internal_error (__FILE__, __LINE__,
@@ -3663,23 +3641,21 @@ parse_partial_symbols (minimal_symbol_reader &reader,
svalue = psh->value;
switch (psh->sc)
{
+ default:
case scText:
case scRConst:
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
+ section = SECT_OFF_TEXT (objfile);
break;
case scData:
case scSData:
case scRData:
case scPData:
case scXData:
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
+ section = SECT_OFF_DATA (objfile);
break;
case scBss:
case scSBss:
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
+ section = SECT_OFF_BSS (objfile);
break;
}
@@ -3713,6 +3689,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
name = debug_info->ssext + psh->iss;
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, theclass,
+ section,
&objfile->global_psymbols,
svalue, psymtab_language, objfile);
}
@@ -3723,7 +3700,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
fdr_to_pst[f_idx].pst
= dbx_end_psymtab (objfile, save_pst,
psymtab_include_list, includes_used,
- -1, PSYMTAB_TEXTHIGH (save_pst),
+ -1, PSYMTAB_RAW_TEXTHIGH (save_pst),
dependency_list, dependencies_used,
textlow_not_set);
includes_used = 0;
@@ -3748,9 +3725,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
ALL_OBJFILE_PSYMTABS (objfile, pst)
{
if (save_pst != pst
- && PSYMTAB_TEXTLOW (save_pst) >= PSYMTAB_TEXTLOW (pst)
- && PSYMTAB_TEXTLOW (save_pst) < PSYMTAB_TEXTHIGH (pst)
- && PSYMTAB_TEXTHIGH (save_pst) > PSYMTAB_TEXTHIGH (pst))
+ && PSYMTAB_RAW_TEXTLOW (save_pst) >= PSYMTAB_RAW_TEXTLOW (pst)
+ && PSYMTAB_RAW_TEXTLOW (save_pst) < PSYMTAB_RAW_TEXTHIGH (pst)
+ && PSYMTAB_RAW_TEXTHIGH (save_pst) > PSYMTAB_RAW_TEXTHIGH (pst))
{
objfile->flags |= OBJF_REORDERED;
break;
@@ -3877,9 +3854,9 @@ handle_psymbol_enumerators (struct objfile *objfile, FDR *fh, int stype,
/* Note that the value doesn't matter for enum constants
in psymtabs, just in symtabs. */
add_psymbol_to_list (name, strlen (name), 1,
- VAR_DOMAIN, LOC_CONST,
- &objfile->static_psymbols,
- 0, psymtab_language, objfile);
+ VAR_DOMAIN, LOC_CONST, -1,
+ &objfile->static_psymbols, 0,
+ psymtab_language, objfile);
ext_sym += external_sym_size;
}
}
@@ -4109,7 +4086,8 @@ psymtab_to_symtab_1 (struct objfile *objfile,
if (! last_symtab_ended)
{
- cust = end_symtab (PSYMTAB_TEXTHIGH (pst), SECT_OFF_TEXT (objfile));
+ cust = end_symtab (PSYMTAB_TEXTHIGH (objfile, pst),
+ SECT_OFF_TEXT (objfile));
end_stabs ();
}
@@ -4190,7 +4168,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
top_stack->cur_st = COMPUNIT_FILETABS (cust);
top_stack->cur_block
= BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), STATIC_BLOCK);
- BLOCK_START (top_stack->cur_block) = PSYMTAB_TEXTLOW (pst);
+ BLOCK_START (top_stack->cur_block) = PSYMTAB_TEXTLOW (objfile, pst);
BLOCK_END (top_stack->cur_block) = 0;
top_stack->blocktype = stFile;
top_stack->cur_type = 0;
@@ -4255,7 +4233,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
}
parse_lines (fh, pr_block, lines, maxlines,
- pst, lowest_pdr_addr);
+ PSYMTAB_TEXTLOW (objfile, pst), lowest_pdr_addr);
if (lines->nitems < fh->cline)
lines = shrink_linetable (lines);
@@ -846,6 +846,10 @@ objfile_relocate1 (struct objfile *objfile,
}
}
+ /* This stores relocated addresses and so must be cleared. This
+ will cause it to be recreated on demand. */
+ objfile->psymbol_map.clear ();
+
/* Relocate isolated symbols. */
{
struct symbol *iter;
@@ -854,13 +858,6 @@ objfile_relocate1 (struct objfile *objfile,
relocate_one_symbol (iter, objfile, delta);
}
- if (objfile->psymtabs_addrmap)
- addrmap_relocate (objfile->psymtabs_addrmap,
- ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
-
- if (objfile->sf)
- objfile->sf->qf->relocate (objfile, new_offsets, delta);
-
{
int i;
@@ -56,7 +56,7 @@ struct partial_symbol
#define PSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->pginfo.value.address + 0)
#define PSYMBOL_VALUE_ADDRESS(objfile, symbol) \
((symbol)->pginfo.value.address \
- + (0 * (ANOFFSET ((objfile)->section_offsets, ((symbol)->pginfo.section)))))
+ + (ANOFFSET ((objfile)->section_offsets, ((symbol)->pginfo.section))))
#define PSYMBOL_LANGUAGE(symbol) (symbol)->pginfo.language
#define PSYMBOL_SECTION(symbol) (symbol)->pginfo.section
#define PSYMBOL_OBJ_SECTION(objfile, symbol) \
@@ -243,8 +243,15 @@ struct partial_symtab
(ANOFFSET ((OBJF)->section_offsets, (INDEX)) \
+ ((((OFFS) == NULL)) ? 0 : ANOFFSET ((OFFS), (INDEX))))
-#define PSYMTAB_TEXTLOW(PST) ((PST)->textlow_ + 0)
-#define PSYMTAB_TEXTHIGH(PST) ((PST)->texthigh_ + 0)
+#define PSYMTAB_RAW_TEXTLOW(PST) ((PST)->textlow_ + 0)
+#define PSYMTAB_RAW_TEXTHIGH(PST) ((PST)->texthigh_ + 0)
+
+#define PSYMTAB_TEXTLOW(OBJFILE, PST) \
+ ((PST)->textlow_ \
+ + ANOFFSET ((OBJFILE)->section_offsets, SECT_OFF_TEXT (OBJFILE)))
+#define PSYMTAB_TEXTHIGH(OBJFILE, PST) \
+ ((PST)->texthigh_ \
+ + ANOFFSET ((OBJFILE)->section_offsets, SECT_OFF_TEXT (OBJFILE)))
/* Set the "textlow" field on the partial symbol table, and mark the
field as valid. */
@@ -274,6 +281,7 @@ set_psymtab_texthigh (struct partial_symtab *pst, CORE_ADDR high)
extern void add_psymbol_to_list (const char *, int,
int, domain_enum,
enum address_class,
+ short /* section */,
std::vector<partial_symbol *> *,
CORE_ADDR,
enum language, struct objfile *);
@@ -62,9 +62,6 @@ static struct partial_symbol *find_pc_sect_psymbol (struct objfile *,
CORE_ADDR,
struct obj_section *);
-static void fixup_psymbol_section (struct partial_symbol *psym,
- struct objfile *objfile);
-
static struct compunit_symtab *psymtab_to_symtab (struct objfile *objfile,
struct partial_symtab *pst);
@@ -232,7 +229,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
{
struct partial_symtab *tpst;
struct partial_symtab *best_pst = pst;
- CORE_ADDR best_addr = PSYMTAB_TEXTLOW (pst);
+ CORE_ADDR best_addr = PSYMTAB_TEXTLOW (objfile, pst);
gdb_assert (!pst->psymtabs_addrmap_supported);
@@ -256,7 +253,8 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
that is closest and still less than the given PC. */
for (tpst = pst; tpst != NULL; tpst = tpst->next)
{
- if (pc >= PSYMTAB_TEXTLOW (tpst) && pc < PSYMTAB_TEXTHIGH (tpst))
+ if (pc >= PSYMTAB_TEXTLOW (objfile, tpst)
+ && pc < PSYMTAB_TEXTHIGH (objfile, tpst))
{
struct partial_symbol *p;
CORE_ADDR this_addr;
@@ -278,7 +276,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
if (p != NULL)
this_addr = PSYMBOL_VALUE_ADDRESS (objfile, p);
else
- this_addr = PSYMTAB_TEXTLOW (tpst);
+ this_addr = PSYMTAB_TEXTLOW (objfile, tpst);
/* Check whether it is closer than our current
BEST_ADDR. Since this symbol address is
@@ -311,6 +309,8 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
struct bound_minimal_symbol msymbol)
{
struct partial_symtab *pst;
+ CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
/* Try just the PSYMTABS_ADDRMAP mapping first as it has better granularity
than the later used TEXTLOW/TEXTHIGH one. */
@@ -318,7 +318,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
if (objfile->psymtabs_addrmap != NULL)
{
pst = ((struct partial_symtab *)
- addrmap_find (objfile->psymtabs_addrmap, pc));
+ addrmap_find (objfile->psymtabs_addrmap, pc - baseaddr));
if (pst != NULL)
{
/* FIXME: addrmaps currently do not handle overlayed sections,
@@ -362,7 +362,8 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
if (!pst->psymtabs_addrmap_supported
- && pc >= PSYMTAB_TEXTLOW (pst) && pc < PSYMTAB_TEXTHIGH (pst))
+ && pc >= PSYMTAB_TEXTLOW (objfile, pst)
+ && pc < PSYMTAB_TEXTHIGH (objfile, pst))
{
struct partial_symtab *best_pst;
@@ -412,12 +413,12 @@ find_pc_sect_psymbol (struct objfile *objfile,
{
struct partial_symbol *best = NULL;
CORE_ADDR best_pc;
+ const CORE_ADDR textlow = PSYMTAB_TEXTLOW (objfile, psymtab);
gdb_assert (psymtab != NULL);
/* Cope with programs that start at address 0. */
- best_pc = ((PSYMTAB_TEXTLOW (psymtab) != 0)
- ? PSYMTAB_TEXTLOW (psymtab) - 1 : 0);
+ best_pc = (textlow != 0) ? textlow - 1 : 0;
/* Search the global symbols as well as the static symbols, so that
find_pc_partial_function doesn't use a minimal symbol and thus
@@ -430,13 +431,12 @@ find_pc_sect_psymbol (struct objfile *objfile,
&& PSYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= PSYMBOL_VALUE_ADDRESS (objfile, p)
&& (PSYMBOL_VALUE_ADDRESS (objfile, p) > best_pc
- || (PSYMTAB_TEXTLOW (psymtab) == 0
+ || (textlow == 0
&& best_pc == 0
&& PSYMBOL_VALUE_ADDRESS (objfile, p) == 0)))
{
if (section != NULL) /* Match on a specific section. */
{
- fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (PSYMBOL_OBJ_SECTION (objfile, p),
section))
continue;
@@ -454,13 +454,12 @@ find_pc_sect_psymbol (struct objfile *objfile,
&& PSYMBOL_CLASS (p) == LOC_BLOCK
&& pc >= PSYMBOL_VALUE_ADDRESS (objfile, p)
&& (PSYMBOL_VALUE_ADDRESS (objfile, p) > best_pc
- || (PSYMTAB_TEXTLOW (psymtab) == 0
+ || (textlow == 0
&& best_pc == 0
&& PSYMBOL_VALUE_ADDRESS (objfile, p) == 0)))
{
if (section != NULL) /* Match on a specific section. */
{
- fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (PSYMBOL_OBJ_SECTION (objfile, p),
section))
continue;
@@ -473,35 +472,6 @@ find_pc_sect_psymbol (struct objfile *objfile,
return best;
}
-static void
-fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
-{
- CORE_ADDR addr;
-
- if (psym == NULL)
- return;
-
- if (PSYMBOL_SECTION (psym) >= 0)
- return;
-
- gdb_assert (objfile);
-
- switch (PSYMBOL_CLASS (psym))
- {
- case LOC_STATIC:
- case LOC_LABEL:
- case LOC_BLOCK:
- addr = PSYMBOL_VALUE_ADDRESS (objfile, psym);
- break;
- default:
- /* Nothing else will be listed in the minsyms -- no use looking
- it up. */
- return;
- }
-
- fixup_section (&psym->pginfo, addr, objfile);
-}
-
/* Psymtab version of lookup_symbol. See its definition in
the definition of quick_symbol_functions in symfile.h. */
@@ -798,44 +768,6 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
return pst->compunit_symtab;
}
-/* Psymtab version of relocate. See its definition in
- the definition of quick_symbol_functions in symfile.h. */
-
-static void
-psym_relocate (struct objfile *objfile,
- const struct section_offsets *new_offsets,
- const struct section_offsets *delta)
-{
- struct partial_symtab *p;
-
- ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
- {
- SET_PSYMTAB_TEXTLOW (p, (PSYMTAB_TEXTLOW (p)
- + ANOFFSET (delta, SECT_OFF_TEXT (objfile))));
- SET_PSYMTAB_TEXTHIGH (p, (PSYMTAB_TEXTHIGH (p)
- + ANOFFSET (delta, SECT_OFF_TEXT (objfile))));
- }
-
- for (partial_symbol *psym : objfile->global_psymbols)
- {
- fixup_psymbol_section (psym, objfile);
- if (PSYMBOL_SECTION (psym) >= 0)
- SET_PSYMBOL_VALUE_ADDRESS (psym,
- PSYMBOL_VALUE_RAW_ADDRESS (psym)
- + ANOFFSET (delta, PSYMBOL_SECTION (psym)));
- }
- for (partial_symbol *psym : objfile->static_psymbols)
- {
- fixup_psymbol_section (psym, objfile);
- if (PSYMBOL_SECTION (psym) >= 0)
- SET_PSYMBOL_VALUE_ADDRESS (psym,
- PSYMBOL_VALUE_RAW_ADDRESS (psym)
- + ANOFFSET (delta, PSYMBOL_SECTION (psym)));
- }
-
- objfile->psymbol_map.clear ();
-}
-
/* Psymtab version of find_last_source_symtab. See its definition in
the definition of quick_symbol_functions in symfile.h. */
@@ -1022,9 +954,11 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
}
fprintf_filtered (outfile, " Symbols cover text addresses ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (psymtab)), outfile);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (objfile, psymtab)),
+ outfile);
fprintf_filtered (outfile, "-");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (psymtab)), outfile);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (objfile, psymtab)),
+ outfile);
fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Address map supported - %s.\n",
psymtab->psymtabs_addrmap_supported ? "yes" : "no");
@@ -1558,7 +1492,6 @@ const struct quick_symbol_functions psym_functions =
psym_lookup_symbol,
psym_print_stats,
psym_dump,
- psym_relocate,
psym_expand_symtabs_for_function,
psym_expand_all_symtabs,
psym_expand_symtabs_with_fullname,
@@ -1605,7 +1538,7 @@ start_psymtab_common (struct objfile *objfile,
psymtab = allocate_psymtab (filename, objfile);
SET_PSYMTAB_TEXTLOW (psymtab, textlow);
- SET_PSYMTAB_TEXTHIGH (psymtab, PSYMTAB_TEXTLOW (psymtab)); /* default */
+ SET_PSYMTAB_TEXTHIGH (psymtab, PSYMTAB_RAW_TEXTLOW (psymtab)); /* default */
psymtab->globals_offset = global_psymbols.size ();
psymtab->statics_offset = static_psymbols.size ();
return psymtab;
@@ -1724,6 +1657,7 @@ static struct partial_symbol *
add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class theclass,
+ short section,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile,
int *added)
@@ -1736,7 +1670,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
memset (&psymbol, 0, sizeof (psymbol));
SET_PSYMBOL_VALUE_ADDRESS (&psymbol, coreaddr);
- PSYMBOL_SECTION (&psymbol) = -1;
+ PSYMBOL_SECTION (&psymbol) = section;
PSYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
PSYMBOL_DOMAIN (&psymbol) = domain;
PSYMBOL_CLASS (&psymbol) = theclass;
@@ -1768,6 +1702,7 @@ void
add_psymbol_to_list (const char *name, int namelength, int copy_name,
domain_enum domain,
enum address_class theclass,
+ short section,
std::vector<partial_symbol *> *list,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile)
@@ -1778,7 +1713,7 @@ add_psymbol_to_list (const char *name, int namelength, int copy_name,
/* Stash the partial symbol away in the cache. */
psym = add_psymbol_to_bcache (name, namelength, copy_name, domain, theclass,
- coreaddr, language, objfile, &added);
+ section, coreaddr, language, objfile, &added);
/* Do not duplicate global partial symbols. */
if (list == &objfile->global_psymbols
@@ -2161,10 +2096,12 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
psymtab->fullname
? psymtab->fullname : "(null)");
printf_filtered (" text addresses ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (psymtab)),
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (objfile,
+ psymtab)),
gdb_stdout);
printf_filtered (" -- ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (psymtab)),
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (objfile,
+ psymtab)),
gdb_stdout);
printf_filtered ("\n");
printf_filtered (" psymtabs_addrmap_supported %s\n",
@@ -2244,14 +2181,16 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
cust = ps->compunit_symtab;
/* First do some checks that don't require the associated symtab. */
- if (PSYMTAB_TEXTHIGH (ps) < PSYMTAB_TEXTLOW (ps))
+ if (PSYMTAB_TEXTHIGH (objfile, ps) < PSYMTAB_TEXTLOW (objfile, ps))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers bad range ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (ps)), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (objfile, ps)),
+ gdb_stdout);
printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (ps)), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (objfile, ps)),
+ gdb_stdout);
printf_filtered ("\n");
continue;
}
@@ -2296,16 +2235,18 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
}
psym++;
}
- if (PSYMTAB_TEXTHIGH (ps) != 0
- && (PSYMTAB_TEXTLOW (ps) < BLOCK_START (b)
- || PSYMTAB_TEXTHIGH (ps) > BLOCK_END (b)))
+ if (PSYMTAB_RAW_TEXTHIGH (ps) != 0
+ && (PSYMTAB_TEXTLOW (objfile, ps) < BLOCK_START (b)
+ || PSYMTAB_TEXTHIGH (objfile, ps) > BLOCK_END (b)))
{
printf_filtered ("Psymtab ");
puts_filtered (ps->filename);
printf_filtered (" covers ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (ps)), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTLOW (objfile, ps)),
+ gdb_stdout);
printf_filtered (" - ");
- fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (ps)), gdb_stdout);
+ fputs_filtered (paddress (gdbarch, PSYMTAB_TEXTHIGH (objfile, ps)),
+ gdb_stdout);
printf_filtered (" but symtab covers only ");
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), gdb_stdout);
printf_filtered (" - ");
@@ -194,23 +194,6 @@ debug_qf_dump (struct objfile *objfile)
}
static void
-debug_qf_relocate (struct objfile *objfile,
- const struct section_offsets *new_offsets,
- const struct section_offsets *delta)
-{
- const struct debug_sym_fns_data *debug_data
- = ((const struct debug_sym_fns_data *)
- objfile_data (objfile, symfile_debug_objfile_data_key));
-
- fprintf_filtered (gdb_stdlog, "qf->relocate (%s, %s, %s)\n",
- objfile_debug_name (objfile),
- host_address_to_string (new_offsets),
- host_address_to_string (delta));
-
- debug_data->real_sf->qf->relocate (objfile, new_offsets, delta);
-}
-
-static void
debug_qf_expand_symtabs_for_function (struct objfile *objfile,
const char *func_name)
{
@@ -401,7 +384,6 @@ static const struct quick_symbol_functions debug_sym_quick_functions =
debug_qf_lookup_symbol,
debug_qf_print_stats,
debug_qf_dump,
- debug_qf_relocate,
debug_qf_expand_symtabs_for_function,
debug_qf_expand_all_symtabs,
debug_qf_expand_symtabs_with_fullname,
@@ -189,12 +189,6 @@ struct quick_symbol_functions
gdb_stdout. This is used for "maint print objfiles". */
void (*dump) (struct objfile *objfile);
- /* This is called by objfile_relocate to relocate any indices loaded
- for OBJFILE. */
- void (*relocate) (struct objfile *objfile,
- const struct section_offsets *new_offsets,
- const struct section_offsets *delta);
-
/* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
the corresponding symbol tables are loaded. */
void (*expand_symtabs_for_function) (struct objfile *objfile,
@@ -2351,10 +2351,10 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
CORE_ADDR highval =
symbol.n_value + csect_aux.x_csect.x_scnlen.l;
- if (highval > PSYMTAB_TEXTHIGH (pst))
+ if (highval > PSYMTAB_RAW_TEXTHIGH (pst))
SET_PSYMTAB_TEXTHIGH (pst, highval);
if (!pst->textlow_valid
- || symbol.n_value < PSYMTAB_TEXTLOW (pst))
+ || symbol.n_value < PSYMTAB_RAW_TEXTLOW (pst))
SET_PSYMTAB_TEXTLOW (pst, symbol.n_value);
}
misc_func_recorded = 0;
@@ -2669,27 +2669,24 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
switch (p[1])
{
case 'S':
- symbol.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
-
if (gdbarch_static_transform_name_p (gdbarch))
namestring = gdbarch_static_transform_name
(gdbarch, namestring);
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_DATA (objfile),
&objfile->static_psymbols,
symbol.n_value,
psymtab_language, objfile);
continue;
case 'G':
- symbol.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
+ SECT_OFF_DATA (objfile),
&objfile->global_psymbols,
symbol.n_value,
psymtab_language, objfile);
@@ -2707,14 +2704,14 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
&& namestring[0] != ' '))
{
add_psymbol_to_list (namestring, p - namestring, 1,
- STRUCT_DOMAIN, LOC_TYPEDEF,
+ STRUCT_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
add_psymbol_to_list (namestring, p - namestring, 1,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
p += 1;
@@ -2726,7 +2723,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (p != namestring) /* a name is there, not just :T... */
{
add_psymbol_to_list (namestring, p - namestring, 1,
- VAR_DOMAIN, LOC_TYPEDEF,
+ VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
}
@@ -2788,7 +2785,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
add_psymbol_to_list (p, q - p, 1,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
/* Point past the name. */
@@ -2806,7 +2803,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
case 'c':
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (namestring, p - namestring, 1,
- VAR_DOMAIN, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
continue;
@@ -2822,10 +2819,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- symbol.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
symbol.n_value,
psymtab_language, objfile);
@@ -2853,10 +2849,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (startswith (namestring, "@FIX"))
continue;
- symbol.n_value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
symbol.n_value,
psymtab_language, objfile);