* breakpoint.h (struct bp_location): Change type of section

member to "struct obj_section *".
	* tracepoint.h (struct tracepoint): Likewise.
	* symtab.h (struct general_symbol_info): Replace bfd_section
	member with obj_section.
	(struct symtab_and_line): Change type of section member to
	"struct obj_section *".
	(SYMBOL_BFD_SECTION): Remove macro, replace by ...
	(SYMBOL_OBJ_SECTION): ... this.

	* minsym.c (prim_record_minimal_symbol_and_info): Record symbol
	section as obj_section instead of bfd_section.

	* ada-lang.c (ada_decode_symbol): Use gsymbol->obj_section
	directly instead of looking of obj_section from bfd_section.

	* objfiles.h (find_pc_sect_section): Remove.
	* objfiles.c (find_pc_sect_section): Remove.
	(find_pc_section): Inline find_pc_sect_section code.

	* symfile.h (find_pc_overlay): Return struct obj_section *.
	(find_pc_mapped_section): Likewise.
	(section_is_overlay, section_is_mapped): Change type of section
	argument to struct obj_section *.
	(pc_in_mapped_range, pc_in_unmapped_range): Likewise.
	(overlay_mapped_address, overlay_unmapped_address): Likewise.
	(symbol_overlayed_address): Likewise.
	* symtab.h (symbol_overlayed_address): Likewise.
	* symfile.c (overlay_is_mapped): Remove.
	(section_is_mapped): Inline overlay_is_mapped code.  Update.
	(overlay_invalidate_all): Update.
	(section_is_overlay): Change section argument to type
	"struct obj_section *".  Use bfd_ methods.
	(pc_in_unmapped_range): Likewise.  Handle relocated sections.
	(pc_in_mapped_range): Likewise.  Handle relocated sections.
	(sections_overlap): Likewise.
	(overlay_unmapped_address): Likewise.
	(overlay_mapped_address): Likewise.
	(symbol_overlayed_address): Likewise.
	(find_pc_overlay): Return struct obj_section *.
	(find_pc_mapped_section): Likewise.
	(list_overlays_command): Update.
	(map_overlay_command, unmap_overlay_command): Update.
	(simple_overlay_update): Update.

	* block.h (blockvector_for_pc_sect): Change section argument
	to type "struct obj_section *".
	(block_for_pc_sect): Likewise.
	* block.c (blockvector_for_pc_sect): Change section argument
	to type "struct obj_section *".
	(block_for_pc_sect): Likewise.
	* symtab.h (find_pc_sect_function, find_pc_sect_psymtab,
	find_pc_sect_symtab, find_pc_sect_psymbol, find_pc_sect_line,
	lookup_minimal_symbol_by_pc_section, find_function_start_pc): Likewise.
	(matching_bfd_sections): Rename to ...
	(matching_obj_sections): ... this.  Update argument types.
	* blockframe.c (find_pc_sect_function): Likewise.
	* breakpoint.c (describe_other_breakpoints): Likewise.
	(breakpoint_has_pc, check_duplicates_for): Likewise.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
	(lookup_minimal_symbol_by_pc_section): Likewise.
	* symtab.c (find_pc_sect_psymtab_closer): Likewise.
	(find_pc_sect_psymtab, find_pc_sect_psymbol, find_pc_sect_symtab,
	find_pc_sect_line, find_function_start_pc): Likewise.
	(matching_bfd_sections): Rename to ...
	(matching_obj_sections): ... this.  Update argument types.

	* blockframe.c (find_pc_partial_function): Update to section
	type changes.  No longer call find_pc_sect_section.
	(cache_pc_function_section): Change to type "struct obj_section *".
	* breakpoint.c (resolve_sal_pc): Update to section type changes.
	* exec.c (xfer_memory): Likewise.
	* findvar.c (read_var_value): Likewise.
	* infcmd.c (jump_command): Likewise.
	* linespec.c (minsym_found): Likewise.
	* maint.c (maintenance_translate_address): Likewise.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
	(lookup_solib_trampoline_symbol_by_pc): Likewise.
	* parse.c (write_exp_msymbol): Likewise.
	* printcmd.c (build_address_symbolic): Likewise.
	(address_info, sym_info): Likewise.
	* symmisc.c (dump_msymbols, print_symbol): Likewise.
	* symtab.c (fixup_section): Likewise.
	(fixup_symbol_section, fixup_psymbol_section): Likewise.
	(find_pc_line, find_function_start_sal): Likewise.
	* target.c (memory_xfer_partial): Likewise.
	* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline): Likewise.
	* spu-tdep.c (spu_overlay_update): Likewise.
This commit is contained in:
Ulrich Weigand 2008-09-05 11:37:18 +00:00
parent f91609ee70
commit 714835d5a6
26 changed files with 340 additions and 280 deletions

View File

@ -1,3 +1,94 @@
2008-09-05 Ulrich Weigand <uweigand@de.ibm.com>
* breakpoint.h (struct bp_location): Change type of section
member to "struct obj_section *".
* tracepoint.h (struct tracepoint): Likewise.
* symtab.h (struct general_symbol_info): Replace bfd_section
member with obj_section.
(struct symtab_and_line): Change type of section member to
"struct obj_section *".
(SYMBOL_BFD_SECTION): Remove macro, replace by ...
(SYMBOL_OBJ_SECTION): ... this.
* minsym.c (prim_record_minimal_symbol_and_info): Record symbol
section as obj_section instead of bfd_section.
* ada-lang.c (ada_decode_symbol): Use gsymbol->obj_section
directly instead of looking of obj_section from bfd_section.
* objfiles.h (find_pc_sect_section): Remove.
* objfiles.c (find_pc_sect_section): Remove.
(find_pc_section): Inline find_pc_sect_section code.
* symfile.h (find_pc_overlay): Return struct obj_section *.
(find_pc_mapped_section): Likewise.
(section_is_overlay, section_is_mapped): Change type of section
argument to struct obj_section *.
(pc_in_mapped_range, pc_in_unmapped_range): Likewise.
(overlay_mapped_address, overlay_unmapped_address): Likewise.
(symbol_overlayed_address): Likewise.
* symtab.h (symbol_overlayed_address): Likewise.
* symfile.c (overlay_is_mapped): Remove.
(section_is_mapped): Inline overlay_is_mapped code. Update.
(overlay_invalidate_all): Update.
(section_is_overlay): Change section argument to type
"struct obj_section *". Use bfd_ methods.
(pc_in_unmapped_range): Likewise. Handle relocated sections.
(pc_in_mapped_range): Likewise. Handle relocated sections.
(sections_overlap): Likewise.
(overlay_unmapped_address): Likewise.
(overlay_mapped_address): Likewise.
(symbol_overlayed_address): Likewise.
(find_pc_overlay): Return struct obj_section *.
(find_pc_mapped_section): Likewise.
(list_overlays_command): Update.
(map_overlay_command, unmap_overlay_command): Update.
(simple_overlay_update): Update.
* block.h (blockvector_for_pc_sect): Change section argument
to type "struct obj_section *".
(block_for_pc_sect): Likewise.
* block.c (blockvector_for_pc_sect): Change section argument
to type "struct obj_section *".
(block_for_pc_sect): Likewise.
* symtab.h (find_pc_sect_function, find_pc_sect_psymtab,
find_pc_sect_symtab, find_pc_sect_psymbol, find_pc_sect_line,
lookup_minimal_symbol_by_pc_section, find_function_start_pc): Likewise.
(matching_bfd_sections): Rename to ...
(matching_obj_sections): ... this. Update argument types.
* blockframe.c (find_pc_sect_function): Likewise.
* breakpoint.c (describe_other_breakpoints): Likewise.
(breakpoint_has_pc, check_duplicates_for): Likewise.
* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
(lookup_minimal_symbol_by_pc_section): Likewise.
* symtab.c (find_pc_sect_psymtab_closer): Likewise.
(find_pc_sect_psymtab, find_pc_sect_psymbol, find_pc_sect_symtab,
find_pc_sect_line, find_function_start_pc): Likewise.
(matching_bfd_sections): Rename to ...
(matching_obj_sections): ... this. Update argument types.
* blockframe.c (find_pc_partial_function): Update to section
type changes. No longer call find_pc_sect_section.
(cache_pc_function_section): Change to type "struct obj_section *".
* breakpoint.c (resolve_sal_pc): Update to section type changes.
* exec.c (xfer_memory): Likewise.
* findvar.c (read_var_value): Likewise.
* infcmd.c (jump_command): Likewise.
* linespec.c (minsym_found): Likewise.
* maint.c (maintenance_translate_address): Likewise.
* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
(lookup_solib_trampoline_symbol_by_pc): Likewise.
* parse.c (write_exp_msymbol): Likewise.
* printcmd.c (build_address_symbolic): Likewise.
(address_info, sym_info): Likewise.
* symmisc.c (dump_msymbols, print_symbol): Likewise.
* symtab.c (fixup_section): Likewise.
(fixup_symbol_section, fixup_psymbol_section): Likewise.
(find_pc_line, find_function_start_sal): Likewise.
* target.c (memory_xfer_partial): Likewise.
* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline): Likewise.
* spu-tdep.c (spu_overlay_update): Likewise.
2008-09-04 Doug Evans <dje@google.com>
* defs.h (plongest,pulongest): Renamed from paddr_u,paddr_d.

