* xcoffread.c (xcoff_sym_fns): Revise comment about merging this
with coffread.c. * breakpoint.c (fixup_breakpoints): Removed. * rs6000-nat.c (vmap_symtab): Don't call fixup_breakpoints. (vmap_ldinfo, xcoff_relocate_core): Call breakpoint_re_set. * coffread.c (coff_symfile_offsets): Allocate SECT_OFF_MAX sections, not just SECT_OFF_MAX-1. * rs6000-nat.c (vmap_symtab), xcoffread.c: Re-do section offsets to be indexed by SECT_OFF_* instead of xcoff section numbers. * objfiles.c, remote.c: Remove comments regarding SECT_OFF_*. * symtab.h: Revise comment about block_line_section. * rs6000-nat.c (vmap_symtab): Don't relocate objfile->sections.
This commit is contained in:
parent
9b86fdcaef
commit
e2adc41a31
@ -1,3 +1,21 @@
|
||||
Fri Apr 14 12:10:24 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
|
||||
|
||||
* xcoffread.c (xcoff_sym_fns): Revise comment about merging this
|
||||
with coffread.c.
|
||||
|
||||
* breakpoint.c (fixup_breakpoints): Removed.
|
||||
* rs6000-nat.c (vmap_symtab): Don't call fixup_breakpoints.
|
||||
(vmap_ldinfo, xcoff_relocate_core): Call breakpoint_re_set.
|
||||
|
||||
* coffread.c (coff_symfile_offsets): Allocate SECT_OFF_MAX
|
||||
sections, not just SECT_OFF_MAX-1.
|
||||
|
||||
* rs6000-nat.c (vmap_symtab), xcoffread.c: Re-do section offsets
|
||||
to be indexed by SECT_OFF_* instead of xcoff section numbers.
|
||||
* objfiles.c, remote.c: Remove comments regarding SECT_OFF_*.
|
||||
* symtab.h: Revise comment about block_line_section.
|
||||
* rs6000-nat.c (vmap_symtab): Don't relocate objfile->sections.
|
||||
|
||||
Sat Apr 15 14:15:14 1995 Stan Shebs <shebs@andros.cygnus.com>
|
||||
|
||||
* mpw-make.in (init.c): Don't try to do symbolic {o} in sed
|
||||
|
@ -545,10 +545,6 @@ objfile_relocate (objfile, new_offsets)
|
||||
|
||||
ALL_OBJFILE_PSYMTABS (objfile, p)
|
||||
{
|
||||
/* FIXME: specific to symbol readers which use gdb-stabs.h.
|
||||
We can only get away with it since objfile_relocate is only
|
||||
used on XCOFF, which lacks psymtabs, and for gdb-stabs.h
|
||||
targets. */
|
||||
p->textlow += ANOFFSET (delta, SECT_OFF_TEXT);
|
||||
p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "objfiles.h"
|
||||
#include "libbfd.h" /* For bfd_cache_lookup (FIXME) */
|
||||
#include "bfd.h"
|
||||
#include "gdb-stabs.h"
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/reg.h>
|
||||
@ -285,9 +286,6 @@ vmap_symtab (vp)
|
||||
register struct vmap *vp;
|
||||
{
|
||||
register struct objfile *objfile;
|
||||
asection *textsec;
|
||||
asection *datasec;
|
||||
asection *bsssec;
|
||||
CORE_ADDR text_delta;
|
||||
CORE_ADDR data_delta;
|
||||
CORE_ADDR bss_delta;
|
||||
@ -312,48 +310,19 @@ vmap_symtab (vp)
|
||||
for (i = 0; i < objfile->num_sections; ++i)
|
||||
ANOFFSET (new_offsets, i) = ANOFFSET (objfile->section_offsets, i);
|
||||
|
||||
textsec = bfd_get_section_by_name (vp->bfd, ".text");
|
||||
text_delta =
|
||||
vp->tstart - ANOFFSET (objfile->section_offsets, textsec->target_index);
|
||||
ANOFFSET (new_offsets, textsec->target_index) = vp->tstart;
|
||||
vp->tstart - ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
|
||||
ANOFFSET (new_offsets, SECT_OFF_TEXT) = vp->tstart;
|
||||
|
||||
datasec = bfd_get_section_by_name (vp->bfd, ".data");
|
||||
data_delta =
|
||||
vp->dstart - ANOFFSET (objfile->section_offsets, datasec->target_index);
|
||||
ANOFFSET (new_offsets, datasec->target_index) = vp->dstart;
|
||||
vp->dstart - ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
|
||||
ANOFFSET (new_offsets, SECT_OFF_DATA) = vp->dstart;
|
||||
|
||||
bsssec = bfd_get_section_by_name (vp->bfd, ".bss");
|
||||
bss_delta =
|
||||
vp->dstart - ANOFFSET (objfile->section_offsets, bsssec->target_index);
|
||||
ANOFFSET (new_offsets, bsssec->target_index) = vp->dstart;
|
||||
vp->dstart - ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
|
||||
ANOFFSET (new_offsets, SECT_OFF_BSS) = vp->dstart;
|
||||
|
||||
objfile_relocate (objfile, new_offsets);
|
||||
|
||||
{
|
||||
struct obj_section *s;
|
||||
for (s = objfile->sections; s < objfile->sections_end; ++s)
|
||||
{
|
||||
if (s->the_bfd_section->target_index == textsec->target_index)
|
||||
{
|
||||
s->addr += text_delta;
|
||||
s->endaddr += text_delta;
|
||||
}
|
||||
else if (s->the_bfd_section->target_index == datasec->target_index)
|
||||
{
|
||||
s->addr += data_delta;
|
||||
s->endaddr += data_delta;
|
||||
}
|
||||
else if (s->the_bfd_section->target_index == bsssec->target_index)
|
||||
{
|
||||
s->addr += bss_delta;
|
||||
s->endaddr += bss_delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (text_delta != 0)
|
||||
/* breakpoints need to be relocated as well. */
|
||||
fixup_breakpoints (0, TEXT_SEGMENT_BASE, text_delta);
|
||||
}
|
||||
|
||||
/* Add symbols for an objfile. */
|
||||
@ -568,6 +537,7 @@ symbols to the proper address).\n", gdb_stderr);
|
||||
free_objfile (symfile_objfile);
|
||||
symfile_objfile = NULL;
|
||||
}
|
||||
breakpoint_re_set ();
|
||||
}
|
||||
|
||||
/* As well as symbol tables, exec_sections need relocation. After
|
||||
@ -786,5 +756,6 @@ xcoff_relocate_core (target)
|
||||
(CORE_ADDR)ldip->ldinfo_dataorg);
|
||||
} while (ldip->ldinfo_next != 0);
|
||||
vmap_exec ();
|
||||
breakpoint_re_set ();
|
||||
do_cleanups (old);
|
||||
}
|
||||
|
@ -214,7 +214,6 @@ static void
|
||||
add_stab_to_list PARAMS ((char *, struct pending_stabs **));
|
||||
|
||||
|
||||
#ifdef STATIC_NODEBUG_VARS
|
||||
/* Return the section_offsets* that CS points to. */
|
||||
static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
|
||||
|
||||
@ -256,7 +255,6 @@ cs_to_section (cs, objfile)
|
||||
bfd_map_over_sections (objfile->obfd, find_targ_sec, &args);
|
||||
return off;
|
||||
}
|
||||
#endif /* STATIC_NODEBUG_VARS */
|
||||
|
||||
/* add a given stab string into given stab vector. */
|
||||
|
||||
@ -1252,8 +1250,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
{
|
||||
if (last_source_file)
|
||||
{
|
||||
end_symtab (cur_src_end_addr, 1, 0, objfile,
|
||||
textsec->target_index);
|
||||
end_symtab (cur_src_end_addr, 1, 0, objfile, SECT_OFF_TEXT);
|
||||
end_stabs ();
|
||||
}
|
||||
|
||||
@ -1333,7 +1330,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
complete_symtab (filestring, file_start_addr);
|
||||
cur_src_end_addr = file_end_addr;
|
||||
end_symtab (file_end_addr, 1, 0, objfile,
|
||||
textsec->target_index);
|
||||
SECT_OFF_TEXT);
|
||||
end_stabs ();
|
||||
start_stabs ();
|
||||
/* Give all csects for this source file the same
|
||||
@ -1357,7 +1354,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
{
|
||||
last_csect_name = cs->c_name;
|
||||
last_csect_val = cs->c_value;
|
||||
last_csect_sec = cs->c_secnum;
|
||||
last_csect_sec = cs_to_section (cs, objfile);
|
||||
}
|
||||
}
|
||||
misc_func_recorded = 0;
|
||||
@ -1400,9 +1397,10 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
case XMC_PR:
|
||||
/* a function entry point. */
|
||||
function_entry_point:
|
||||
RECORD_MINIMAL_SYMBOL (cs->c_name, cs->c_value, mst_text,
|
||||
symname_alloced, cs->c_secnum,
|
||||
objfile);
|
||||
RECORD_MINIMAL_SYMBOL
|
||||
(cs->c_name, cs->c_value, mst_text,
|
||||
symname_alloced, cs_to_section (cs, objfile),
|
||||
objfile);
|
||||
|
||||
fcn_line_offset = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
|
||||
fcn_start_addr = cs->c_value;
|
||||
@ -1518,7 +1516,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
RECORD_MINIMAL_SYMBOL
|
||||
(cs->c_name, cs->c_value,
|
||||
mst_solib_trampoline,
|
||||
symname_alloced, cs->c_secnum, objfile);
|
||||
symname_alloced, cs_to_section (cs, objfile), objfile);
|
||||
continue;
|
||||
|
||||
case XMC_DS:
|
||||
@ -1575,7 +1573,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
|
||||
complete_symtab (filestring, file_start_addr);
|
||||
cur_src_end_addr = file_end_addr;
|
||||
end_symtab (file_end_addr, 1, 0, objfile, textsec->target_index);
|
||||
end_symtab (file_end_addr, 1, 0, objfile, SECT_OFF_TEXT);
|
||||
end_stabs ();
|
||||
|
||||
/* XCOFF, according to the AIX 3.2 documentation, puts the filename
|
||||
@ -1621,7 +1619,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
new->name = define_symbol
|
||||
(fcn_cs_saved.c_value, fcn_stab_saved.c_name, 0, 0, objfile);
|
||||
if (new->name != NULL)
|
||||
SYMBOL_SECTION (new->name) = cs->c_secnum;
|
||||
SYMBOL_SECTION (new->name) = cs_to_section (cs, objfile);
|
||||
}
|
||||
else if (STREQ (cs->c_name, ".ef"))
|
||||
{
|
||||
@ -1656,10 +1654,12 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
/* Begin static block. */
|
||||
{
|
||||
struct internal_syment symbol;
|
||||
struct coff_symbol csymbol;
|
||||
|
||||
read_symbol (&symbol, cs->c_value);
|
||||
static_block_base = symbol.n_value;
|
||||
static_block_section = symbol.n_scnum;
|
||||
csymbol.c_secnum = symbol.n_scnum;
|
||||
static_block_section = cs_to_section (&csymbol, objfile);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1721,7 +1721,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
break;
|
||||
}
|
||||
RECORD_MINIMAL_SYMBOL (cs->c_name, cs->c_value, ms_type,
|
||||
symname_alloced, cs->c_secnum, objfile);
|
||||
symname_alloced, sec, objfile);
|
||||
}
|
||||
#endif /* STATIC_NODEBUG_VARS */
|
||||
break;
|
||||
@ -1774,7 +1774,7 @@ read_xcoff_symtab (objfile, nsyms)
|
||||
|
||||
if (last_source_file)
|
||||
{
|
||||
end_symtab (cur_src_end_addr, 1, 0, objfile, textsec->target_index);
|
||||
end_symtab (cur_src_end_addr, 1, 0, objfile, SECT_OFF_TEXT);
|
||||
end_stabs ();
|
||||
}
|
||||
|
||||
@ -1827,7 +1827,7 @@ process_xcoff_symbol (cs, objfile)
|
||||
/* default assumptions */
|
||||
SYMBOL_VALUE (sym) = cs->c_value;
|
||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
|
||||
if (ISFCN (cs->c_type))
|
||||
{
|
||||
@ -1886,7 +1886,7 @@ process_xcoff_symbol (cs, objfile)
|
||||
sym = define_symbol (cs->c_value, cs->c_name, 0, 0, objfile);
|
||||
if (sym != NULL)
|
||||
{
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
}
|
||||
return sym;
|
||||
|
||||
@ -1917,14 +1917,14 @@ process_xcoff_symbol (cs, objfile)
|
||||
sym = define_symbol (cs->c_value, cs->c_name, 0, N_LSYM, objfile);
|
||||
if (sym != NULL)
|
||||
{
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
}
|
||||
return sym;
|
||||
|
||||
case C_AUTO:
|
||||
SYMBOL_CLASS (sym) = LOC_LOCAL;
|
||||
SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
SYMBOL_DUP (sym, sym2);
|
||||
add_symbol_to_list (sym2, &local_symbols);
|
||||
break;
|
||||
@ -1932,7 +1932,7 @@ process_xcoff_symbol (cs, objfile)
|
||||
case C_EXT:
|
||||
SYMBOL_CLASS (sym) = LOC_STATIC;
|
||||
SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
SYMBOL_DUP (sym, sym2);
|
||||
add_symbol_to_list (sym2, &global_symbols);
|
||||
break;
|
||||
@ -1940,7 +1940,7 @@ process_xcoff_symbol (cs, objfile)
|
||||
case C_STAT:
|
||||
SYMBOL_CLASS (sym) = LOC_STATIC;
|
||||
SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
SYMBOL_DUP (sym, sym2);
|
||||
add_symbol_to_list
|
||||
(sym2, within_function ? &local_symbols : &file_symbols);
|
||||
@ -1952,7 +1952,7 @@ process_xcoff_symbol (cs, objfile)
|
||||
{
|
||||
sym = define_symbol (cs->c_value, cs->c_name, 0, 0, objfile);
|
||||
if (sym != NULL)
|
||||
SYMBOL_SECTION (sym) = cs->c_secnum;
|
||||
SYMBOL_SECTION (sym) = cs_to_section (cs, objfile);
|
||||
return sym;
|
||||
}
|
||||
else
|
||||
@ -2372,22 +2372,7 @@ xcoff_symfile_read (objfile, section_offset, mainline)
|
||||
do_cleanups (back_to);
|
||||
}
|
||||
|
||||
/* XCOFF-specific parsing routine for section offsets. */
|
||||
|
||||
static int largest_section;
|
||||
|
||||
static void
|
||||
note_one_section (abfd, asect, ptr)
|
||||
bfd *abfd;
|
||||
asection *asect;
|
||||
PTR ptr;
|
||||
{
|
||||
if (asect->target_index > largest_section)
|
||||
largest_section = asect->target_index;
|
||||
}
|
||||
|
||||
static
|
||||
struct section_offsets *
|
||||
static struct section_offsets *
|
||||
xcoff_symfile_offsets (objfile, addr)
|
||||
struct objfile *objfile;
|
||||
CORE_ADDR addr;
|
||||
@ -2395,14 +2380,12 @@ xcoff_symfile_offsets (objfile, addr)
|
||||
struct section_offsets *section_offsets;
|
||||
int i;
|
||||
|
||||
largest_section = 0;
|
||||
bfd_map_over_sections (objfile->obfd, note_one_section, NULL);
|
||||
objfile->num_sections = largest_section + 1;
|
||||
objfile->num_sections = SECT_OFF_MAX;
|
||||
section_offsets = (struct section_offsets *)
|
||||
obstack_alloc
|
||||
(&objfile -> psymbol_obstack,
|
||||
sizeof (struct section_offsets)
|
||||
+ sizeof (section_offsets->offsets) * (objfile->num_sections));
|
||||
+ sizeof (section_offsets->offsets) * objfile->num_sections);
|
||||
|
||||
/* syms_from_objfile kindly subtracts from addr the bfd_section_vma
|
||||
of the .text section. This strikes me as wrong--whether the
|
||||
@ -2412,9 +2395,9 @@ xcoff_symfile_offsets (objfile, addr)
|
||||
handle any section but .text sensibly), so just ignore the addr
|
||||
parameter and use 0. That matches the fact that xcoff_symfile_read
|
||||
ignores the section_offsets). */
|
||||
for (i = 0; i < objfile->num_sections; i++)
|
||||
for (i = 0; i < objfile->num_sections; ++i)
|
||||
ANOFFSET (section_offsets, i) = 0;
|
||||
|
||||
|
||||
return section_offsets;
|
||||
}
|
||||
|
||||
@ -2424,10 +2407,14 @@ static struct sym_fns xcoff_sym_fns =
|
||||
{
|
||||
|
||||
/* Because the bfd uses coff_flavour, we need to specially kludge
|
||||
the flavour. FIXME: coff and xcoff and fundamentally similar
|
||||
except for debug format, and we should see if we can merge this
|
||||
file with coffread.c. For example, the extra storage classes
|
||||
used for stabs could presumably be recognized in any COFF file. */
|
||||
the flavour. It is possible that coff and xcoff should be merged as
|
||||
they do have fundamental similarities (for example, the extra storage
|
||||
classes used for stabs could presumably be recognized in any COFF file).
|
||||
However, in addition to obvious things like all the csect hair, there are
|
||||
some subtler differences between xcoffread.c and coffread.c, notably
|
||||
the fact that coffread.c has no need to read in all the symbols, but
|
||||
xcoffread.c reads all the symbols and does in fact randomly access them
|
||||
(in C_BSTAT and B_BINCL processing). */
|
||||
|
||||
(enum bfd_flavour)-1,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user