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>
+
+ * 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.
/* 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. */
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
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
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
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>],
[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
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
}
-#ifdef HAVE_LINUX_REGSETS
+#ifdef HAVE_PTRACE_GETREGS
#include <sys/procfs.h>
#include <sys/ptrace.h>
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
regsets_fetch_inferior_registers ()
{
struct regset_info *regset;
+ int saw_general_regs = 0;
regset = target_regsets;
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;
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;
}
return (regno >= m68k_num_regs);
}
-#ifdef HAVE_LINUX_REGSETS
+#ifdef HAVE_PTRACE_GETREGS
#include <sys/procfs.h>
#include <sys/ptrace.h>
+ (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
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,
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,