* 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.
This commit is contained in:
Daniel Jacobowitz 2005-07-13 15:21:02 +00:00
parent a06660f799
commit e9d25b9800
10 changed files with 93 additions and 12 deletions

View file

@ -1,3 +1,17 @@
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> 2005-07-13 Daniel Jacobowitz <dan@codesourcery.com>
* inferiors.c (struct thread_info): Add gdb_id. * inferiors.c (struct thread_info): Add gdb_id.

View file

@ -13,7 +13,7 @@
/* Define to 1 if you have the <linux/elf.h> header file. */ /* Define to 1 if you have the <linux/elf.h> header file. */
#undef HAVE_LINUX_ELF_H #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 #undef HAVE_LINUX_REGSETS
/* Define if the target supports PTRACE_PEEKUSR for register access. */ /* Define if the target supports PTRACE_PEEKUSR for register access. */
@ -41,6 +41,9 @@
access. */ access. */
#undef HAVE_PTRACE_GETFPXREGS #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. */ /* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H #undef HAVE_SGTTY_H

View file

@ -3233,6 +3233,12 @@ _ACEOF
fi fi
if test "${srv_linux_regsets}" = "yes"; then 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 "$as_me:$LINENO: checking for PTRACE_GETREGS" >&5
echo $ECHO_N "checking for PTRACE_GETREGS... $ECHO_C" >&6 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+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 if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_LINUX_REGSETS 1 #define HAVE_PTRACE_GETREGS 1
_ACEOF _ACEOF
fi fi

View file

@ -53,6 +53,9 @@ if test "${srv_linux_usrregs}" = "yes"; then
fi fi
if test "${srv_linux_regsets}" = "yes"; then 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_MSG_CHECKING(for PTRACE_GETREGS)
AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs,
[AC_TRY_COMPILE([#include <sys/ptrace.h>], [AC_TRY_COMPILE([#include <sys/ptrace.h>],
@ -61,7 +64,7 @@ if test "${srv_linux_regsets}" = "yes"; then
[gdbsrv_cv_have_ptrace_getregs=no])]) [gdbsrv_cv_have_ptrace_getregs=no])])
AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs) AC_MSG_RESULT($gdbsrv_cv_have_ptrace_getregs)
if test "${gdbsrv_cv_have_ptrace_getregs}" = "yes"; then 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 ] [Define if the target supports PTRACE_GETREGS for register ]
[access.]) [access.])
fi fi

View file

@ -62,11 +62,13 @@ case "${target}" in
powerpc64-*-linux*) srv_regobj=reg-ppc64.o powerpc64-*-linux*) srv_regobj=reg-ppc64.o
srv_tgtobj="linux-low.o linux-ppc64-low.o" srv_tgtobj="linux-low.o linux-ppc64-low.o"
srv_linux_usrregs=yes srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes srv_linux_thread_db=yes
;; ;;
powerpc-*-linux*) srv_regobj=reg-ppc.o powerpc-*-linux*) srv_regobj=reg-ppc.o
srv_tgtobj="linux-low.o linux-ppc-low.o" srv_tgtobj="linux-low.o linux-ppc-low.o"
srv_linux_usrregs=yes srv_linux_usrregs=yes
srv_linux_regsets=yes
srv_linux_thread_db=yes srv_linux_thread_db=yes
;; ;;
s390-*-linux*) srv_regobj=reg-s390.o s390-*-linux*) srv_regobj=reg-s390.o

