diff options
author | Daniel Jacobowitz <drow@false.org> | 2005-07-13 15:21:02 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2005-07-13 15:21:02 +0000 |
commit | e9d25b9800c6f642ae0fe10a0fa57d079d84ff6e (patch) | |
tree | eff685623f742c5dda706a2ca61b4ebb08a44130 | |
parent | a06660f79997c37a351afbce6ce75bd0c3de1276 (diff) | |
download | ppe42-binutils-e9d25b9800c6f642ae0fe10a0fa57d079d84ff6e.tar.gz ppe42-binutils-e9d25b9800c6f642ae0fe10a0fa57d079d84ff6e.zip |
* 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.
-rw-r--r-- | gdb/gdbserver/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/gdbserver/config.in | 5 | ||||
-rwxr-xr-x | gdb/gdbserver/configure | 8 | ||||
-rw-r--r-- | gdb/gdbserver/configure.ac | 5 | ||||
-rw-r--r-- | gdb/gdbserver/configure.srv | 2 | ||||
-rw-r--r-- | gdb/gdbserver/linux-i386-low.c | 11 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 15 | ||||
-rw-r--r-- | gdb/gdbserver/linux-m68k-low.c | 7 | ||||
-rw-r--r-- | gdb/gdbserver/linux-ppc-low.c | 19 | ||||
-rw-r--r-- | gdb/gdbserver/linux-ppc64-low.c | 19 |
10 files changed, 93 insertions, 12 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 1646cc2fcb..be0023ebab 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -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. diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index b9ea6a1c86..f1f264f0bf 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -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 diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 69d666da88..3b3b2d0209 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -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 diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 68c5d84fff..ffef1bd58d 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -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 diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 974a670bb9..f0e4dd368b 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -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 diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c index b2b92b0429..4981fea577 100644 --- a/gdb/gdbserver/linux-i386-low.c +++ b/gdb/gdbserver/linux-i386-low.c @@ -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 diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index aefec5e4bf..70fab4ffd1 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -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; } diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdb/gdbserver/linux-m68k-low.c index 52398bd057..041e6231be 100644 --- a/gdb/gdbserver/linux-m68k-low.c +++ b/gdb/gdbserver/linux-m68k-low.c @@ -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 diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index cd573f1998..0df7c8c192 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -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, diff --git a/gdb/gdbserver/linux-ppc64-low.c b/gdb/gdbserver/linux-ppc64-low.c index 00374e726b..2fe0c235d1 100644 --- a/gdb/gdbserver/linux-ppc64-low.c +++ b/gdb/gdbserver/linux-ppc64-low.c @@ -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, |