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 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
#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 */
/* 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:
}
}
+/* 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. */
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.
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;
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;
extern int
build_objfile_section_table PARAMS ((struct objfile *));
+extern void objfile_to_front PARAMS ((struct objfile *));
+
extern void
unlink_objfile PARAMS ((struct objfile *));
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));
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. */