View File

@ -1203,22 +1203,11 @@ ada_decode_symbol (const struct general_symbol_info *gsymbol)
if (*resultp == NULL)
{
const char *decoded = ada_decode (gsymbol->name);
if (gsymbol->bfd_section != NULL)
if (gsymbol->obj_section != NULL)
{
bfd *obfd = gsymbol->bfd_section->owner;
if (obfd != NULL)
{
struct objfile *objf;
ALL_OBJFILES (objf)
{
if (obfd == objf->obfd)
{
*resultp = obsavestring (decoded, strlen (decoded),
&objf->objfile_obstack);
break;
}
}
}
struct objfile *objf = gsymbol->obj_section->objfile;
*resultp = obsavestring (decoded, strlen (decoded),
&objf->objfile_obstack);
}
/* Sometimes, we can't find a corresponding objfile, in which
case, we put the result on the heap. Since we only decode

View File

@ -72,7 +72,7 @@ block_linkage_function (const struct block *bl)
don't pass this information back to the caller. */
struct blockvector *
blockvector_for_pc_sect (CORE_ADDR pc, struct bfd_section *section,
blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
struct block **pblock, struct symtab *symtab)
{
struct block *b;
@ -153,7 +153,7 @@ blockvector_for_pc (CORE_ADDR pc, struct block **pblock)
in the specified section, or 0 if there is none. */
struct block *
block_for_pc_sect (CORE_ADDR pc, struct bfd_section *section)
block_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
{
struct blockvector *bl;
struct block *b;

View File

@ -138,13 +138,14 @@ extern int contained_in (const struct block *, const struct block *);
extern struct blockvector *blockvector_for_pc (CORE_ADDR, struct block **);
extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, asection *,
extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR,
struct obj_section *,
struct block **,
struct symtab *);
extern struct block *block_for_pc (CORE_ADDR);
extern struct block *block_for_pc_sect (CORE_ADDR, asection *);
extern struct block *block_for_pc_sect (CORE_ADDR, struct obj_section *);
extern const char *block_scope (const struct block *block);

View File

@ -114,7 +114,7 @@ get_frame_function (struct frame_info *frame)
Returns 0 if function is not known. */
struct symbol *
find_pc_sect_function (CORE_ADDR pc, struct bfd_section *section)
find_pc_sect_function (CORE_ADDR pc, struct obj_section *section)
{
struct block *b = block_for_pc_sect (pc, section);
if (b == 0)
@ -137,7 +137,7 @@ find_pc_function (CORE_ADDR pc)
static CORE_ADDR cache_pc_function_low = 0;
static CORE_ADDR cache_pc_function_high = 0;
static char *cache_pc_function_name = 0;
static struct bfd_section *cache_pc_function_section = NULL;
static struct obj_section *cache_pc_function_section = NULL;
/* Clear cache, e.g. when symbol table is discarded. */
@ -167,12 +167,11 @@ int
find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
CORE_ADDR *endaddr)
{
struct bfd_section *section;
struct obj_section *section;
struct partial_symtab *pst;
struct symbol *f;
struct minimal_symbol *msymbol;
struct partial_symbol *psb;
struct obj_section *osect;
int i;
CORE_ADDR mapped_pc;
@ -183,13 +182,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
the normal section code (which almost always succeeds). */
section = find_pc_overlay (pc);
if (section == NULL)
{
struct obj_section *obj_section = find_pc_section (pc);
if (obj_section == NULL)
section = NULL;
else
section = obj_section->the_bfd_section;
}
section = find_pc_section (pc);
mapped_pc = overlay_mapped_address (pc, section);
@ -256,9 +249,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
of the text seg doesn't appear to be part of the last function in the
text segment. */
osect = find_pc_sect_section (mapped_pc, section);
if (!osect)
if (!section)
msymbol = NULL;
/* Must be in the minimal symbol table. */
@ -294,17 +285,17 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
for (i = 1; SYMBOL_LINKAGE_NAME (msymbol + i) != NULL; i++)
{
if (SYMBOL_VALUE_ADDRESS (msymbol + i) != SYMBOL_VALUE_ADDRESS (msymbol)
&& SYMBOL_BFD_SECTION (msymbol + i) == SYMBOL_BFD_SECTION (msymbol))
&& SYMBOL_OBJ_SECTION (msymbol + i) == SYMBOL_OBJ_SECTION (msymbol))
break;
}
if (SYMBOL_LINKAGE_NAME (msymbol + i) != NULL
&& SYMBOL_VALUE_ADDRESS (msymbol + i) < obj_section_endaddr (osect))
&& SYMBOL_VALUE_ADDRESS (msymbol + i) < obj_section_endaddr (section))
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i);
else
/* We got the start address from the last msymbol in the objfile.
So the end address is the end of the section. */
cache_pc_function_high = obj_section_endaddr (osect);
cache_pc_function_high = obj_section_endaddr (section);
}
return_cached_value:

