* objfiles.c (objfile_relocate): When relocating ->sections, use

objfile not symfile_objfile.

	* symtab.h, minsyms.c (minsyms_sort): New function.
	* objfiles.c (objfile_relocate): Call it.

	* remote-vx.c (vx_add_symbols): Call breakpoint_re_set.

	* objfiles.c, objfiles.h (objfile_to_front): New function.
	* remote-vx.c (vx_add_symbols): Call it.

	* coffread.c (coff_symtab_read): Handle common symbols the same
	way that partial-stab.h does.
This commit is contained in:
Jim Kingdon 1994-10-20 05:15:46 +00:00
parent 459877ea9d
commit 3a47045432
6 changed files with 95 additions and 7 deletions

View file

@ -1,3 +1,24 @@
Wed Oct 19 11:32:15 1994 Jim Kingdon <kingdon@cygnus.com>
* objfiles.c (objfile_relocate): When relocating ->sections, use
objfile not symfile_objfile.
* symtab.h, minsyms.c (minsyms_sort): New function.
* objfiles.c (objfile_relocate): Call it.
* remote-vx.c (vx_add_symbols): Call breakpoint_re_set.
* objfiles.c, objfiles.h (objfile_to_front): New function.
* remote-vx.c (vx_add_symbols): Call it.
* coffread.c (coff_symtab_read): Handle common symbols the same
way that partial-stab.h does.
Wed Oct 19 21:06:12 1994 Rob Savoye (rob@cirdan.cygnus.com)
* hppa-tdep.c: Remove include files a.out.h, ioctl.h, and
machine/psl.h. These are host files.
Wed Oct 19 15:13:51 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
* objfiles.h (struct objfile): Fix comment--minimal_symbol_count

View file

@ -38,6 +38,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdb-stabs.h"
#include "stabsread.h"
#include "complaints.h"
#include "target.h"
struct coff_symfile_info {
file_ptr min_lineno_offset; /* Where in file lowest line#s are */
@ -908,10 +909,29 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
/* FIXME: should use mst_abs, and not relocate, if absolute. */
enum minimal_symbol_type ms_type;
int sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
if (cs->c_sclass != C_STAT)
tmpaddr += ANOFFSET (section_offsets, sec);
int sec;
if (cs->c_secnum == N_UNDEF)
{
/* This is a common symbol. See if the target
environment knows where it has been relocated to. */
CORE_ADDR reladdr;
if (target_lookup_symbol (cs->c_name, &reladdr))
{
/* Error in lookup; ignore symbol. */
break;
}
tmpaddr = reladdr;
sec = SECT_OFF_BSS;
}
else
{
sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
if (cs->c_sclass != C_STAT)
tmpaddr += ANOFFSET (section_offsets, sec);
}
switch (sec)
{
case SECT_OFF_TEXT:

View file

@ -601,6 +601,16 @@ install_minimal_symbols (objfile)
}
}
/* Sort all the minimal symbols in OBJFILE. */
void
msymbols_sort (objfile)
struct objfile *objfile;
{
qsort (objfile->msymbols, objfile->minimal_symbol_count,
sizeof (struct minimal_symbol), compare_minimal_symbols);
}
/* Check if PC is in a shared library trampoline code stub.
Return minimal symbol for the trampoline entry or NULL if PC is not
in a trampoline code stub. */

View file

@ -273,6 +273,27 @@ allocate_objfile (abfd, mapped)
return (objfile);
}
/* Put OBJFILE at the front of the list. */
void
objfile_to_front (objfile)
struct objfile *objfile;
{
struct objfile **objp;
for (objp = &object_files; *objp != NULL; objp = &((*objp)->next))
{
if (*objp == objfile)
{
/* Unhook it from where it is. */
*objp = objfile->next;
/* Put it in the front. */
objfile->next = object_files;
object_files = objfile;
break;
}
}
}
/* Unlink OBJFILE from the list of known objfiles, if it is found in the
list.
@ -551,6 +572,9 @@ objfile_relocate (objfile, new_offsets)
if (SYMBOL_SECTION (msym) >= 0)
SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym));
}
/* Relocating different sections by different amounts may cause the symbols
to be out of order. */
msymbols_sort (objfile);
{
int i;
@ -562,10 +586,10 @@ objfile_relocate (objfile, new_offsets)
struct obj_section *s;
bfd *abfd;
abfd = symfile_objfile->obfd;
abfd = objfile->obfd;
for (s = symfile_objfile->sections;
s < symfile_objfile->sections_end; ++s)
for (s = objfile->sections;
s < objfile->sections_end; ++s)
{
flagword flags;

View file

@ -384,6 +384,8 @@ allocate_objfile PARAMS ((bfd *, int));
extern int
build_objfile_section_table PARAMS ((struct objfile *));
extern void objfile_to_front PARAMS ((struct objfile *));
extern void
unlink_objfile PARAMS ((struct objfile *));

View file

@ -669,7 +669,15 @@ vx_add_symbols (name, from_tty, text_addr, data_addr, bss_addr)
struct objfile *objfile;
struct find_sect_args ss;
/* It might be nice to suppress the breakpoint_re_set which happens here
because we are going to do one again after the objfile_relocate. */
objfile = symbol_file_add (name, from_tty, 0, 0, 0, 0);
/* This is a (slightly cheesy) way of superceding the old symbols. A less
cheesy way would be to find the objfile with the same name and
free_objfile it. */
objfile_to_front (objfile);
offs = (struct section_offsets *)
alloca (sizeof (struct section_offsets)
+ objfile->num_sections * sizeof (offs->offsets));
@ -687,6 +695,9 @@ vx_add_symbols (name, from_tty, text_addr, data_addr, bss_addr)
ANOFFSET (offs, SECT_OFF_DATA) = data_addr - ss.data_start;
ANOFFSET (offs, SECT_OFF_BSS) = bss_addr - ss.bss_start;
objfile_relocate (objfile, offs);
/* Need to do this *after* things are relocated. */
breakpoint_re_set ();
}
/* This function allows the addition of incrementally linked object files. */