diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-10-20 05:15:46 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-10-20 05:15:46 +0000 |
commit | 3a47045432484224045297da5e3254941c93b071 (patch) | |
tree | b610063b08829f46eb73649728d94856ee17c9b8 /gdb | |
parent | 459877ea9d6bf27d5f7337e2155fb33c0bd996b0 (diff) | |
download | gdb-3a47045432484224045297da5e3254941c93b071.zip gdb-3a47045432484224045297da5e3254941c93b071.tar.gz gdb-3a47045432484224045297da5e3254941c93b071.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/coffread.c | 28 | ||||
-rw-r--r-- | gdb/minsyms.c | 10 | ||||
-rw-r--r-- | gdb/objfiles.c | 30 | ||||
-rw-r--r-- | gdb/objfiles.h | 2 | ||||
-rw-r--r-- | gdb/remote-vx.c | 11 |
6 files changed, 95 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e009c26..c961404 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/coffread.c b/gdb/coffread.c index 82b7299..ddd0511 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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: diff --git a/gdb/minsyms.c b/gdb/minsyms.c index fde97e9..77d7466 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -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. */ diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 5cd01e5..891531d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -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; diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 2add520..0a69f20 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -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 *)); diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 8f0c2d4..239ad24 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -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. */ |