From 2ec2da86029c7c7d970dca17087e5cc4eef742a9 Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 5 Apr 2005 11:38:30 +0000 Subject: [PATCH] Export thread address. --- lib/libthread_db/libpthread_db.c | 3 +++ lib/libthread_db/libthr_db.c | 5 +++++ lib/libthread_db/thread_db.h | 1 + 3 files changed, 9 insertions(+) diff --git a/lib/libthread_db/libpthread_db.c b/lib/libthread_db/libpthread_db.c index 603f30ed169..f3c6be54b96 100644 --- a/lib/libthread_db/libpthread_db.c +++ b/lib/libthread_db/libpthread_db.c @@ -293,6 +293,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) } th->th_ta = ta; th->th_tid = id; + th->th_thread = pt; return (TD_OK); } @@ -327,6 +328,7 @@ pt_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwp, td_thrhandle_t *th) if (th->th_tid == -1) return (TD_MALLOC); pt_unmap_lwp(ta, lwp); + th->th_thread = pt; return (TD_OK); } @@ -371,6 +373,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, while (pt != 0) { th.th_ta = ta; th.th_tid = pt_map_thread(ta, pt, PT_USER); + th.th_thread = pt; /* should we unmap lwp here ? */ if (th.th_tid == -1) return (TD_MALLOC); diff --git a/lib/libthread_db/libthr_db.c b/lib/libthread_db/libthr_db.c index 299658c2503..873cdfb13f5 100644 --- a/lib/libthread_db/libthr_db.c +++ b/lib/libthread_db/libthr_db.c @@ -296,6 +296,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) } th->th_ta = ta; th->th_tid = id; + th->th_thread = pt; return (TD_OK); } @@ -333,6 +334,7 @@ pt_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwp, td_thrhandle_t *th) return (TD_NOTHR); th->th_ta = ta; th->th_tid = pt_map_thread(ta, lwp, pt); + th->th_thread = pt; if (th->th_tid == -1) return (TD_MALLOC); return (TD_OK); @@ -372,6 +374,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, if (tmp_lwp != 0) { th.th_ta = ta; th.th_tid = pt_map_thread(ta, tmp_lwp, pt); + th.th_thread = pt; if (th.th_tid == -1) return (TD_MALLOC); if ((*callback)(&th, cbdata_p)) @@ -518,6 +521,7 @@ pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) info->ti_tid = th->th_tid; info->ti_state = TD_THR_RUN; info->ti_type = TD_THR_SYSTEM; + info->ti_thread = NULL; return (TD_OK); } ret = ps_pread(ta->ph, ta->map[th->th_tid].thr + ta->thread_off_state, @@ -526,6 +530,7 @@ pt_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *info) return (P2T(ret)); info->ti_lid = ta->map[th->th_tid].lwp; info->ti_tid = th->th_tid; + info->ti_thread = ta->map[th->th_tid].thr; info->ti_ta_p = th->th_ta; if (state == ta->thread_state_running) info->ti_state = TD_THR_RUN; diff --git a/lib/libthread_db/thread_db.h b/lib/libthread_db/thread_db.h index 8827dd698d7..17329c2dc62 100644 --- a/lib/libthread_db/thread_db.h +++ b/lib/libthread_db/thread_db.h @@ -176,6 +176,7 @@ typedef pthread_key_t thread_key_t; typedef struct { const td_thragent_t *ti_ta_p; thread_t ti_tid; + psaddr_t ti_thread; td_thr_state_e ti_state; td_thr_type_e ti_type; td_thr_events_t ti_events;