aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>2024-06-07 18:22:40 +0530
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2024-07-02 17:27:31 +0200
commitd59d4e2f3a86671a4ce7ef89a53b259a820e9af4 (patch)
treeca0cd6e368b05fded0cc20942a8dcb96f19879ac
parenteb5d719dd774afd445dbf2be891868cf1973058c (diff)
downloadgdb-d59d4e2f3a86671a4ce7ef89a53b259a820e9af4.zip
gdb-d59d4e2f3a86671a4ce7ef89a53b259a820e9af4.tar.gz
gdb-d59d4e2f3a86671a4ce7ef89a53b259a820e9af4.tar.bz2
Use lwp field in ptid for AIX.
Currently in AIX, the private data is used to maintain the kernel thread ID. This is a patch to trim the need to have another field in the private data of a thread in AIX. We want to use the lwp field to represent the kernel thread ID to match or make things similar to the Linux targets.
-rw-r--r--gdb/aix-thread.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 327f560..f2c5605 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -78,7 +78,6 @@ static bool debug_aix_thread;
struct aix_thread_info : public private_thread_info
{
pthdb_pthread_t pdtid; /* thread's libpthdebug id */
- pthdb_tid_t tid; /* kernel thread id */
};
/* Return the aix_thread_info attached to THREAD. */
@@ -805,7 +804,9 @@ sync_threadlists (pid_t pid)
if (status != PTHDB_SUCCESS || pthid == PTHDB_INVALID_PTID)
continue;
- ptid_t ptid (pid, 0, pthid);
+ status = pthdb_pthread_tid (data->pd_session, pdtid, &tid);
+ ptid_t ptid (pid, tid, pthid);
+
status = pthdb_pthread_state (data->pd_session, pdtid, &state);
in_queue_threads.insert (pdtid);
@@ -822,8 +823,6 @@ sync_threadlists (pid_t pid)
aix_thread_info *priv = new aix_thread_info;
/* init priv */
priv->pdtid = pdtid;
- status = pthdb_pthread_tid (data->pd_session, pdtid, &tid);
- priv->tid = tid;
/* Check if this is the main thread. If it is, then change
its ptid and add its private data. */
if (in_thread_list (proc_target, ptid_t (pid)))
@@ -875,9 +874,7 @@ static int
iter_tid (struct thread_info *thread, void *tidp)
{
const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
- aix_thread_info *priv = get_aix_thread_info (thread);
-
- return priv->tid == tid;
+ return thread->ptid.lwp () == tid;
}
/* Synchronize libpthdebug's state with the inferior and with GDB,
@@ -1079,7 +1076,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
aix_thread_info *priv = get_aix_thread_info (thread);
- tid[0] = priv->tid;
+ tid[0] = ptid.lwp ();
if (tid[0] == PTHDB_INVALID_TID)
error (_("aix-thread resume: no tid for pthread %ld"),
ptid.lwp ());
@@ -1468,7 +1465,7 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
{
thread = current_inferior ()->find_thread (regcache->ptid ());
aix_thread_info *priv = get_aix_thread_info (thread);
- tid = priv->tid;
+ tid = regcache->ptid().lwp ();
if (tid == PTHDB_INVALID_TID)
fetch_regs_user_thread (regcache, priv->pdtid);
@@ -1933,7 +1930,7 @@ aix_thread_target::store_registers (struct regcache *regcache, int regno)
{
thread = current_inferior ()->find_thread (regcache->ptid ());
aix_thread_info *priv = get_aix_thread_info (thread);
- tid = priv->tid;
+ tid = regcache->ptid ().lwp ();
if (tid == PTHDB_INVALID_TID)
store_regs_user_thread (regcache, priv->pdtid);
@@ -1997,7 +1994,7 @@ aix_thread_target::pid_to_str (ptid_t ptid)
aix_thread_info *priv = get_aix_thread_info (thread_info);
return string_printf (_("Thread %s (tid %s)"), pulongest (ptid.tid ()),
- pulongest (priv->tid));
+ pulongest (ptid.lwp ()));
}
return beneath ()->pid_to_str (ptid);