2002-06-11 Daniel Jacobowitz <drow@mvista.com>
[deliverable/binutils-gdb.git] / gdb / i386-linux-nat.c
index a9a1fc6ae9da22217f7d3c26c0695704df9cc9ee..222c6146dca4f612b8efe6b911c2627e9aaada13 100644 (file)
@@ -1,5 +1,6 @@
-/* Native-dependent code for Linux/x86.
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Native-dependent code for GNU/Linux x86.
+
+   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "gregset.h"
 
 /* Prototypes for i387_supply_fsave etc.  */
-#include "i387-nat.h"
+#include "i387-tdep.h"
+
+/* Defines for XMM0_REGNUM etc. */
+#include "i386-tdep.h"
 
 /* Prototypes for local functions.  */
 static void dummy_sse_values (void);
 
 \f
 
-/* The register sets used in Linux ELF core-dumps are identical to the
-   register sets in `struct user' that is used for a.out core-dumps,
-   and is also used by `ptrace'.  The corresponding types are
-   `elf_gregset_t' for the general-purpose registers (with
+/* The register sets used in GNU/Linux ELF core-dumps are identical to
+   the register sets in `struct user' that is used for a.out
+   core-dumps, and is also used by `ptrace'.  The corresponding types
+   are `elf_gregset_t' for the general-purpose registers (with
    `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
    for the floating-point registers.
 
@@ -307,7 +311,8 @@ supply_gregset (elf_gregset_t *gregsetp)
   for (i = 0; i < NUM_GREGS; i++)
     supply_register (i, (char *) (regp + regmap[i]));
 
-  supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
+  if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
+    supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
@@ -322,10 +327,11 @@ fill_gregset (elf_gregset_t *gregsetp, int regno)
 
   for (i = 0; i < NUM_GREGS; i++)
     if ((regno == -1 || regno == i))
-      *(regp + regmap[i]) = *(elf_greg_t *) &registers[REGISTER_BYTE (i)];
+      regcache_collect (i, regp + regmap[i]);
 
-  if (regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
-    read_register_gen (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
+  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);
 }
 
 #ifdef HAVE_PTRACE_GETREGS
@@ -449,7 +455,7 @@ static void store_fpregs (int tid, int regno) {}
 /* Fill GDB's register array with the floating-point and SSE register
    values in *FPXREGSETP.  */
 
-static void
+void
 supply_fpxregset (elf_fpxregset_t *fpxregsetp)
 {
   i387_supply_fxsave ((char *) fpxregsetp);
@@ -459,7 +465,7 @@ supply_fpxregset (elf_fpxregset_t *fpxregsetp)
    *FPXREGSETP with the value in GDB's register array.  If REGNO is
    -1, do this for all registers.  */
 
-static void
+void
 fill_fpxregset (elf_fpxregset_t *fpxregsetp, int regno)
 {
   i387_fill_fxsave ((char *) fpxregsetp, regno);
@@ -590,7 +596,7 @@ fetch_inferior_registers (int regno)
       return;
     }
 
-  /* Linux LWP ID's are process ID's.  */
+  /* GNU/Linux LWP ID's are process ID's.  */
   if ((tid = TIDGET (inferior_ptid)) == 0)
     tid = PIDGET (inferior_ptid);              /* Not a threaded program.  */
 
@@ -656,7 +662,7 @@ store_inferior_registers (int regno)
       return;
     }
 
-  /* Linux LWP ID's are process ID's.  */
+  /* GNU/Linux LWP ID's are process ID's.  */
   if ((tid = TIDGET (inferior_ptid)) == 0)
     tid = PIDGET (inferior_ptid);      /* Not a threaded program.  */
 
@@ -775,7 +781,7 @@ i386_linux_dr_get_status (void)
 /* Provide registers to GDB from a core file.
 
    (We can't use the generic version of this function in
-   core-regset.c, because Linux has *three* different kinds of
+   core-regset.c, because GNU/Linux has *three* different kinds of
    register set notes.  core-regset.c would have to call
    supply_fpxregset, which most platforms don't have.)
 
@@ -788,7 +794,7 @@ i386_linux_dr_get_status (void)
      2 --- the floating-point register set, in elf_fpregset_t format
      3 --- the extended floating-point register set, in elf_fpxregset_t format
 
-   REG_ADDR isn't used on Linux.  */
+   REG_ADDR isn't used on GNU/Linux.  */
 
 static void
 fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
@@ -844,7 +850,7 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
 }
 \f
 
-/* The instruction for a Linux system call is:
+/* The instruction for a GNU/Linux system call is:
        int $0x80
    or 0xcd 0x80.  */
 
@@ -932,7 +938,8 @@ child_resume (ptid_t ptid, int step, enum target_signal signal)
 }
 \f
 
-/* Register that we are able to handle Linux ELF core file formats.  */
+/* Register that we are able to handle GNU/Linux ELF core file
+   formats.  */
 
 static struct core_fns linux_elf_core_fns =
 {
This page took 0.052774 seconds and 4 git commands to generate.