summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2001-10-08 20:42:08 +0000
committerJoel Brobecker <brobecker@gnat.com>2001-10-08 20:42:08 +0000
commitac99a6829af2084e6571f60b69faa297c0bbd09b (patch)
treead168c9f7ce38d34b89a5989fdb3c217e772c916 /gdb
parent5acc5d51a6c5ddbee08fad83fc086baa01401f88 (diff)
downloadgdb-ac99a6829af2084e6571f60b69faa297c0bbd09b.tar.gz
Rewrite find_active_thread() and find_tcb() to use ptid_t, instead of
overloading the thread and the pid into the same 32-bit value. Make associated necessary adaptations. Also remove unused variable cached_active_thread.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/hpux-thread.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c
index 8401995c485..eec18ffffa5 100644
--- a/gdb/hpux-thread.c
+++ b/gdb/hpux-thread.c
@@ -69,38 +69,35 @@ static void init_hpux_thread_ops (void);
static struct target_ops hpux_thread_ops;
-static int find_active_thread (void);
+static ptid_t find_active_thread (void);
static int cached_thread;
-static int cached_active_thread;
static cma__t_int_tcb cached_tcb;
-static int
+static ptid_t
find_active_thread (void)
{
static cma__t_int_tcb tcb;
CORE_ADDR tcb_ptr;
- if (cached_active_thread != 0)
- return cached_active_thread;
-
read_memory ((CORE_ADDR) P_cma__g_current_thread,
(char *) &tcb_ptr,
sizeof tcb_ptr);
read_memory (tcb_ptr, (char *) &tcb, sizeof tcb);
- return (cma_thread_get_unique (&tcb.prolog.client_thread) << 16)
- | PIDGET (main_ptid);
+ return (ptid_build (PIDGET (main_ptid), 0,
+ cma_thread_get_unique (&tcb.prolog.client_thread)));
}
-static cma__t_int_tcb *find_tcb (int thread);
+static cma__t_int_tcb *find_tcb (ptid_t ptid);
static cma__t_int_tcb *
-find_tcb (int thread)
+find_tcb (ptid_t ptid)
{
cma__t_known_object queue_header;
cma__t_queue *queue_ptr;
+ int thread = ptid_get_tid (ptid);
if (thread == cached_thread)
return &cached_tcb;
@@ -120,14 +117,14 @@ find_tcb (int thread)
read_memory ((CORE_ADDR) tcb_ptr, (char *) &cached_tcb, sizeof cached_tcb);
if (cached_tcb.header.type == cma__c_obj_tcb)
- if (cma_thread_get_unique (&cached_tcb.prolog.client_thread) == thread >> 16)
+ if (cma_thread_get_unique (&cached_tcb.prolog.client_thread) == thread)
{
cached_thread = thread;
return &cached_tcb;
}
}
- error ("Can't find TCB %d,%d", thread >> 16, thread & 0xffff);
+ error ("Can't find TCB %d", thread);
return NULL;
}
@@ -193,7 +190,6 @@ hpux_thread_resume (ptid_t ptid, int step, enum target_signal signo)
child_ops.to_resume (ptid, step, signo);
cached_thread = 0;
- cached_active_thread = 0;
do_cleanups (old_chain);
}
@@ -257,7 +253,7 @@ hpux_thread_fetch_registers (int regno)
int i;
int first_regno, last_regno;
- tcb_ptr = find_tcb (PIDGET (inferior_ptid));
+ tcb_ptr = find_tcb (inferior_ptid);
old_chain = save_inferior_ptid ();
@@ -319,7 +315,7 @@ hpux_thread_store_registers (int regno)
int i;
int first_regno, last_regno;
- tcb_ptr = find_tcb (PIDGET (inferior_ptid));
+ tcb_ptr = find_tcb (inferior_ptid);
old_chain = save_inferior_ptid ();
@@ -532,7 +528,7 @@ hpux_pid_to_str (ptid_t ptid)
static char buf[100];
int pid = PIDGET (ptid);
- sprintf (buf, "Thread %d", pid >> 16);
+ sprintf (buf, "Thread %ld", ptid_get_tid (ptid));
return buf;
}