From 8bddcf98b7053ce760e83bef04b824ab2c6e79be Mon Sep 17 00:00:00 2001 From: Nicholas Duffek Date: Fri, 7 Apr 2000 01:14:10 +0000 Subject: * sol-thread.c (GET_LWP, GET_THREAD, BUILD_LWP, BUILD_THREAD): Change to rely on PIDGET etc. * config/i386/nm-i386sol2.h (TARGET_HAS_WATCHPOINTS, TARGET_CAN_USE_HARDWARE_WATCHPOINT, HAVE_CONTINUABLE_WATCHPOINT, STOPPED_BY_WATCHPOINT, target_[insert/remove]_watchpoint): define. Allow target to use procfs hardware watchpoints. * config/sparc/nm-sun4sol2.h: ditto. * config/i386/tm-i386sol2.h (PIDGET, TIDGET, MERGEPID): modify definitions to use 16 bits for the pid, 15 bits for the tid, and 1 bit for the flag. * config/sparc/tm-sun4sol2.h: ditto. (SOFTWARE_SINGLE_STEP, SOFTWARE_SINGLE_STEP_P): undefine. * testsuite/gdb.threads/pthreads.exp (all_threads_running): Allow for more than 15 thread increments. --- gdb/sol-thread.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'gdb/sol-thread.c') diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index a3d2d2c9c8d..5d2197e4eaa 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -122,14 +122,14 @@ static void init_sol_core_ops PARAMS ((void)); /* Default definitions: These must be defined in tm.h if they are to be shared with a process module such as procfs. */ -#define THREAD_FLAG 0x80000000 -#define is_thread(ARG) (((ARG) & THREAD_FLAG) != 0) -#define is_lwp(ARG) (((ARG) & THREAD_FLAG) == 0) -#define GET_LWP(PID) TIDGET (PID) -#define GET_THREAD(PID) (((PID) >> 16) & 0x7fff) -#define BUILD_LWP(TID, PID) ((TID) << 16 | (PID)) +#define THREAD_FLAG 0x80000000 +#define is_thread(ARG) (((ARG) & THREAD_FLAG) != 0) +#define is_lwp(ARG) (((ARG) & THREAD_FLAG) == 0) +#define GET_LWP(PID) TIDGET (PID) +#define GET_THREAD(PID) TIDGET (PID) +#define BUILD_LWP(TID, PID) MERGEPID (PID, TID) -#define BUILD_THREAD(THREAD_ID, PID) (THREAD_FLAG | BUILD_LWP (THREAD_ID, PID)) +#define BUILD_THREAD(TID, PID) (MERGEPID (PID, TID) | THREAD_FLAG) /* Pointers to routines from lithread_db resolved by dlopen() */ @@ -1328,6 +1328,12 @@ ps_lgetLDT (gdb_ps_prochandle_t ph, lwpid_t lwpid, extern struct ssd *procfs_find_LDT_entry (int); struct ssd *ret; + /* FIXME: can't I get the process ID from the prochandle or something? + */ + + if (inferior_pid <= 0 || lwpid <= 0) + return PS_BADLID; + ret = procfs_find_LDT_entry (BUILD_LWP (lwpid, PIDGET (inferior_pid))); if (ret) { -- cgit v1.2.1