View File

@ -104,7 +104,7 @@ static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr,
enum bptype bptype);
static void describe_other_breakpoints (CORE_ADDR, asection *, int);
static void describe_other_breakpoints (CORE_ADDR, struct obj_section *, int);
static void breakpoints_info (char *, int);
@ -4050,7 +4050,8 @@ maintenance_info_breakpoints (char *bnum_exp, int from_tty)
}
static int
breakpoint_has_pc (struct breakpoint *b, CORE_ADDR pc, asection *section)
breakpoint_has_pc (struct breakpoint *b,
CORE_ADDR pc, struct obj_section *section)
{
struct bp_location *bl = b->loc;
for (; bl; bl = bl->next)
@ -4065,7 +4066,8 @@ breakpoint_has_pc (struct breakpoint *b, CORE_ADDR pc, asection *section)
/* Print a message describing any breakpoints set at PC. */
static void
describe_other_breakpoints (CORE_ADDR pc, asection *section, int thread)
describe_other_breakpoints (CORE_ADDR pc, struct obj_section *section,
int thread)
{
int others = 0;
struct breakpoint *b;
@ -4155,7 +4157,7 @@ breakpoint_address_is_meaningful (struct breakpoint *bpt)
that one the official one, and the rest as duplicates. */
static void
check_duplicates_for (CORE_ADDR address, asection *section)
check_duplicates_for (CORE_ADDR address, struct obj_section *section)
{
struct bp_location *b;
int count = 0;
@ -5769,7 +5771,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
if (sym != NULL)
{
fixup_symbol_section (sym, sal->symtab->objfile);
sal->section = SYMBOL_BFD_SECTION (sym);
sal->section = SYMBOL_OBJ_SECTION (sym);
}
else
{
@ -5782,7 +5784,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
msym = lookup_minimal_symbol_by_pc (sal->pc);
if (msym)
sal->section = SYMBOL_BFD_SECTION (msym);
sal->section = SYMBOL_OBJ_SECTION (msym);
}
}
}

View File

@ -277,9 +277,9 @@ struct bp_location
/* Type of hardware watchpoint. */
enum target_hw_bp_type watchpoint_type;
/* For any breakpoint type with an address, this is the BFD section
/* For any breakpoint type with an address, this is the section
associated with the address. Used primarily for overlay debugging. */
asection *section;
struct obj_section *section;
/* Address at which breakpoint was requested, either by the user or
by GDB for internal breakpoints. This will usually be the same

View File

@ -466,7 +466,7 @@ xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
int res;
struct section_table *p;
CORE_ADDR nextsectaddr, memend;
asection *section = NULL;
struct obj_section *section = NULL;
if (len <= 0)
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
@ -483,8 +483,9 @@ xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
for (p = target->to_sections; p < target->to_sections_end; p++)
{
if (overlay_debugging && section &&
strcmp (section->name, p->the_bfd_section->name) != 0)
if (overlay_debugging && section
&& strcmp (section->the_bfd_section->name,
p->the_bfd_section->name) != 0)
continue; /* not the section we need */
if (memaddr >= p->addr)
{

View File

@ -424,7 +424,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
{
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_BFD_SECTION (var));
SYMBOL_OBJ_SECTION (var));
store_typed_address (value_contents_raw (v), type, addr);
}
else
@ -443,7 +443,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_STATIC:
if (overlay_debugging)
addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_BFD_SECTION (var));
SYMBOL_OBJ_SECTION (var));
else
addr = SYMBOL_VALUE_ADDRESS (var);
break;
@ -486,7 +486,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_BLOCK:
if (overlay_debugging)
VALUE_ADDRESS (v) = symbol_overlayed_address
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_BFD_SECTION (var));
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var));
else
VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
return v;
@ -542,7 +542,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
return 0;
if (overlay_debugging)
addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (msym),
SYMBOL_BFD_SECTION (msym));
SYMBOL_OBJ_SECTION (msym));
else
addr = SYMBOL_VALUE_ADDRESS (msym);
}

View File

