/* Prototypes for supply_gregset etc. */
#include "gregset.h"
-/* Prototypes for i387_supply_fsave etc. */
#include "i387-tdep.h"
-
-/* Defines for XMM0_REGNUM etc. */
#include "i386-tdep.h"
-
-/* Defines I386_LINUX_ORIG_EAX_REGNUM. */
#include "i386-linux-tdep.h"
/* Defines ps_err_e, struct ps_prochandle. */
#include "gdb_proc_service.h"
-
-/* Prototypes for local functions. */
-static void dummy_sse_values (void);
\f
/* The register sets used in GNU/Linux ELF core-dumps are identical to
#define GETREGS_SUPPLIES(regno) \
((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
-#define GETFPREGS_SUPPLIES(regno) \
- (FP0_REGNUM <= (regno) && (regno) <= LAST_FPU_CTRL_REGNUM)
-
#define GETFPXREGS_SUPPLIES(regno) \
- (FP0_REGNUM <= (regno) && (regno) <= MXCSR_REGNUM)
+ (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
/* Does the current host support the GETREGS request? */
int have_ptrace_getregs =
gdb_assert (!have_ptrace_getregs);
if (cannot_fetch_register (regno))
{
- supply_register (regno, NULL);
+ regcache_raw_supply (current_regcache, regno, NULL);
return;
}
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
if (errno != 0)
- error ("Couldn't read register %s (#%d): %s.", REGISTER_NAME (regno),
+ error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno),
regno, safe_strerror (errno));
- supply_register (regno, &val);
+ regcache_raw_supply (current_regcache, regno, &val);
}
/* Store one register. */
tid = PIDGET (inferior_ptid); /* Not a threaded program. */
errno = 0;
- regcache_collect (regno, &val);
+ regcache_raw_collect (current_regcache, regno, &val);
ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
if (errno != 0)
- error ("Couldn't write register %s (#%d): %s.", REGISTER_NAME (regno),
+ error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno),
regno, safe_strerror (errno));
}
\f
int i;
for (i = 0; i < I386_NUM_GREGS; i++)
- supply_register (i, regp + regmap[i]);
+ regcache_raw_supply (current_regcache, i, regp + regmap[i]);
if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
- supply_register (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
+ regcache_raw_supply (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+ regp + ORIG_EAX);
}
/* Fill register REGNO (if it is a general-purpose register) in
for (i = 0; i < I386_NUM_GREGS; i++)
if (regno == -1 || regno == i)
- regcache_collect (i, regp + regmap[i]);
+ regcache_raw_collect (current_regcache, i, regp + regmap[i]);
if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
&& I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
- regcache_collect (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
+ regcache_raw_collect (current_regcache, I386_LINUX_ORIG_EAX_REGNUM,
+ regp + ORIG_EAX);
}
#ifdef HAVE_PTRACE_GETREGS
return;
}
- perror_with_name ("Couldn't get registers");
+ perror_with_name (_("Couldn't get registers"));
}
supply_gregset (®s);
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) ®s) < 0)
- perror_with_name ("Couldn't get registers");
+ perror_with_name (_("Couldn't get registers"));
fill_gregset (®s, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) ®s) < 0)
- perror_with_name ("Couldn't write registers");
+ perror_with_name (_("Couldn't write registers"));
}
#else
supply_fpregset (elf_fpregset_t *fpregsetp)
{
i387_supply_fsave (current_regcache, -1, fpregsetp);
- dummy_sse_values ();
}
/* Fill register REGNO (if it is a floating-point register) in
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name ("Couldn't get floating point status");
+ perror_with_name (_("Couldn't get floating point status"));
supply_fpregset (&fpregs);
}
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name ("Couldn't get floating point status");
+ perror_with_name (_("Couldn't get floating point status"));
fill_fpregset (&fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name ("Couldn't write floating point status");
+ perror_with_name (_("Couldn't write floating point status"));
}
#else
return 0;
}
- perror_with_name ("Couldn't read floating-point and SSE registers");
+ perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
supply_fpxregset (&fpxregs);
return 0;
}
- perror_with_name ("Couldn't read floating-point and SSE registers");
+ perror_with_name (_("Couldn't read floating-point and SSE registers"));
}
fill_fpxregset (&fpxregs, regno);
if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
- perror_with_name ("Couldn't write floating-point and SSE registers");
+ perror_with_name (_("Couldn't write floating-point and SSE registers"));
return 1;
}
-/* Fill the XMM registers in the register array with dummy values. For
- cases where we don't have access to the XMM registers. I think
- this is cleaner than printing a warning. For a cleaner solution,
- we should gdbarchify the i386 family. */
-
-static void
-dummy_sse_values (void)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- /* C doesn't have a syntax for NaN's, so write it out as an array of
- longs. */
- static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
- static long mxcsr = 0x1f80;
- int reg;
-
- for (reg = 0; reg < tdep->num_xmm_regs; reg++)
- supply_register (XMM0_REGNUM + reg, (char *) dummy);
- if (tdep->num_xmm_regs > 0)
- supply_register (MXCSR_REGNUM, (char *) &mxcsr);
-}
-
#else
static int fetch_fpxregs (int tid) { return 0; }
static int store_fpxregs (int tid, int regno) { return 0; }
-static void dummy_sse_values (void) {}
#endif /* HAVE_PTRACE_GETFPXREGS */
\f
}
internal_error (__FILE__, __LINE__,
- "Got request for bad register number %d.", regno);
+ _("Got request for bad register number %d."), regno);
}
/* Store register REGNO back into the child process. If REGNO is -1,
}
internal_error (__FILE__, __LINE__,
- "Got request to store bad register number %d.", regno);
+ _("Got request to store bad register number %d."), regno);
}
\f
/* FIXME: kettenis/2001-03-27: Calling perror_with_name if the
ptrace call fails breaks debugging remote targets. The correct
way to fix this is to add the hardware breakpoint and watchpoint
- stuff to the target vectore. For now, just return zero if the
+ stuff to the target vector. For now, just return zero if the
ptrace call fails. */
errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid,
offsetof (struct user, u_debugreg[regnum]), 0);
if (errno != 0)
#if 0
- perror_with_name ("Couldn't read debug register");
+ perror_with_name (_("Couldn't read debug register"));
#else
return 0;
#endif
ptrace (PTRACE_POKEUSER, tid,
offsetof (struct user, u_debugreg[regnum]), value);
if (errno != 0)
- perror_with_name ("Couldn't write debug register");
+ perror_with_name (_("Couldn't write debug register"));
}
void
#define LINUX_SYSCALL_LEN (sizeof linux_syscall)
/* The system call number is stored in the %eax register. */
-#define LINUX_SYSCALL_REGNUM 0 /* %eax */
+#define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM
/* We are specifically interested in the sigreturn and rt_sigreturn
system calls. */
}
if (ptrace (request, pid, 0, target_signal_to_host (signal)) == -1)
- perror_with_name ("ptrace");
+ perror_with_name (("ptrace"));
}
void