aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-03-28 09:15:22 +0000
committerMark Kettenis <kettenis@gnu.org>2001-03-28 09:15:22 +0000
commit0eebe06ae61dcaabe4e917a4ab5c3823528af1f5 (patch)
tree88d648f0072cc7653a7b835530f614ecf158ec13 /gdb
parentb9511b9a9a06835ac22efe5e37f54aec65f3219e (diff)
downloadgdb-0eebe06ae61dcaabe4e917a4ab5c3823528af1f5.zip
gdb-0eebe06ae61dcaabe4e917a4ab5c3823528af1f5.tar.gz
gdb-0eebe06ae61dcaabe4e917a4ab5c3823528af1f5.tar.bz2
* gdbserver/low-linux.c [I386_GNULINUX_TARGET]: Cleanup code and
make it work again. (NUM_FREGS): Redefine to 0. (NUM_REGS): Redefine as NUM_GREGS. (i386_register_byte, i386_register_raw_size): Update from i386-tdep.c. Add comment about their origin. (regmap, register_u_addr): Take these from i386-linux-nat.c. (i386_register_u_addr): Removed.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/gdbserver/low-linux.c59
2 files changed, 41 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e0e89ef..99dc2be 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2001-03-28 Mark Kettenis <kettenis@gnu.org>
+ * gdbserver/low-linux.c [I386_GNULINUX_TARGET]: Cleanup code and
+ make it work again.
+ (NUM_FREGS): Redefine to 0.
+ (NUM_REGS): Redefine as NUM_GREGS.
+ (i386_register_byte, i386_register_raw_size): Update from
+ i386-tdep.c. Add comment about their origin.
+ (regmap, register_u_addr): Take these from i386-linux-nat.c.
+ (i386_register_u_addr): Removed.
+
* i386-linux-nat.c (i386_linux_dr_get): Return 0 if ptrace call
fails instead of calling perror_with_name. This should fix
debugging remote i386 targets with a native Linux/x86 GDB. Add
diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c
index eb55128..ea210f3 100644
--- a/gdb/gdbserver/low-linux.c
+++ b/gdb/gdbserver/low-linux.c
@@ -155,8 +155,26 @@ myresume (int step, int signal)
#endif
#ifdef I386_GNULINUX_TARGET
-/* i386_register_raw_size[i] is the number of bytes of storage in the
- actual machine representation for register i. */
+/* This module only supports access to the general purpose registers.
+ Adjust the relevant constants accordingly.
+
+ FIXME: kettenis/2001-03-28: We should really use PTRACE_GETREGS to
+ get at the registers. Better yet, we should try to share code with
+ i386-linux-nat.c. */
+#undef NUM_FREGS
+#define NUM_FREGS 0
+#undef NUM_REGS
+#define NUM_REGS NUM_GREGS
+
+/* This stuff comes from i386-tdep.c. */
+
+/* i386_register_byte[i] is the offset into the register file of the
+ start of register number i. We initialize this from
+ i386_register_raw_size. */
+int i386_register_byte[MAX_NUM_REGS];
+
+/* i386_register_raw_size[i] is the number of bytes of storage in
+ GDB's register array occupied by register i. */
int i386_register_raw_size[MAX_NUM_REGS] = {
4, 4, 4, 4,
4, 4, 4, 4,
@@ -171,8 +189,6 @@ int i386_register_raw_size[MAX_NUM_REGS] = {
4
};
-int i386_register_byte[MAX_NUM_REGS];
-
static void
initialize_arch (void)
{
@@ -190,36 +206,25 @@ initialize_arch (void)
}
}
-/* this table must line up with REGISTER_NAMES in tm-i386v.h */
-/* symbols like 'EAX' come from <sys/reg.h> */
-static int regmap[] =
+/* This stuff comes from i386-linux-nat.c. */
+
+/* Mapping between the general-purpose registers in `struct user'
+ format and GDB's register array layout. */
+static int regmap[] =
{
EAX, ECX, EDX, EBX,
UESP, EBP, ESI, EDI,
EIP, EFL, CS, SS,
- DS, ES, FS, GS,
+ DS, ES, FS, GS
};
-int
-i386_register_u_addr (int blockend, int regnum)
-{
-#if 0
- /* this will be needed if fp registers are reinstated */
- /* for now, you can look at them with 'info float'
- * sys5 wont let you change them with ptrace anyway
- */
- if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
- {
- int ubase, fpstate;
- struct user u;
- ubase = blockend + 4 * (SS + 1) - KSTKSZ;
- fpstate = ubase + ((char *) &u.u_fpstate - (char *) &u);
- return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM));
- }
- else
-#endif
- return (blockend + 4 * regmap[regnum]);
+/* Return the address of register REGNUM. BLOCKEND is the value of
+ u.u_ar0, which should point to the registers. */
+CORE_ADDR
+register_u_addr (CORE_ADDR blockend, int regnum)
+{
+ return (blockend + 4 * regmap[regnum]);
}
#elif defined(TARGET_M68K)
static void