@ -179,7 +179,7 @@ hppa64_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
if (! minsym)
return 0;
sec = SYMBOL_BFD_SECTION (minsym);
sec = SYMBOL_OBJ_SECTION (minsym)->the_bfd_section;
if (bfd_get_section_vma (sec->owner, sec) <= pc
&& pc < (bfd_get_section_vma (sec->owner, sec)

View File

@ -1018,8 +1018,8 @@ jump_command (char *arg, int from_tty)
if (sfn != NULL)
{
fixup_symbol_section (sfn, 0);
if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
!section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
if (section_is_overlay (SYMBOL_OBJ_SECTION (sfn)) &&
!section_is_mapped (SYMBOL_OBJ_SECTION (sfn)))
{
if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
{

View File

@ -1849,8 +1849,8 @@ minsym_found (int funfirstline, struct minimal_symbol *msymbol)
values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line));
values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
(struct bfd_section *) 0, 0);
values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
(struct obj_section *) 0, 0);
values.sals[0].section = SYMBOL_OBJ_SECTION (msymbol);
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */

View File

@ -443,7 +443,7 @@ static void
maintenance_translate_address (char *arg, int from_tty)
{
CORE_ADDR address;
asection *sect;
struct obj_section *sect;
char *p;
struct minimal_symbol *sym;
struct objfile *objfile;
@ -464,10 +464,9 @@ maintenance_translate_address (char *arg, int from_tty)
while (isspace (*p))
p++; /* Skip whitespace */
ALL_OBJFILES (objfile)
ALL_OBJSECTIONS (objfile, sect)
{
sect = bfd_get_section_by_name (objfile->obfd, arg);
if (sect != NULL)
if (strcmp (sect->the_bfd_section->name, arg) == 0)
break;
}
@ -487,7 +486,8 @@ maintenance_translate_address (char *arg, int from_tty)
SYMBOL_PRINT_NAME (sym),
pulongest (address - SYMBOL_VALUE_ADDRESS (sym)));
else if (sect)
printf_filtered (_("no symbol at %s:0x%s\n"), sect->name, paddr (address));
printf_filtered (_("no symbol at %s:0x%s\n"),
sect->the_bfd_section->name, paddr (address));
else
printf_filtered (_("no symbol at 0x%s\n"), paddr (address));

View File

@ -419,7 +419,8 @@ lookup_minimal_symbol_solib_trampoline (const char *name,
Otherwise prefer mst_text symbols. */
static struct minimal_symbol *
lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, asection *section,
lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
struct obj_section *section,
int want_trampoline)
{
int lo;
@ -542,9 +543,9 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, asection *section,
/* Some types of debug info, such as COFF,
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& SYMBOL_BFD_SECTION (&msymbol[hi]) != NULL
&& (!matching_bfd_sections
(SYMBOL_BFD_SECTION (&msymbol[hi]), section)))
&& SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
&& (!matching_obj_sections
(SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
{
hi--;
continue;
@ -561,8 +562,8 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, asection *section,
== MSYMBOL_SIZE (&msymbol[hi - 1]))
&& (SYMBOL_VALUE_ADDRESS (&msymbol[hi])
== SYMBOL_VALUE_ADDRESS (&msymbol[hi - 1]))
&& (SYMBOL_BFD_SECTION (&msymbol[hi])
== SYMBOL_BFD_SECTION (&msymbol[hi - 1])))
&& (SYMBOL_OBJ_SECTION (&msymbol[hi])
== SYMBOL_OBJ_SECTION (&msymbol[hi - 1])))
{
hi--;
continue;
@ -649,7 +650,7 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc, asection *section,
}
struct minimal_symbol *
lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section)
lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, struct obj_section *section)
{
return lookup_minimal_symbol_by_pc_section_1 (pc, section, 0);
}
@ -666,7 +667,7 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc)
struct obj_section *section = find_pc_section (pc);
if (section == NULL)
return NULL;
return lookup_minimal_symbol_by_pc_section (pc, section->the_bfd_section);
return lookup_minimal_symbol_by_pc_section (pc, section);
}
@ -737,6 +738,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
asection *bfd_section,
struct objfile *objfile)
{
struct obj_section *obj_section;
struct msym_bunch *new;
struct minimal_symbol *msymbol;
@ -772,7 +774,18 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
SYMBOL_VALUE_ADDRESS (msymbol) = address;
SYMBOL_SECTION (msymbol) = section;
SYMBOL_BFD_SECTION (msymbol) = bfd_section;
SYMBOL_OBJ_SECTION (msymbol) = NULL;
/* Find obj_section corresponding to bfd_section. */
if (bfd_section)
ALL_OBJFILE_OSECTIONS (objfile, obj_section)
{
if (obj_section->the_bfd_section == bfd_section)
{
SYMBOL_OBJ_SECTION (msymbol) = obj_section;
break;
}
}
MSYMBOL_TYPE (msymbol) = ms_type;
/* FIXME: This info, if it remains, needs its own field. */
@ -1112,8 +1125,7 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
if (section == NULL)
return NULL;
msymbol = lookup_minimal_symbol_by_pc_section_1 (pc, section->the_bfd_section,
1);
msymbol = lookup_minimal_symbol_by_pc_section_1 (pc, section, 1);
if (msymbol != NULL && MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
return msymbol;

View File

@ -754,33 +754,24 @@ have_minimal_symbols (void)
return 0;
}
/* Returns a section whose range includes PC and SECTION, or NULL if
none found. Note the distinction between the return type, struct
obj_section (which is defined in gdb), and the input type "struct
bfd_section" (which is a bfd-defined data type). The obj_section
contains a pointer to the "struct bfd_section". */
struct obj_section *
find_pc_sect_section (CORE_ADDR pc, struct bfd_section *section)
{
struct obj_section *s;
struct objfile *objfile;
ALL_OBJSECTIONS (objfile, s)
if ((section == 0 || section == s->the_bfd_section)
&& obj_section_addr (s) <= pc && pc < obj_section_endaddr (s))
return (s);
return (NULL);
}
/* Returns a section whose range includes PC or NULL if none found.
Backward compatibility, no section. */
/* Returns a section whose range includes PC or NULL if none found. */
struct obj_section *
find_pc_section (CORE_ADDR pc)
{
return find_pc_sect_section (pc, find_pc_mapped_section (pc));
struct obj_section *s;
struct objfile *objfile;
/* Check for mapped overlay section first. */
s = find_pc_mapped_section (pc);
if (s)
return s;
ALL_OBJSECTIONS (objfile, s)
if (obj_section_addr (s) <= pc && pc < obj_section_endaddr (s))
return s;
return NULL;
}

View File

@ -498,9 +498,6 @@ extern int have_minimal_symbols (void);
extern struct obj_section *find_pc_section (CORE_ADDR pc);
extern struct obj_section *find_pc_sect_section (CORE_ADDR pc,
asection * section);
extern int in_plt_section (CORE_ADDR, char *);
/* Keep a registry of per-objfile data-pointers required by other GDB

View File

@ -415,7 +415,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol);
asection *bfd_section = SYMBOL_BFD_SECTION (msymbol);
struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol);
enum minimal_symbol_type type = msymbol->type;
CORE_ADDR pc;
@ -427,12 +427,12 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
/* In this case, assume we have a code symbol instead of
a data symbol. */
type = mst_text;
bfd_section = NULL;
section = NULL;
addr = pc;
}
if (overlay_debugging)
addr = symbol_overlayed_address (addr, bfd_section);
addr = symbol_overlayed_address (addr, section);
write_exp_elt_opcode (OP_LONG);
/* Let's make the type big enough to hold a 64-bit address. */
@ -440,7 +440,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
write_exp_elt_longcst ((LONGEST) addr);
write_exp_elt_opcode (OP_LONG);
if (bfd_section && bfd_section->flags & SEC_THREAD_LOCAL)
if (section && section->the_bfd_section->flags & SEC_THREAD_LOCAL)
{
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
write_exp_elt_objfile (objfile);

View File

@ -590,7 +590,7 @@ build_address_symbolic (CORE_ADDR addr, /* IN */
struct minimal_symbol *msymbol;
struct symbol *symbol;
CORE_ADDR name_location = 0;
asection *section = 0;
struct obj_section *section = NULL;
char *name_temp = "";
/* Let's say it is unmapped. */
@ -976,7 +976,6 @@ sym_info (char *arg, int from_tty)
struct minimal_symbol *msymbol;
struct objfile *objfile;
struct obj_section *osect;
asection *sect;
CORE_ADDR addr, sect_addr;
int matches = 0;
unsigned int offset;
@ -992,12 +991,11 @@ sym_info (char *arg, int from_tty)
if (objfile->separate_debug_objfile_backlink)
continue;
sect = osect->the_bfd_section;
sect_addr = overlay_mapped_address (addr, sect);
sect_addr = overlay_mapped_address (addr, osect);
if (obj_section_addr (osect) <= sect_addr
&& sect_addr < obj_section_endaddr (osect)
&& (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
&& (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, osect)))
{
matches = 1;
offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
@ -1007,12 +1005,12 @@ sym_info (char *arg, int from_tty)
else
printf_filtered ("%s in ",
SYMBOL_PRINT_NAME (msymbol));
if (pc_in_unmapped_range (addr, sect))
if (pc_in_unmapped_range (addr, osect))
printf_filtered (_("load address range of "));
if (section_is_overlay (sect))
if (section_is_overlay (osect))
printf_filtered (_("%s overlay "),
section_is_mapped (sect) ? "mapped" : "unmapped");
printf_filtered (_("section %s"), sect->name);
section_is_mapped (osect) ? "mapped" : "unmapped");
printf_filtered (_("section %s"), osect->the_bfd_section->name);
printf_filtered ("\n");
}
}
@ -1026,7 +1024,7 @@ address_info (char *exp, int from_tty)
struct symbol *sym;
struct minimal_symbol *msymbol;
long val;
asection *section;
struct obj_section *section;
CORE_ADDR load_addr;
int is_a_field_of_this; /* C++: lookup_symbol sets this to nonzero
if exp is a field of `this'. */
@ -1063,13 +1061,14 @@ address_info (char *exp, int from_tty)
printf_filtered ("\" is at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (" in a file compiled without debugging");
section = SYMBOL_BFD_SECTION (msymbol);
section = SYMBOL_OBJ_SECTION (msymbol);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (" in overlay section %s", section->name);
printf_filtered (" in overlay section %s",
section->the_bfd_section->name);
}
printf_filtered (".\n");
}
@ -1083,7 +1082,7 @@ address_info (char *exp, int from_tty)
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is ");
val = SYMBOL_VALUE (sym);
section = SYMBOL_BFD_SECTION (sym);
section = SYMBOL_OBJ_SECTION (sym);
switch (SYMBOL_CLASS (sym))
{
@ -1101,7 +1100,8 @@ address_info (char *exp, int from_tty)
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (" in overlay section %s", section->name);
printf_filtered (" in overlay section %s",
section->the_bfd_section->name);
}
break;
@ -1132,7 +1132,8 @@ address_info (char *exp, int from_tty)
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (_(" in overlay section %s"), section->name);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
break;
@ -1166,7 +1167,8 @@ address_info (char *exp, int from_tty)
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (_(" in overlay section %s"), section->name);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
break;
@ -1179,7 +1181,7 @@ address_info (char *exp, int from_tty)
printf_filtered ("unresolved");
else
{
section = SYMBOL_BFD_SECTION (msym);
section = SYMBOL_OBJ_SECTION (msym);
printf_filtered (_("static storage at address "));
load_addr = SYMBOL_VALUE_ADDRESS (msym);
fputs_filtered (paddress (load_addr), gdb_stdout);
@ -1188,7 +1190,8 @@ address_info (char *exp, int from_tty)
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
fputs_filtered (paddress (load_addr), gdb_stdout);
printf_filtered (_(" in overlay section %s"), section->name);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
}
}

