/* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1994 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1994, 1995
+ Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "inferior.h"
#include <a.out.h>
#include <sys/file.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
#include <sys/core.h>
#include <sys/ldr.h>
struct stat ii, vi;
register struct vmap *vp;
int got_one, retried;
- CORE_ADDR ostart;
int got_exec_file;
/* For each *ldi, see if we have a corresponding *vp.
retry:
for (got_one = 0, vp = vmap; vp; vp = vp->nxt)
{
- FILE *io;
-
/* First try to find a `vp', which is the same as in ldinfo.
If not the same, just continue and grep the next `vp'. If same,
relocate its tstart, tend, dstart, dend values. If no such `vp'
|| (memb[0] && !STREQ(memb, vp->member)))
continue;
- io = bfd_cache_lookup (vp->bfd); /* totally opaque! */
- if (!io)
- fatal ("cannot find BFD's iostream for %s", vp->name);
-
/* See if we are referring to the same file. */
- /* An error here is innocuous, most likely meaning that
- the file descriptor has become worthless. */
- if (fstat (fileno(io), &vi) < 0)
+ if (bfd_stat (vp->bfd, &vi) < 0)
+ /* An error here is innocuous, most likely meaning that
+ the file descriptor has become worthless.
+ FIXME: What does it mean for a file descriptor to become
+ "worthless"? What makes it happen? What error does it
+ produce (ENOENT? others?)? Should we at least provide
+ a warning? */
continue;
if (ii.st_dev != vi.st_dev || ii.st_ino != vi.st_ino)
++got_one;
- /* found a corresponding VMAP. remap! */
- ostart = vp->tstart;
+ /* Found a corresponding VMAP. Remap! */
/* We can assume pointer == CORE_ADDR, this code is native only. */
vp->tstart = (CORE_ADDR) ldi->ldinfo_textorg;
if (vp->objfile == NULL)
got_exec_file = 1;
+#ifdef DONT_RELOCATE_SYMFILE_OBJFILE
+ if (vp->objfile == symfile_objfile
+ || vp->objfile == NULL)
+ {
+ ldi->ldinfo_dataorg = 0;
+ vp->dstart = (CORE_ADDR) 0;
+ vp->dend = ldi->ldinfo_datasize;
+ }
+#endif
+
/* relocate symbol table(s). */
vmap_symtab (vp);
- /* there may be more, so we don't break out of the loop. */
+ /* There may be more, so we don't break out of the loop. */
}
/* if there was no matching *vp, we must perforce create the sucker(s) */
vp->dstart = (CORE_ADDR) ldip->ldinfo_dataorg;
vp->dend = vp->dstart + ldip->ldinfo_datasize;
+#ifdef DONT_RELOCATE_SYMFILE_OBJFILE
+ if (vp == vmap)
+ {
+ vp->dstart = (CORE_ADDR) 0;
+ vp->dend = ldip->ldinfo_datasize;
+ }
+#endif
+
if (vp->tadj != 0)
{
vp->tstart += vp->tadj;