#include "frame.h"
#include "inferior.h"
-#ifdef USG
#include <sys/types.h>
-#endif
-
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
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)
- {
- 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 == SXIP_REGNUM)
- ptrace (6, inferior_pid,
- (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno));
- else if (regno == SNIP_REGNUM)
- ptrace (6, inferior_pid,
- (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno));
- else if (regno == SFIP_REGNUM)
- ptrace (6, inferior_pid,
- (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno));
- else printf ("Bad register number for store_inferior routine\n");
- }
- else {
- for (regno = 0; regno < NUM_REGS - 3; 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,
- (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM));
- ptrace (6,inferior_pid,
- (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM));
- ptrace (6,inferior_pid,
- (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM));
- }
-
-
+ if (regno < PC_REGNUM)
+ {
+ 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 == SXIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno));
+ else if (regno == SNIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno));
+ else if (regno == SFIP_REGNUM)
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno));
+ else
+ printf ("Bad register number for store_inferior routine\n");
+ }
+ else
+ {
+ 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,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM));
+ }
}
}
}
+#ifdef USE_PROC_FS
+
+#include <sys/procfs.h>
+
+/* 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
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ 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));
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern char registers[];
+
+ 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)];
+}
+
+#endif /* USE_PROC_FS */