View File

@ -1455,7 +1455,7 @@ spu_overlay_update (struct obj_section *osect)
struct objfile *objfile;
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect->the_bfd_section))
if (section_is_overlay (osect))
spu_overlay_update_osect (osect);
}
}

View File

@ -111,8 +111,6 @@ static void decrement_reading_symtab (void *);
static void overlay_invalidate_all (void);
static int overlay_is_mapped (struct obj_section *);
void list_overlays_command (char *, int);
void map_overlay_command (char *, int);
@ -3253,7 +3251,7 @@ init_psymbol_list (struct objfile *objfile, int total_symbols)
section, return that section.
find_pc_overlay(pc): find any overlay section that contains
the pc, either in its VMA or its LMA
overlay_is_mapped(sect): true if overlay is marked as mapped
section_is_mapped(sect): true if overlay is marked as mapped
section_is_overlay(sect): true if section's VMA != LMA
pc_in_mapped_range(pc,sec): true if pc belongs to section's VMA
pc_in_unmapped_range(...): true if pc belongs to section's LMA
@ -3275,14 +3273,18 @@ int overlay_cache_invalid = 0; /* True if need to refresh mapped state */
SECTION is loaded at an address different from where it will "run". */
int
section_is_overlay (asection *section)
section_is_overlay (struct obj_section *section)
{
/* FIXME: need bfd *, so we can use bfd_section_lma methods. */
if (overlay_debugging)
if (section && section->lma != 0 &&
section->vma != section->lma)
return 1;
if (overlay_debugging && section)
{
bfd *abfd = section->objfile->obfd;
asection *bfd_section = section->the_bfd_section;
if (bfd_section_lma (abfd, bfd_section) != 0
&& bfd_section_lma (abfd, bfd_section)
!= bfd_section_vma (abfd, bfd_section))
return 1;
}
return 0;
}
@ -3297,13 +3299,12 @@ overlay_invalidate_all (void)
struct obj_section *sect;
ALL_OBJSECTIONS (objfile, sect)
if (section_is_overlay (sect->the_bfd_section))
sect->ovly_mapped = -1;
if (section_is_overlay (sect))
sect->ovly_mapped = -1;
}
/* Function: overlay_is_mapped (SECTION)
/* Function: section_is_mapped (SECTION)
Returns true if section is an overlay, and is currently mapped.
Private: public access is thru function section_is_mapped.
Access to the ovly_mapped flag is restricted to this function, so
that we can do automatic update. If the global flag
@ -3311,10 +3312,10 @@ overlay_invalidate_all (void)
overlay_invalidate_all. If the mapped state of the particular
section is stale, then call TARGET_OVERLAY_UPDATE to refresh it. */
static int
overlay_is_mapped (struct obj_section *osect)
int
section_is_mapped (struct obj_section *osect)
{
if (osect == 0 || !section_is_overlay (osect->the_bfd_section))
if (osect == 0 || !section_is_overlay (osect))
return 0;
switch (overlay_debugging)
@ -3341,41 +3342,26 @@ overlay_is_mapped (struct obj_section *osect)
}
}
/* Function: section_is_mapped
Returns true if section is an overlay, and is currently mapped. */
int
section_is_mapped (asection *section)
{
struct objfile *objfile;
struct obj_section *osect;
if (overlay_debugging)
if (section && section_is_overlay (section))
ALL_OBJSECTIONS (objfile, osect)
if (osect->the_bfd_section == section)
return overlay_is_mapped (osect);
return 0;
}
/* Function: pc_in_unmapped_range
If PC falls into the lma range of SECTION, return true, else false. */
CORE_ADDR
pc_in_unmapped_range (CORE_ADDR pc, asection *section)
pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
{
/* FIXME: need bfd *, so we can use bfd_section_lma methods. */
if (section_is_overlay (section))
{
bfd *abfd = section->objfile->obfd;
asection *bfd_section = section->the_bfd_section;
int size;
/* We assume the LMA is relocated by the same offset as the VMA. */
bfd_vma size = bfd_get_section_size (bfd_section);
CORE_ADDR offset = obj_section_offset (section);
if (bfd_get_section_lma (abfd, bfd_section) + offset <= pc
&& pc < bfd_get_section_lma (abfd, bfd_section) + offset + size)
return 1;
}
if (overlay_debugging)
if (section && section_is_overlay (section))
{
size = bfd_get_section_size (section);
if (section->lma <= pc && pc < section->lma + size)
return 1;
}
return 0;
}
@ -3383,19 +3369,15 @@ pc_in_unmapped_range (CORE_ADDR pc, asection *section)
If PC falls into the vma range of SECTION, return true, else false. */
CORE_ADDR
pc_in_mapped_range (CORE_ADDR pc, asection *section)
pc_in_mapped_range (CORE_ADDR pc, struct obj_section *section)
{
/* FIXME: need bfd *, so we can use bfd_section_vma methods. */
if (section_is_overlay (section))
{
if (obj_section_addr (section) <= pc
&& pc < obj_section_endaddr (section))
return 1;
}
int size;
if (overlay_debugging)
if (section && section_is_overlay (section))
{
size = bfd_get_section_size (section);
if (section->vma <= pc && pc < section->vma + size)
return 1;
}
return 0;
}
@ -3403,14 +3385,12 @@ pc_in_mapped_range (CORE_ADDR pc, asection *section)
/* Return true if the mapped ranges of sections A and B overlap, false
otherwise. */
static int
sections_overlap (asection *a, asection *b)
sections_overlap (struct obj_section *a, struct obj_section *b)
{
/* FIXME: need bfd *, so we can use bfd_section_vma methods. */
CORE_ADDR a_start = a->vma;
CORE_ADDR a_end = a->vma + bfd_get_section_size (a);
CORE_ADDR b_start = b->vma;
CORE_ADDR b_end = b->vma + bfd_get_section_size (b);
CORE_ADDR a_start = obj_section_addr (a);
CORE_ADDR a_end = obj_section_endaddr (a);
CORE_ADDR b_start = obj_section_addr (b);
CORE_ADDR b_end = obj_section_endaddr (b);
return (a_start < b_end && b_start < a_end);
}
@ -3420,14 +3400,16 @@ sections_overlap (asection *a, asection *b)
May be the same as PC. */
CORE_ADDR
overlay_unmapped_address (CORE_ADDR pc, asection *section)
overlay_unmapped_address (CORE_ADDR pc, struct obj_section *section)
{
/* FIXME: need bfd *, so we can use bfd_section_lma methods. */
if (section_is_overlay (section) && pc_in_mapped_range (pc, section))
{
bfd *abfd = section->objfile->obfd;
asection *bfd_section = section->the_bfd_section;
if (overlay_debugging)
if (section && section_is_overlay (section) &&
pc_in_mapped_range (pc, section))
return pc + section->lma - section->vma;
return pc + bfd_section_lma (abfd, bfd_section)
- bfd_section_vma (abfd, bfd_section);
}
return pc;
}
@ -3437,14 +3419,16 @@ overlay_unmapped_address (CORE_ADDR pc, asection *section)
May be the same as PC. */
CORE_ADDR
overlay_mapped_address (CORE_ADDR pc, asection *section)
overlay_mapped_address (CORE_ADDR pc, struct obj_section *section)
{
/* FIXME: need bfd *, so we can use bfd_section_vma methods. */
if (section_is_overlay (section) && pc_in_unmapped_range (pc, section))
{
bfd *abfd = section->objfile->obfd;
asection *bfd_section = section->the_bfd_section;
if (overlay_debugging)
if (section && section_is_overlay (section) &&
pc_in_unmapped_range (pc, section))
return pc + section->vma - section->lma;
return pc + bfd_section_vma (abfd, bfd_section)
- bfd_section_lma (abfd, bfd_section);
}
return pc;
}
@ -3455,7 +3439,7 @@ overlay_mapped_address (CORE_ADDR pc, asection *section)
depending on whether the section is mapped or not. */
CORE_ADDR
symbol_overlayed_address (CORE_ADDR address, asection *section)
symbol_overlayed_address (CORE_ADDR address, struct obj_section *section)
{
if (overlay_debugging)
{
@ -3483,7 +3467,7 @@ symbol_overlayed_address (CORE_ADDR address, asection *section)
Else if PC matches an unmapped section's VMA, return that section.
Else if PC matches an unmapped section's LMA, return that section. */
asection *
struct obj_section *
find_pc_overlay (CORE_ADDR pc)
{
struct objfile *objfile;
@ -3491,26 +3475,26 @@ find_pc_overlay (CORE_ADDR pc)
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect->the_bfd_section))
if (section_is_overlay (osect))
{
if (pc_in_mapped_range (pc, osect->the_bfd_section))
if (pc_in_mapped_range (pc, osect))
{
if (overlay_is_mapped (osect))
return osect->the_bfd_section;
if (section_is_mapped (osect))
return osect;
else
best_match = osect;
}
else if (pc_in_unmapped_range (pc, osect->the_bfd_section))
else if (pc_in_unmapped_range (pc, osect))
best_match = osect;
}
return best_match ? best_match->the_bfd_section : NULL;
return best_match;
}
/* Function: find_pc_mapped_section (PC)
If PC falls into the VMA address range of an overlay section that is
currently marked as MAPPED, return that section. Else return NULL. */
asection *
struct obj_section *
find_pc_mapped_section (CORE_ADDR pc)
{
struct objfile *objfile;
@ -3518,9 +3502,8 @@ find_pc_mapped_section (CORE_ADDR pc)
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
if (pc_in_mapped_range (pc, osect->the_bfd_section) &&
overlay_is_mapped (osect))
return osect->the_bfd_section;
if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
return osect;
return NULL;
}
@ -3537,7 +3520,7 @@ list_overlays_command (char *args, int from_tty)
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
if (overlay_is_mapped (osect))
if (section_is_mapped (osect))
{
const char *name;
bfd_vma lma, vma;
@ -3572,7 +3555,6 @@ map_overlay_command (char *args, int from_tty)
{
struct objfile *objfile, *objfile2;
struct obj_section *sec, *sec2;
asection *bfdsec;
if (!overlay_debugging)
error (_("\
@ -3587,8 +3569,7 @@ the 'overlay manual' command."));
if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
bfdsec = sec->the_bfd_section;
if (!section_is_overlay (bfdsec))
if (!section_is_overlay (sec))
continue; /* not an overlay section */
/* Mark the overlay as "mapped" */
@ -3597,11 +3578,7 @@ the 'overlay manual' command."));
/* Next, make a pass and unmap any sections that are
overlapped by this new section: */
ALL_OBJSECTIONS (objfile2, sec2)
if (sec2->ovly_mapped
&& sec != sec2
&& sec->the_bfd_section != sec2->the_bfd_section
&& sections_overlap (sec->the_bfd_section,
sec2->the_bfd_section))
if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec, sec2))
{
if (info_verbose)
printf_unfiltered (_("Note: section %s unmapped by overlap\n"),
@ -3941,7 +3918,7 @@ simple_overlay_update (struct obj_section *osect)
/* Now may as well update all sections, even if only one was requested. */
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect->the_bfd_section))
if (section_is_overlay (osect))
{
int i, size;
bfd *obfd = osect->objfile->obfd;

View File

@ -319,32 +319,32 @@ extern enum overlay_debugging_state
extern int overlay_cache_invalid;
/* Return the "mapped" overlay section containing the PC. */
extern asection *find_pc_mapped_section (CORE_ADDR);
extern struct obj_section *find_pc_mapped_section (CORE_ADDR);
/* Return any overlay section containing the PC (even in its LMA
region). */
extern asection *find_pc_overlay (CORE_ADDR);
extern struct obj_section *find_pc_overlay (CORE_ADDR);
/* Return true if the section is an overlay. */
extern int section_is_overlay (asection *);
extern int section_is_overlay (struct obj_section *);
/* Return true if the overlay section is currently "mapped". */
extern int section_is_mapped (asection *);
extern int section_is_mapped (struct obj_section *);
/* Return true if pc belongs to section's VMA. */
extern CORE_ADDR pc_in_mapped_range (CORE_ADDR, asection *);
extern CORE_ADDR pc_in_mapped_range (CORE_ADDR, struct obj_section *);
/* Return true if pc belongs to section's LMA. */
extern CORE_ADDR pc_in_unmapped_range (CORE_ADDR, asection *);
extern CORE_ADDR pc_in_unmapped_range (CORE_ADDR, struct obj_section *);
/* Map an address from a section's LMA to its VMA. */
extern CORE_ADDR overlay_mapped_address (CORE_ADDR, asection *);
extern CORE_ADDR overlay_mapped_address (CORE_ADDR, struct obj_section *);
/* Map an address from a section's VMA to its LMA. */
extern CORE_ADDR overlay_unmapped_address (CORE_ADDR, asection *);
extern CORE_ADDR overlay_unmapped_address (CORE_ADDR, struct obj_section *);
/* Convert an address in an overlay section (force into VMA range). */
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
/* Load symbols from a file. */
extern void symbol_file_add_main (char *args, int from_tty);

View File

@ -274,6 +274,8 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
index = 0;
ALL_OBJFILE_MSYMBOLS (objfile, msymbol)
{
struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol);
switch (msymbol->type)
{
case mst_unknown:
@ -310,10 +312,10 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
fprintf_filtered (outfile, "[%2d] %c ", index, ms_type);
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (msymbol)), outfile);
fprintf_filtered (outfile, " %s", SYMBOL_LINKAGE_NAME (msymbol));
if (SYMBOL_BFD_SECTION (msymbol))
if (section)
fprintf_filtered (outfile, " section %s",
bfd_section_name (objfile->obfd,
SYMBOL_BFD_SECTION (msymbol)));
section->the_bfd_section));
if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
{
fprintf_filtered (outfile, " %s", SYMBOL_DEMANGLED_NAME (msymbol));
@ -567,16 +569,17 @@ print_symbol (void *args)
struct symbol *symbol = ((struct print_symbol_args *) args)->symbol;
int depth = ((struct print_symbol_args *) args)->depth;
struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile;
struct obj_section *section = SYMBOL_OBJ_SECTION (symbol);
print_spaces (depth, outfile);
if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN)
{
fprintf_filtered (outfile, "label %s at ", SYMBOL_PRINT_NAME (symbol));
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile);
if (SYMBOL_BFD_SECTION (symbol))
if (section)
fprintf_filtered (outfile, " section %s\n",
bfd_section_name (SYMBOL_BFD_SECTION (symbol)->owner,
SYMBOL_BFD_SECTION (symbol)));
bfd_section_name (section->the_bfd_section->owner,
section->the_bfd_section));
else
fprintf_filtered (outfile, "\n");
return 1;
@ -638,11 +641,10 @@ print_symbol (void *args)
case LOC_STATIC:
fprintf_filtered (outfile, "static at ");
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile);
if (SYMBOL_BFD_SECTION (symbol))
if (section)
fprintf_filtered (outfile, " section %s",
bfd_section_name
(SYMBOL_BFD_SECTION (symbol)->owner,
SYMBOL_BFD_SECTION (symbol)));
bfd_section_name (section->the_bfd_section->owner,
section->the_bfd_section));
break;
case LOC_REGISTER:
@ -677,11 +679,10 @@ print_symbol (void *args)
case LOC_LABEL:
fprintf_filtered (outfile, "label at ");
fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (symbol)), outfile);
if (SYMBOL_BFD_SECTION (symbol))
if (section)
fprintf_filtered (outfile, " section %s",
bfd_section_name
(SYMBOL_BFD_SECTION (symbol)->owner,
SYMBOL_BFD_SECTION (symbol)));
bfd_section_name (section->the_bfd_section->owner,
section->the_bfd_section));
break;
case LOC_BLOCK:
@ -693,11 +694,10 @@ print_symbol (void *args)
fprintf_filtered (outfile, "..");
fputs_filtered (paddress (BLOCK_END (SYMBOL_BLOCK_VALUE (symbol))),
outfile);
if (SYMBOL_BFD_SECTION (symbol))
if (section)
fprintf_filtered (outfile, " section %s",
bfd_section_name
(SYMBOL_BFD_SECTION (symbol)->owner,
SYMBOL_BFD_SECTION (symbol)));
bfd_section_name (section->the_bfd_section->owner,
section->the_bfd_section));
break;
case LOC_COMPUTED:

