From fdb28ac40143fc026508662a4df94a2582e6bf99 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Mon, 18 Sep 2000 01:08:24 +0000 Subject: [PATCH] Enable Mark Kettenis' linux thread support for Linux/PPC. --- gdb/ChangeLog | 15 ++++++++++++ gdb/config/powerpc/linux.mh | 5 +++- gdb/config/powerpc/nm-linux.h | 30 +++++++++-------------- gdb/ppc-linux-nat.c | 45 +++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9e591cd896..937a703b424 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2000-09-17 Kevin Buettner + + * ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions. + * config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o. + Add proc-service.o, thread-db.o, and lin-lwp.o. + (LOADLIBES): Define. + * config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS): + Remove defines which are already present in ../nm-linux.h. + (solib.h): Don't include this file; it's already included by + ../nm-linux.h. + (PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define + to use the following lin-lwp.c functions... + (lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals, + lin_lwp_attach_lwp): Declare. + 2000-09-17 Kevin Buettner * m88k-nat.c (fetch_inferior_registers): Protoize. diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh index b074e6a40ad..3bc9961e35b 100644 --- a/gdb/config/powerpc/linux.mh +++ b/gdb/config/powerpc/linux.mh @@ -5,6 +5,9 @@ XDEPFILES= XM_CLIBS= NAT_FILE= nm-linux.h -NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o +NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \ +core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o + +LOADLIBES = -ldl -rdynamic GDBSERVER_DEPFILES= low-linux.o diff --git a/gdb/config/powerpc/nm-linux.h b/gdb/config/powerpc/nm-linux.h index 0ef531ce154..5eac7d383fb 100644 --- a/gdb/config/powerpc/nm-linux.h +++ b/gdb/config/powerpc/nm-linux.h @@ -28,9 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define KERNEL_U_SIZE kernel_u_size() extern int kernel_u_size (void); -/* Tell gdb that we can attach and detach other processes */ -#define ATTACH_DETACH - #define U_REGS_OFFSET 0 #define REGISTER_U_ADDR(addr, blockend, regno) \ @@ -40,25 +37,20 @@ extern int kernel_u_size (void); #define NO_SYS_REG_H -#ifdef HAVE_LINK_H -#include "solib.h" /* Support for shared libraries. */ -#define SVR4_SHARED_LIBS -#endif - -/* Support for Linuxthreads. */ - -#ifdef __STDC__ -struct objfile; -#endif +/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h + once we have converted all Linux targets to use the new threads + stuff (without the #undef of course). */ -extern void linuxthreads_new_objfile (struct objfile *objfile); -#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE) +extern int lin_lwp_prepare_to_proceed (void); +#undef PREPARE_TO_PROCEED +#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed () -extern char *linuxthreads_pid_to_str (int pid); -#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID) +extern void lin_lwp_attach_lwp (int pid, int verbose); +#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose)) -extern int linuxthreads_prepare_to_proceed (int step); -#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1) +#include +extern void lin_thread_get_thread_signals (sigset_t *mask); +#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask) #endif /* #ifndef NM_LINUX_H */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index e37aef9d158..7388254aa4c 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -70,6 +70,28 @@ supply_gregset (gregset_t * gregsetp) supply_register (regi, (char *) (regp + regmap[regi])); } +void +fill_gregset (gregset_t *gregsetp, int regno) +{ + int regi; + greg_t *regp = (greg_t *) gregsetp; + +#define COPY_REG(_idx_,_regi_) \ + if ((regno == -1) || regno == _regi_) \ + memcpy (regp + _idx_, ®isters[REGISTER_BYTE (_regi_)], \ + REGISTER_RAW_SIZE (_regi_)) + + for (regi = 0; regi < 32; regi++) + { + COPY_REG (regmap[regi], regi); + } + + for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++) + { + COPY_REG (regmap[regi], regi); + } +} + void supply_fpregset (fpregset_t * fpregsetp) { @@ -79,3 +101,26 @@ supply_fpregset (fpregset_t * fpregsetp) supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi)); } } + +/* Given a pointer to a floating point register set in /proc format + (fpregset_t *), update the register specified by REGNO from gdb's idea + of the current floating point register set. If REGNO is -1, update + them all. */ + +void +fill_fpregset (fpregset_t *fpregsetp, int regno) +{ + int regi; + char *to; + char *from; + + for (regi = 0; regi < 32; regi++) + { + if ((regno == -1) || (regno == FP0_REGNUM + regi)) + { + from = (char *) ®isters[REGISTER_BYTE (FP0_REGNUM + regi)]; + to = (char *) (*fpregsetp + regi); + memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi)); + } + } +} -- 2.30.2