View 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/procfs.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
@ -142,8 +142,10 @@ i386_store_fpxregset (const void *buf)
i387_fxsave_to_cache (buf); i387_fxsave_to_cache (buf);
} }
#endif /* HAVE_PTRACE_GETREGS */
struct regset_info target_regsets[] = { struct regset_info target_regsets[] = {
#ifdef HAVE_PTRACE_GETREGS
{ PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
GENERAL_REGS, GENERAL_REGS,
i386_fill_gregset, i386_store_gregset }, i386_fill_gregset, i386_store_gregset },
@ -155,11 +157,10 @@ struct regset_info target_regsets[] = {
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
FP_REGS, FP_REGS,
i386_fill_fpregset, i386_store_fpregset }, i386_fill_fpregset, i386_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
{ 0, 0, -1, -1, NULL, NULL } { 0, 0, -1, -1, NULL, NULL }
}; };
#endif /* HAVE_LINUX_REGSETS */
static const unsigned char i386_breakpoint[] = { 0xCC }; static const unsigned char i386_breakpoint[] = { 0xCC };
#define i386_breakpoint_len 1 #define i386_breakpoint_len 1

View file

@ -1213,6 +1213,7 @@ static int
regsets_fetch_inferior_registers () regsets_fetch_inferior_registers ()
{ {
struct regset_info *regset; struct regset_info *regset;
int saw_general_regs = 0;
regset = target_regsets; regset = target_regsets;
@ -1254,16 +1255,22 @@ regsets_fetch_inferior_registers ()
perror (s); perror (s);
} }
} }
else if (regset->type == GENERAL_REGS)
saw_general_regs = 1;
regset->store_function (buf); regset->store_function (buf);
regset ++; regset ++;
} }
if (saw_general_regs)
return 0; return 0;
else
return 1;
} }
static int static int
regsets_store_inferior_registers () regsets_store_inferior_registers ()
{ {
struct regset_info *regset; struct regset_info *regset;
int saw_general_regs = 0;
regset = target_regsets; regset = target_regsets;
@ -1303,9 +1310,15 @@ regsets_store_inferior_registers ()
perror ("Warning: ptrace(regsets_store_inferior_registers)"); perror ("Warning: ptrace(regsets_store_inferior_registers)");
} }
} }
else if (regset->type == GENERAL_REGS)
saw_general_regs = 1;
regset ++; regset ++;
free (buf); free (buf);
} }
if (saw_general_regs)
return 0;
else
return 1;
return 0; return 0;
} }

View file

@ -65,7 +65,7 @@ m68k_cannot_fetch_register (int regno)
return (regno >= m68k_num_regs); return (regno >= m68k_num_regs);
} }
#ifdef HAVE_LINUX_REGSETS #ifdef HAVE_PTRACE_GETREGS
#include <sys/procfs.h> #include <sys/procfs.h>
#include <sys/ptrace.h> #include <sys/ptrace.h>
@ -107,19 +107,20 @@ m68k_store_fpregset (const void *buf)
+ (m68k_regmap[i] - m68k_regmap[m68k_num_gregs]))); + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
} }
#endif /* HAVE_PTRACE_GETREGS */
struct regset_info target_regsets[] = { struct regset_info target_regsets[] = {
#ifdef HAVE_PTRACE_GETREGS
{ PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
GENERAL_REGS, GENERAL_REGS,
m68k_fill_gregset, m68k_store_gregset }, m68k_fill_gregset, m68k_store_gregset },
{ PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
FP_REGS, FP_REGS,
m68k_fill_fpregset, m68k_store_fpregset }, m68k_fill_fpregset, m68k_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
{ 0, 0, -1, -1, NULL, NULL } { 0, 0, -1, -1, NULL, NULL }
}; };
#endif /* HAVE_LINUX_REGSETS */
static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F }; static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F };
#define m68k_breakpoint_len 2 #define m68k_breakpoint_len 2

View file

@ -101,6 +101,25 @@ ppc_breakpoint_at (CORE_ADDR where)
return 0; 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 = { struct linux_target_ops the_low_target = {
ppc_num_regs, ppc_num_regs,
ppc_regmap, ppc_regmap,

View file

@ -97,6 +97,25 @@ ppc_breakpoint_at (CORE_ADDR where)
return 0; 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 = { struct linux_target_ops the_low_target = {
ppc_num_regs, ppc_num_regs,
ppc_regmap, ppc_regmap,