* configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
authorDaniel Jacobowitz <drow@false.org>
Wed, 13 Jul 2005 15:21:02 +0000 (15:21 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 13 Jul 2005 15:21:02 +0000 (15:21 +0000)
is not available.  Define HAVE_PTRACE_GETREGS if it is.
* config.in, configure: Regenerated.
* configure.srv: Set srv_linux_regsets for PowerPC and PowerPC64.
* linux-i386-low.c, linux-m68k-low.c: Update to use
HAVE_PTRACE_GETREGS.
* linux-low.c (regsets_fetch_inferior_registers)
(regsets_store_inferior_registers): Only return 0 if we processed
GENERAL_REGS.
* linux-ppc-low.c (ppc_fill_gregset, target_regsets): New.
* linux-ppc64-low.c (ppc_fill_gregset, target_regsets): New.

gdb/gdbserver/ChangeLog
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.ac
gdb/gdbserver/configure.srv
gdb/gdbserver/linux-i386-low.c
gdb/gdbserver/linux-low.c
gdb/gdbserver/linux-m68k-low.c
gdb/gdbserver/linux-ppc-low.c
gdb/gdbserver/linux-ppc64-low.c

index 1646cc2..be0023e 100644 (file)
@@ -1,5 +1,19 @@
 2005-07-13  Daniel Jacobowitz  <dan@codesourcery.com>
 
+       * configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
+       is not available.  Define HAVE_PTRACE_GETREGS if it is.
+       * config.in, configure: Regenerated.
+       * configure.srv: Set srv_linux_regsets for PowerPC and PowerPC64.
+       * linux-i386-low.c, linux-m68k-low.c: Update to use
+       HAVE_PTRACE_GETREGS.
+       * linux-low.c (regsets_fetch_inferior_registers)
+       (regsets_store_inferior_registers): Only return 0 if we processed
+       GENERAL_REGS.
+       * linux-ppc-low.c (ppc_fill_gregset, target_regsets): New.
+       * linux-ppc64-low.c (ppc_fill_gregset, target_regsets): New.
+
+2005-07-13  Daniel Jacobowitz  <dan@codesourcery.com>
+
        * inferiors.c (struct thread_info): Add gdb_id.
        (add_thread): Add gdb_id argument.
        (thread_id_to_gdb_id, thread_to_gdb_id, gdb_id_to_thread_id): New.
index b9ea6a1..f1f264f 100644 (file)
@@ -13,7 +13,7 @@
 /* Define to 1 if you have the <linux/elf.h> header file. */
 #undef HAVE_LINUX_ELF_H
 
-/* Define if the target supports PTRACE_GETREGS for register access. */
+/* Define if the target supports register sets. */
 #undef HAVE_LINUX_REGSETS
 
 /* Define if the target supports PTRACE_PEEKUSR for register access. */
@@ -41,6 +41,9 @@
    access. */
 #undef HAVE_PTRACE_GETFPXREGS
 
+/* Define if the target supports PTRACE_GETREGS for register access. */
+#undef HAVE_PTRACE_GETREGS
+
 /* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
index 69d666d..3b3b2d0 100755 (executable)
@@ -3233,6 +3233,12 @@ _ACEOF
 fi
 
 if test "${srv_linux_regsets}" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LINUX_REGSETS 1
+_ACEOF
+
+
   echo "$as_me:$LINENO: checking for PTRACE_GETREGS" >&5
 echo $ECHO_N "checking for PTRACE_GETREGS... $ECHO_C" >&6
   if test "${gdbsrv_cv_have_ptrace_getregs+set}" = set; then
@@ -3290,7 +3296,7 @@ echo "${ECHO_T}$gdbsrv_cv_have_ptrace_getregs" >&6
   if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_LINUX_REGSETS 1
+#define HAVE_PTRACE_GETREGS 1
 _ACEOF
 
   fi
index 68c5d84..ffef1bd 100644 (file)
@@ -53,6 +53,9 @@ if test "${srv_linux_usrregs}" = "yes"; then
 fi
 
 if test "${srv_linux_regsets}" = "yes"; then
+  AC_DEFINE(HAVE_LINUX_REGSETS, 1,
+           [Define if the target supports register sets.])
+
   AC_MSG_CHECKING(for PTRACE_GETREGS)
   AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
   [AC_TRY_COMPILE([#include <sys/ptrace.h>],
@@ -61,7 +64,7 @@ if test "${srv_linux_regsets}" = "yes"; then
                  [gdbsrv_cv_have_ptrace_getregs=no])])
   AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
   if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
-    AC_DEFINE(HAVE_LINUX_REGSETS, 1,
+    AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
              [Define if the target supports PTRACE_GETREGS for register ]
              [access.])
   fi
index 974a670..f0e4dd3 100644 (file)
@@ -62,11 +62,13 @@ case "${target}" in
   powerpc64-*-linux*)  srv_regobj=reg-ppc64.o
                        srv_tgtobj="linux-low.o linux-ppc64-low.o"
                        srv_linux_usrregs=yes
+                       srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
   powerpc-*-linux*)    srv_regobj=reg-ppc.o
                        srv_tgtobj="linux-low.o linux-ppc-low.o"
                        srv_linux_usrregs=yes
+                       srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
   s390-*-linux*)       srv_regobj=reg-s390.o
index b2b92b0..4981fea 100644 (file)
@@ -92,7 +92,7 @@ i386_cannot_fetch_register (int regno)
 }
 
 
-#ifdef HAVE_LINUX_REGSETS
+#ifdef HAVE_PTRACE_GETREGS
 #include <sys/procfs.h>
 #include <sys/ptrace.h>
 
@@ -142,24 +142,25 @@ i386_store_fpxregset (const void *buf)
   i387_fxsave_to_cache (buf);
 }
 
+#endif /* HAVE_PTRACE_GETREGS */
 
 struct regset_info target_regsets[] = {
+#ifdef HAVE_PTRACE_GETREGS
   { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
     GENERAL_REGS,
     i386_fill_gregset, i386_store_gregset },
-#ifdef HAVE_PTRACE_GETFPXREGS
+# ifdef HAVE_PTRACE_GETFPXREGS
   { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
     EXTENDED_REGS,
     i386_fill_fpxregset, i386_store_fpxregset },
-#endif
+# endif
   { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
     FP_REGS,
     i386_fill_fpregset, i386_store_fpregset },
+#endif /* HAVE_PTRACE_GETREGS */
   { 0, 0, -1, -1, NULL, NULL }
 };
 
-#endif /* HAVE_LINUX_REGSETS */
-
 static const unsigned char i386_breakpoint[] = { 0xCC };
 #define i386_breakpoint_len 1
 
index aefec5e..70fab4f 100644 (file)
@@ -1213,6 +1213,7 @@ static int
 regsets_fetch_inferior_registers ()
 {
   struct regset_info *regset;
+  int saw_general_regs = 0;
 
   regset = target_regsets;
 
@@ -1254,16 +1255,22 @@ regsets_fetch_inferior_registers ()
              perror (s);
            }
        }
