1999-04-16 03:35:26 +02:00
|
|
|
/* Native support for Motorola 88k running Harris CX/UX.
|
|
|
|
Copyright 1988, 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
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., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "frame.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/dir.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include <sys/user.h>
|
|
|
|
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "symfile.h"
|
|
|
|
#include "objfiles.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
|
|
|
|
#ifndef USER /* added to support BCS ptrace_user */
|
|
|
|
#define USER ptrace_user
|
|
|
|
#endif
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include "gdb_stat.h"
|
|
|
|
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "setjmp.h"
|
|
|
|
#include "value.h"
|
|
|
|
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
|
|
|
|
/* CX/UX provides them already, but as word offsets instead of char offsets */
|
|
|
|
#define SXIP_OFFSET (PT_SXIP * 4)
|
|
|
|
#define SNIP_OFFSET (PT_SNIP * 4)
|
|
|
|
#define SFIP_OFFSET (PT_SFIP * 4)
|
|
|
|
#define PSR_OFFSET (PT_PSR * sizeof(int))
|
|
|
|
#define FPSR_OFFSET (PT_FPSR * sizeof(int))
|
|
|
|
#define FPCR_OFFSET (PT_FPCR * sizeof(int))
|
|
|
|
|
|
|
|
#define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \
|
|
|
|
((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE))
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
extern int have_symbol_file_p ();
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
extern jmp_buf stack_jmp;
|
|
|
|
|
|
|
|
extern int errno;
|
|
|
|
|
|
|
|
void
|
|
|
|
fetch_inferior_registers (regno)
|
1999-07-07 22:19:36 +02:00
|
|
|
int regno; /* Original value discarded */
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
register unsigned int regaddr;
|
|
|
|
char buf[MAX_REGISTER_RAW_SIZE];
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
struct USER u;
|
|
|
|
unsigned int offset;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
offset = (char *) &u.pt_r0 - (char *) &u;
|
|
|
|
regaddr = offset; /* byte offset to r0; */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */
|
|
|
|
for (regno = 0; regno < PC_REGNUM; regno++)
|
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
/*regaddr = register_addr (regno, offset); */
|
|
|
|
/* 88k enhancement */
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
|
|
|
*(int *) &buf[i] = ptrace (3, inferior_pid,
|
1999-04-16 03:35:26 +02:00
|
|
|
(PTRACE_ARG3_TYPE) regaddr, 0);
|
1999-07-07 22:19:36 +02:00
|
|
|
regaddr += sizeof (int);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
supply_register (regno, buf);
|
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
/* now load up registers 32-37; special pc registers */
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, 0);
|
|
|
|
supply_register (PSR_REGNUM, buf);
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, 0);
|
|
|
|
supply_register (FPSR_REGNUM, buf);
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, 0);
|
|
|
|
supply_register (FPCR_REGNUM, buf);
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, 0);
|
|
|
|
supply_register (SXIP_REGNUM, buf);
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, 0);
|
|
|
|
supply_register (SNIP_REGNUM, buf);
|
|
|
|
*(int *) &buf[0] = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, 0);
|
|
|
|
supply_register (SFIP_REGNUM, buf);
|
|
|
|
|
|
|
|
if (target_is_m88110)
|
|
|
|
{
|
|
|
|
for (regaddr = XREGADDR (X0_REGNUM), regno = X0_REGNUM;
|
|
|
|
regno < NUM_REGS;
|
|
|
|
regno++, regaddr += 16)
|
|
|
|
{
|
|
|
|
X_REGISTER_RAW_TYPE xval;
|
|
|
|
|
|
|
|
*(int *) &xval.w1 = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) regaddr, 0);
|
|
|
|
*(int *) &xval.w2 = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) (regaddr + 4), 0);
|
|
|
|
*(int *) &xval.w3 = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) (regaddr + 8), 0);
|
|
|
|
*(int *) &xval.w4 = ptrace (3, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) (regaddr + 12), 0);
|
|
|
|
supply_register (regno, (void *) &xval);
|
|
|
|
}
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Store our register values back into the inferior.
|
|
|
|
If REGNO is -1, do this for all registers.
|
|
|
|
Otherwise, REGNO specifies which register (so we can save time). */
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
store_inferior_registers (int regno)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
register unsigned int regaddr;
|
|
|
|
char buf[80];
|
|
|
|
|
|
|
|
struct USER u;
|
|
|
|
|
|
|
|
unsigned int offset = (char *) &u.pt_r0 - (char *) &u;
|
|
|
|
|
|
|
|
regaddr = offset;
|
|
|
|
|
|
|
|
/* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either
|
|
|
|
svr3 doesn't run on an 88110, or the kernel isolates the different (not
|
|
|
|
completely sure this is true, but seems to be. */
|
|
|
|
if (regno >= 0)
|
|
|
|
{
|
|
|
|
/* regaddr = register_addr (regno, offset); */
|
|
|
|
if (regno < PC_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
1999-04-16 03:35:26 +02:00
|
|
|
regaddr = offset + regno * sizeof (int);
|
|
|
|
errno = 0;
|
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) regaddr, read_register (regno));
|
|
|
|
if (errno != 0)
|
|
|
|
{
|
|
|
|
sprintf (buf, "writing register number %d", regno);
|
|
|
|
perror_with_name (buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (regno == PSR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regno == FPSR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regno == FPCR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regno == SXIP_REGNUM)
|
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regno == SNIP_REGNUM)
|
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regno == SFIP_REGNUM)
|
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno));
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (target_is_m88110 && regno < NUM_REGS)
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
|
|
|
X_REGISTER_RAW_TYPE xval;
|
|
|
|
|
|
|
|
read_register_bytes (REGISTER_BYTE (regno), (char *) &xval,
|
|
|
|
sizeof (X_REGISTER_RAW_TYPE));
|
|
|
|
regaddr = XREGADDR (regno);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr + 4, xval.w2);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr + 8, xval.w3);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr + 12, xval.w4);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
|
|
|
printf_unfiltered ("Bad register number for store_inferior routine\n");
|
|
|
|
}
|
|
|
|
else
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
1999-04-16 03:35:26 +02:00
|
|
|
for (regno = 0; regno < PC_REGNUM; regno++)
|
|
|
|
{
|
|
|
|
/* regaddr = register_addr (regno, offset); */
|
|
|
|
errno = 0;
|
|
|
|
regaddr = offset + regno * sizeof (int);
|
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) regaddr, read_register (regno));
|
|
|
|
if (errno != 0)
|
|
|
|
{
|
|
|
|
sprintf (buf, "writing register number %d", regno);
|
|
|
|
perror_with_name (buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno));
|
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno));
|
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno));
|
|
|
|
ptrace (6, inferior_pid,
|
|
|
|
(PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM));
|
1999-04-16 03:35:26 +02:00
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM));
|
1999-04-16 03:35:26 +02:00
|
|
|
ptrace (6, inferior_pid,
|
1999-07-07 22:19:36 +02:00
|
|
|
(PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM));
|
1999-04-16 03:35:26 +02:00
|
|
|
if (target_is_m88110)
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
|
|
|
for (regno = X0_REGNUM; regno < NUM_REGS; regno++)
|
|
|
|
{
|
|
|
|
X_REGISTER_RAW_TYPE xval;
|
|
|
|
|
|
|
|
read_register_bytes (REGISTER_BYTE (regno), (char *) &xval,
|
|
|
|
sizeof (X_REGISTER_RAW_TYPE));
|
|
|
|
regaddr = XREGADDR (regno);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, xval.w1);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr + 4), xval.w2);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr + 8), xval.w3);
|
|
|
|
ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) (regaddr + 12), xval.w4);
|
|
|
|
}
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* blockend is the address of the end of the user structure */
|
|
|
|
|
2000-07-30 03:48:28 +02:00
|
|
|
m88k_register_u_addr (int blockend, int regnum)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
struct USER u;
|
|
|
|
int ustart = blockend - sizeof (struct USER);
|
|
|
|
|
|
|
|
if (regnum < PSR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + ((int) &u.pt_r0 - (int) &u) +
|
|
|
|
REGISTER_SIZE * regnum);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == PSR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + ((int) &u.pt_psr) - (int) &u);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == FPSR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + ((int) &u.pt_fpsr) - (int) &u);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == FPCR_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + ((int) &u.pt_fpcr) - (int) &u);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == SXIP_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + SXIP_OFFSET);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == SNIP_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + SNIP_OFFSET);
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (regnum == SFIP_REGNUM)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (ustart + SFIP_OFFSET);
|
|
|
|
else if (target_is_m88110)
|
|
|
|
return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */
|
|
|
|
sizeof (u.pt_x0) * (regnum - X0_REGNUM));
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
1999-07-07 22:19:36 +02:00
|
|
|
return (blockend + REGISTER_SIZE * regnum);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_PROC_FS
|
|
|
|
|
|
|
|
#include <sys/procfs.h>
|
|
|
|
|
2000-05-26 Michael Snyder <msnyder@seadog.cygnus.com>
* gregset.h: New file. Typedefs for gdb_gregset_t and
gdb_fpregset_t, prototypes for supply_gregset and friends.
* procfs.c: Include gregset.h. Delete local prototypes for
supply_gregset etc., and local typedef gdb_gregset_t etc.
* sol-thread.c: Include gregset.h, delete local prototypes,
add appropriate casts to gdb_gregset_t.
* uw-thread.c, lin-thread.c, core-sol2.c, core-regset.c,
sparc-tdep.c, ptx4-nat.c, ppc-linux-nat.c, mipsv4-nat.c,
m88k-nat.c, m68klinux-nat.c, m68k-tdep.c, irix5-nat.c,
irix4-nat.c, ia64-linux-nat.c, i386v4-nat.c, cxux-nat.c,
arm-linux-nat.c, alpha-nat.c: Include gregset.h.
* config/nm-linux.h: Define GDB_GREGSET_T, GDB_FPREGET_T.
* config/sparc/tm-sun4sol2.h: Ditto.
2000-05-27 01:22:41 +02:00
|
|
|
/* Prototypes for supply_gregset etc. */
|
|
|
|
#include "gregset.h"
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* Given a pointer to a general register set in /proc format (gregset_t *),
|
1999-07-07 22:19:36 +02:00
|
|
|
unpack the register contents and supply them as gdb's idea of the current
|
|
|
|
register values. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
supply_gregset (gregset_t *gregsetp)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
register int regi;
|
|
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
|
|
|
|
|
|
|
for (regi = 0; regi <= SP_REGNUM; regi++)
|
|
|
|
supply_register (regi, (char *) (regp + regi));
|
|
|
|
|
|
|
|
supply_register (SXIP_REGNUM, (char *) (regp + R_XIP));
|
|
|
|
supply_register (SNIP_REGNUM, (char *) (regp + R_NIP));
|
|
|
|
supply_register (SFIP_REGNUM, (char *) (regp + R_FIP));
|
|
|
|
supply_register (PSR_REGNUM, (char *) (regp + R_PSR));
|
|
|
|
supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
|
|
|
|
supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
fill_gregset (gregset_t *gregsetp, int regno)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
int regi;
|
|
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
|
|
|
|
|
|
|
for (regi = 0; regi <= R_R31; regi++)
|
|
|
|
if ((regno == -1) || (regno == regi))
|
|
|
|
*(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)];
|
|
|
|
|
|
|
|
if ((regno == -1) || (regno == SXIP_REGNUM))
|
|
|
|
*(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)];
|
|
|
|
if ((regno == -1) || (regno == SNIP_REGNUM))
|
|
|
|
*(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)];
|
|
|
|
if ((regno == -1) || (regno == SFIP_REGNUM))
|
|
|
|
*(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)];
|
|
|
|
if ((regno == -1) || (regno == PSR_REGNUM))
|
|
|
|
*(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)];
|
|
|
|
if ((regno == -1) || (regno == FPSR_REGNUM))
|
|
|
|
*(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)];
|
|
|
|
if ((regno == -1) || (regno == FPCR_REGNUM))
|
|
|
|
*(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)];
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* USE_PROC_FS */
|
|
|
|
|
|
|
|
/* This support adds the equivalent of adb's % command. When
|
|
|
|
the `add-shared-symbol-files' command is given, this routine scans
|
|
|
|
the dynamic linker's link map and reads the minimal symbols
|
|
|
|
from each shared object file listed in the map. */
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
struct link_map
|
|
|
|
{
|
1999-04-16 03:35:26 +02:00
|
|
|
unsigned long l_addr; /* address at which object is mapped */
|
|
|
|
char *l_name; /* full name of loaded object */
|
|
|
|
void *l_ld; /* dynamic structure of object */
|
|
|
|
struct link_map *l_next; /* next link object */
|
|
|
|
struct link_map *l_prev; /* previous link object */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LINKS_MAP_POINTER "_ld_tail"
|
|
|
|
#define LIBC_FILE "/usr/lib/libc.so.1"
|
|
|
|
#define SHARED_OFFSET 0xf0001000
|
|
|
|
|
|
|
|
#ifndef PATH_MAX
|
|
|
|
#define PATH_MAX 1023 /* maximum size of path name on OS */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
add_shared_symbol_files (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
void *desc;
|
|
|
|
struct link_map *ld_map, *lm, lms;
|
1999-07-07 22:19:36 +02:00
|
|
|
struct minimal_symbol *minsym;
|
1999-04-16 03:35:26 +02:00
|
|
|
struct objfile *objfile;
|
|
|
|
char *path_name;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (!inferior_pid)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
warning ("The program has not yet been started.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-10-12 06:37:53 +02:00
|
|
|
objfile = symbol_file_add (LIBC_FILE, 0, NULL, 0, OBJF_READNOW);
|
1999-04-16 03:35:26 +02:00
|
|
|
minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile);
|
|
|
|
|
|
|
|
ld_map = (struct link_map *)
|
1999-07-07 22:19:36 +02:00
|
|
|
read_memory_integer (((int) SYMBOL_VALUE_ADDRESS (minsym) + SHARED_OFFSET), 4);
|
1999-04-16 03:35:26 +02:00
|
|
|
lm = ld_map;
|
|
|
|
while (lm)
|
|
|
|
{
|
|
|
|
int local_errno = 0;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
read_memory ((CORE_ADDR) lm, (char *) &lms, sizeof (struct link_map));
|
1999-04-16 03:35:26 +02:00
|
|
|
if (lms.l_name)
|
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
if (target_read_string ((CORE_ADDR) lms.l_name, &path_name,
|
|
|
|
PATH_MAX, &local_errno))
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-10-06 01:13:56 +02:00
|
|
|
struct section_addr_info section_addrs;
|
|
|
|
memset (§ion_addrs, 0, sizeof (section_addrs));
|
2000-04-27 17:11:14 +02:00
|
|
|
section_addrs.other[0].addr = lms.l_addr;
|
|
|
|
section_addrs.other[0].name = ".text";
|
1999-10-12 06:37:53 +02:00
|
|
|
symbol_file_add (path_name, 1, §ion_addrs, 0, 0);
|
1999-07-07 22:19:36 +02:00
|
|
|
free (path_name);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* traverse links in reverse order so that we get the
|
1999-07-07 22:19:36 +02:00
|
|
|
the symbols the user actually gets. */
|
1999-04-16 03:35:26 +02:00
|
|
|
lm = lms.l_prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Getting new symbols may change our opinion about what is
|
|
|
|
frameless. */
|
|
|
|
reinit_frame_cache ();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(_ES_MP)
|
|
|
|
|
|
|
|
#include <sys/regset.h>
|
|
|
|
|
|
|
|
unsigned int
|
2000-07-30 03:48:28 +02:00
|
|
|
m88k_harris_core_register_addr (int regno, int reg_ptr)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
unsigned int word_offset;
|
|
|
|
|
|
|
|
switch (regno)
|
|
|
|
{
|
|
|
|
case PSR_REGNUM:
|
|
|
|
word_offset = R_EPSR;
|
|
|
|
break;
|
|
|
|
case FPSR_REGNUM:
|
|
|
|
word_offset = R_FPSR;
|
|
|
|
break;
|
|
|
|
case FPCR_REGNUM:
|
|
|
|
word_offset = R_FPCR;
|
|
|
|
break;
|
|
|
|
case SXIP_REGNUM:
|
|
|
|
word_offset = R_EXIP;
|
|
|
|
break;
|
|
|
|
case SNIP_REGNUM:
|
|
|
|
word_offset = R_ENIP;
|
|
|
|
break;
|
|
|
|
case SFIP_REGNUM:
|
|
|
|
word_offset = R_EFIP;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (regno <= FP_REGNUM)
|
|
|
|
word_offset = regno;
|
|
|
|
else
|
|
|
|
word_offset = ((regno - X0_REGNUM) * 4);
|
|
|
|
}
|
|
|
|
return (word_offset * 4);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _ES_MP */
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
_initialize_m88k_nat (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef _ES_MP
|
1999-07-07 22:19:36 +02:00
|
|
|
/* Enable 88110 support, as we don't support the 88100 under ES/MP. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
target_is_m88110 = 1;
|
1999-04-16 03:35:26 +02:00
|
|
|
#elif defined(_CX_UX)
|
1999-07-07 22:19:36 +02:00
|
|
|
/* Determine whether we're running on an 88100 or an 88110. */
|
|
|
|
target_is_m88110 = (sinfo (SYSMACHINE, 0) == SYS5800);
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif /* _CX_UX */
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _ES_MP
|
|
|
|
/* Given a pointer to a general register set in /proc format (gregset_t *),
|
|
|
|
unpack the register contents and supply them as gdb's idea of the current
|
|
|
|
register values. */
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
supply_gregset (gregset_t *gregsetp)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
register int regi;
|
|
|
|
register greg_t *regp = (greg_t *) gregsetp;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
for (regi = 0; regi < R_R31; regi++)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
supply_register (regi, (char *) (regp + regi));
|
|
|
|
}
|
1999-07-07 22:19:36 +02:00
|
|
|
supply_register (PSR_REGNUM, (char *) (regp + R_EPSR));
|
1999-04-16 03:35:26 +02:00
|
|
|
supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR));
|
|
|
|
supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR));
|
|
|
|
supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP));
|
|
|
|
supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP));
|
|
|
|
supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a pointer to a floating point register set in /proc format
|
|
|
|
(fpregset_t *), unpack the register contents and supply them as gdb's
|
|
|
|
idea of the current floating point register values. */
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
supply_fpregset (fpregset_t *fpregsetp)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
register int regi;
|
|
|
|
char *from;
|
1999-07-07 22:19:36 +02:00
|
|
|
|
|
|
|
for (regi = FP0_REGNUM; regi <= FPLAST_REGNUM; regi++)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
from = (char *) &((*fpregsetp)[regi - FP0_REGNUM]);
|
1999-04-16 03:35:26 +02:00
|
|
|
supply_register (regi, from);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _ES_MP */
|
|
|
|
|
|
|
|
#ifdef _CX_UX
|
|
|
|
|
|
|
|
#include <sys/regset.h>
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
unsigned int
|
|
|
|
m88k_harris_core_register_addr (int regno, int reg_ptr)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
unsigned int word_offset;
|
|
|
|
|
|
|
|
switch (regno)
|
|
|
|
{
|
|
|
|
case PSR_REGNUM:
|
|
|
|
word_offset = R_PSR;
|
|
|
|
break;
|
|
|
|
case FPSR_REGNUM:
|
|
|
|
word_offset = R_FPSR;
|
|
|
|
break;
|
|
|
|
case FPCR_REGNUM:
|
|
|
|
word_offset = R_FPCR;
|
|
|
|
break;
|
|
|
|
case SXIP_REGNUM:
|
|
|
|
word_offset = R_XIP;
|
|
|
|
break;
|
|
|
|
case SNIP_REGNUM:
|
|
|
|
word_offset = R_NIP;
|
|
|
|
break;
|
|
|
|
case SFIP_REGNUM:
|
|
|
|
word_offset = R_FIP;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (regno <= FP_REGNUM)
|
|
|
|
word_offset = regno;
|
|
|
|
else
|
|
|
|
word_offset = ((regno - X0_REGNUM) * 4) + R_X0;
|
|
|
|
}
|
|
|
|
return (word_offset * 4);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _CX_UX */
|