View File

@ -705,8 +705,11 @@ init_sal (struct symtab_and_line *sal)
file and another in a separated debug file. */
int
matching_bfd_sections (asection *first, asection *second)
matching_obj_sections (struct obj_section *obj_first,
struct obj_section *obj_second)
{
asection *first = obj_first? obj_first->the_bfd_section : NULL;
asection *second = obj_second? obj_second->the_bfd_section : NULL;
struct objfile *obj;
/* If they're the same section, then they match. */
@ -766,7 +769,7 @@ matching_bfd_sections (asection *first, asection *second)
We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */
struct partial_symtab *
find_pc_sect_psymtab_closer (CORE_ADDR pc, asection *section,
find_pc_sect_psymtab_closer (CORE_ADDR pc, struct obj_section *section,
struct partial_symtab *pst,
struct minimal_symbol *msymbol)
{
@ -844,7 +847,7 @@ find_pc_sect_psymtab_closer (CORE_ADDR pc, asection *section,
exactly matches PC, or, if we cannot find an exact match, the
psymtab that contains a symbol whose address is closest to PC. */
struct partial_symtab *
find_pc_sect_psymtab (CORE_ADDR pc, asection *section)
find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section)
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
@ -941,7 +944,7 @@ find_pc_psymtab (CORE_ADDR pc)
struct partial_symbol *
find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
asection *section)
struct obj_section *section)
{
struct partial_symbol *best = NULL, *p, **pp;
CORE_ADDR best_pc;
@ -973,7 +976,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
if (section) /* match on a specific section */
{
fixup_psymbol_section (p, psymtab->objfile);
if (!matching_bfd_sections (SYMBOL_BFD_SECTION (p), section))
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
continue;
}
best_pc = SYMBOL_VALUE_ADDRESS (p);
@ -997,7 +1000,7 @@ find_pc_sect_psymbol (struct partial_symtab *psymtab, CORE_ADDR pc,
if (section) /* match on a specific section */
{
fixup_psymbol_section (p, psymtab->objfile);
if (!matching_bfd_sections (SYMBOL_BFD_SECTION (p), section))
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
continue;
}
best_pc = SYMBOL_VALUE_ADDRESS (p);
@ -1034,7 +1037,7 @@ fixup_section (struct general_symbol_info *ginfo,
msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->name, objfile);
if (msym)
{
ginfo->bfd_section = SYMBOL_BFD_SECTION (msym);
ginfo->obj_section = SYMBOL_OBJ_SECTION (msym);
ginfo->section = SYMBOL_SECTION (msym);
}
else
@ -1084,7 +1087,7 @@ fixup_section (struct general_symbol_info *ginfo,
if (obj_section_addr (s) - offset <= addr
&& addr < obj_section_endaddr (s) - offset)
{
ginfo->bfd_section = s->the_bfd_section;
ginfo->obj_section = s;
ginfo->section = idx;
return;
}
@ -1100,7 +1103,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
if (!sym)
return NULL;
if (SYMBOL_BFD_SECTION (sym))
if (SYMBOL_OBJ_SECTION (sym))
return sym;
/* We either have an OBJFILE, or we can get at it from the sym's
@ -1142,7 +1145,7 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
if (!psym)
return NULL;
if (SYMBOL_BFD_SECTION (psym))
if (SYMBOL_OBJ_SECTION (psym))
return psym;
gdb_assert (objfile);
@ -1970,7 +1973,7 @@ lookup_block_symbol (const struct block *block, const char *name,
psymtabs and read in another symtab if necessary. */
struct symtab *
find_pc_sect_symtab (CORE_ADDR pc, asection *section)
find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
{
struct block *b;
struct blockvector *bv;
@ -2040,7 +2043,7 @@ find_pc_sect_symtab (CORE_ADDR pc, asection *section)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
fixup_symbol_section (sym, objfile);
if (matching_bfd_sections (SYMBOL_BFD_SECTION (sym), section))
if (matching_obj_sections (SYMBOL_OBJ_SECTION (sym), section))
break;
}
if (sym == NULL)
@ -2098,7 +2101,7 @@ find_pc_symtab (CORE_ADDR pc)
/* If it's worth the effort, we could be using a binary search. */
struct symtab_and_line
find_pc_sect_line (CORE_ADDR pc, struct bfd_section *section, int notcurrent)
find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
{
struct symtab *s;
struct linetable *l;
@ -2335,7 +2338,7 @@ find_pc_sect_line (CORE_ADDR pc, struct bfd_section *section, int notcurrent)
struct symtab_and_line
find_pc_line (CORE_ADDR pc, int notcurrent)
{
asection *section;
struct obj_section *section;
section = find_pc_overlay (pc);
if (pc_in_unmapped_range (pc, section))
@ -2567,7 +2570,7 @@ find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
address after the function prologue. */
CORE_ADDR
find_function_start_pc (struct gdbarch *gdbarch,
CORE_ADDR pc, asection *section)
CORE_ADDR pc, struct obj_section *section)
{
/* If the function is in an unmapped overlay, use its unmapped LMA address,
so that gdbarch_skip_prologue has something unique to work on. */
@ -2603,9 +2606,9 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
if (funfirstline)
{
/* Skip "first line" of function (which is actually its prologue). */
pc = find_function_start_pc (gdbarch, pc, SYMBOL_BFD_SECTION (sym));
pc = find_function_start_pc (gdbarch, pc, SYMBOL_OBJ_SECTION (sym));
}
sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
/* Check if gdbarch_skip_prologue left us in mid-line, and the next
line is still part of the same function. */
@ -2616,7 +2619,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
/* First pc of next line */
pc = sal.end;
/* Recalculate the line number (might not be N+1). */
sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
}
/* On targets with executable formats that don't have a concept of
@ -2630,7 +2633,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
{
pc = gdbarch_skip_main_prologue (current_gdbarch, pc);
/* Recalculate the line number (might not be N+1). */
sal = find_pc_sect_line (pc, SYMBOL_BFD_SECTION (sym), 0);
sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0);
}
sal.pc = pc;

View File

@ -147,12 +147,12 @@ struct general_symbol_info
short section;
/* The bfd section associated with this symbol. */
/* The section associated with this symbol. */
asection *bfd_section;
struct obj_section *obj_section;
};
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
/* Note that all the following SYMBOL_* macros are used with the
SYMBOL argument being either a partial symbol, a minimal symbol or
@ -169,7 +169,7 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
#define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.language
#define SYMBOL_SECTION(symbol) (symbol)->ginfo.section
#define SYMBOL_BFD_SECTION(symbol) (symbol)->ginfo.bfd_section
#define SYMBOL_OBJ_SECTION(symbol) (symbol)->ginfo.obj_section
#define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \
(symbol)->ginfo.language_specific.cplus_specific.demangled_name
@ -1029,7 +1029,7 @@ extern struct symbol *find_pc_function (CORE_ADDR);
/* lookup the function corresponding to the address and section */
extern struct symbol *find_pc_sect_function (CORE_ADDR, asection *);
extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *);
/* lookup function from address, return name, start addr and end addr */
@ -1050,7 +1050,8 @@ extern struct partial_symtab *find_pc_psymtab (CORE_ADDR);
/* lookup partial symbol table by address and section */
extern struct partial_symtab *find_pc_sect_psymtab (CORE_ADDR, asection *);
extern struct partial_symtab *find_pc_sect_psymtab (CORE_ADDR,
struct obj_section *);
/* lookup full symbol table by address */
@ -1058,7 +1059,7 @@ extern struct symtab *find_pc_symtab (CORE_ADDR);
/* lookup full symbol table by address and section */
extern struct symtab *find_pc_sect_symtab (CORE_ADDR, asection *);
extern struct symtab *find_pc_sect_symtab (CORE_ADDR, struct obj_section *);
/* lookup partial symbol by address */
@ -1068,7 +1069,8 @@ extern struct partial_symbol *find_pc_psymbol (struct partial_symtab *,
/* lookup partial symbol by address and section */
extern struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
CORE_ADDR, asection *);
CORE_ADDR,
struct obj_section *);
extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
@ -1126,9 +1128,8 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_name
extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
extern struct minimal_symbol *lookup_minimal_symbol_by_pc_section (CORE_ADDR,
asection
*);
extern struct minimal_symbol
*lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *);
extern struct minimal_symbol
*lookup_solib_trampoline_symbol_by_pc (CORE_ADDR);
@ -1148,7 +1149,7 @@ extern void msymbols_sort (struct objfile *objfile);
struct symtab_and_line
{
struct symtab *symtab;
asection *section;
struct obj_section *section;
/* Line number. Line numbers start at 1 and proceed through symtab->nlines.
0 is never a valid line number; it is used to indicate that line number
information is not available. */
@ -1191,7 +1192,8 @@ extern struct symtab_and_line find_pc_line (CORE_ADDR, int);
/* Same function, but specify a section as well as an address */
extern struct symtab_and_line find_pc_sect_line (CORE_ADDR, asection *, int);
extern struct symtab_and_line find_pc_sect_line (CORE_ADDR,
struct obj_section *, int);
/* Given a symtab and line number, return the pc there. */
@ -1256,14 +1258,14 @@ extern char **make_source_files_completion_list (char *, char *);
/* symtab.c */
int matching_bfd_sections (asection *, asection *);
int matching_obj_sections (struct obj_section *, struct obj_section *);
extern struct partial_symtab *find_main_psymtab (void);
extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
extern CORE_ADDR find_function_start_pc (struct gdbarch *,
CORE_ADDR, asection *);
CORE_ADDR, struct obj_section *);
extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
int);

View File

@ -1026,7 +1026,7 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf
/* Likewise for accesses to unmapped overlay sections. */
if (readbuf != NULL && overlay_debugging)
{
asection *section = find_pc_overlay (memaddr);
struct obj_section *section = find_pc_overlay (memaddr);
if (pc_in_unmapped_range (memaddr, section))
return xfer_memory (memaddr, readbuf, len, 0, NULL, ops);
}

View File

@ -94,7 +94,7 @@ struct tracepoint
/* BFD section, in case of overlays: no, I don't know if
tracepoints are really gonna work with overlays. */
asection *section;
struct obj_section *section;
};
enum actionline_type