+      else if (regset->type == GENERAL_REGS)
+       saw_general_regs = 1;
       regset->store_function (buf);
       regset ++;
     }
-  return 0;
+  if (saw_general_regs)
+    return 0;
+  else
+    return 1;
 }
 
 static int
 regsets_store_inferior_registers ()
 {
   struct regset_info *regset;
+  int saw_general_regs = 0;
 
   regset = target_regsets;
 
@@ -1303,9 +1310,15 @@ regsets_store_inferior_registers ()
              perror ("Warning: ptrace(regsets_store_inferior_registers)");
            }
        }
+      else if (regset->type == GENERAL_REGS)
+       saw_general_regs = 1;
       regset ++;
       free (buf);
     }
+  if (saw_general_regs)
+    return 0;
+  else
+    return 1;
   return 0;
 }
 
index 52398bd..041e623 100644 (file)
@@ -65,7 +65,7 @@ m68k_cannot_fetch_register (int regno)
   return (regno >= m68k_num_regs);
 }
 
-#ifdef HAVE_LINUX_REGSETS
+#ifdef HAVE_PTRACE_GETREGS
 #include <sys/procfs.h>
 #include <sys/ptrace.h>
 
@@ -107,19 +107,20 @@ m68k_store_fpregset (const void *buf)
                         + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
 }
 
+#endif /* HAVE_PTRACE_GETREGS */
 
 struct regset_info target_regsets[] = {
+#ifdef HAVE_PTRACE_GETREGS
   { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
     GENERAL_REGS,
     m68k_fill_gregset, m68k_store_gregset },
   { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
     FP_REGS,
     m68k_fill_fpregset, m68k_store_fpregset },
+#endif /* HAVE_PTRACE_GETREGS */
   { 0, 0, -1, -1, NULL, NULL }
 };
 
-#endif /* HAVE_LINUX_REGSETS */
-
 static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F };
 #define m68k_breakpoint_len 2
 
index cd573f1..0df7c8c 100644 (file)
@@ -101,6 +101,25 @@ ppc_breakpoint_at (CORE_ADDR where)
   return 0;
 }
 
+/* Provide only a fill function for the general register set.  ps_lgetregs
+   will use this for NPTL support.  */
+
+static void ppc_fill_gregset (void *buf)
+{
+  int i;
+
+  for (i = 0; i < 32; i++)
+    collect_register (i, (char *) buf + ppc_regmap[i]);
+
+  for (i = 64; i < 70; i++)
+    collect_register (i, (char *) buf + ppc_regmap[i]);
+}
+
+struct regset_info target_regsets[] = {
+  { 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
+  { 0, 0, -1, -1, NULL, NULL }
+};
+
 struct linux_target_ops the_low_target = {
   ppc_num_regs,
   ppc_regmap,
index 00374e7..2fe0c23 100644 (file)
@@ -97,6 +97,25 @@ ppc_breakpoint_at (CORE_ADDR where)
   return 0;
 }
 
+/* Provide only a fill function for the general register set.  ps_lgetregs
+   will use this for NPTL support.  */
+
+static void ppc_fill_gregset (void *buf)
+{
+  int i;
+
+  for (i = 0; i < 32; i++)
+    collect_register (i, (char *) buf + ppc_regmap[i]);
+
+  for (i = 64; i < 70; i++)
+    collect_register (i, (char *) buf + ppc_regmap[i]);
+}
+
+struct regset_info target_regsets[] = {
+  { 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
+  { 0, 0, -1, -1, NULL, NULL }
+};
+
 struct linux_target_ops the_low_target = {
   ppc_num_regs,
   ppc_regmap,