PERFORCE change 74484 for review

David Xu davidxu at FreeBSD.org
Mon Apr 4 18:27:52 PDT 2005


http://perforce.freebsd.org/chv.cgi?CH=74484

Change 74484 by davidxu at davidxu_celeron on 2005/04/05 01:27:47

	Export thread address to debugger.

Affected files ...

.. //depot/projects/davidxu_thread/src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#3 edit
.. //depot/projects/davidxu_thread/src/lib/libthread_db/libpthread_db.c#2 edit
.. //depot/projects/davidxu_thread/src/lib/libthread_db/libthr_db.c#3 edit
.. //depot/projects/davidxu_thread/src/lib/libthread_db/thread_db.h#2 edit

Differences ...

==== //depot/projects/davidxu_thread/src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c#3 (text+ko) ====

@@ -918,13 +918,13 @@
 
       if (ti.ti_lid != 0)
         {
-          snprintf (buf, sizeof (buf), "Thread %ld (LWP %d)",
-                    GET_THREAD (ptid), ti.ti_lid);
+          snprintf (buf, sizeof (buf), "Thread %p (LWP %d)",
+                    th.th_thread, ti.ti_lid);
         }
       else
         {
-          snprintf (buf, sizeof (buf), "Thread %ld (%s)",
-                    GET_THREAD (ptid), thread_db_state_str (ti.ti_state));
+          snprintf (buf, sizeof (buf), "Thread %p (%s)",
+                    th.th_thread, thread_db_state_str (ti.ti_state));
         }
 
       return buf;

==== //depot/projects/davidxu_thread/src/lib/libthread_db/libpthread_db.c#2 (text+ko) ====

@@ -293,6 +293,7 @@
 	}
 	th->th_ta = ta;
 	th->th_tid = id;
+	th->th_thread = pt;
 	return (TD_OK);
 }
 
@@ -327,6 +328,7 @@
 			if (th->th_tid == -1)
 				return (TD_MALLOC);
 			pt_unmap_lwp(ta, lwp);
+			th->th_thread = pt;
 			return (TD_OK);
 		}
 
@@ -371,6 +373,7 @@
 	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);

==== //depot/projects/davidxu_thread/src/lib/libthread_db/libthr_db.c#3 (text+ko) ====

@@ -296,6 +296,7 @@
 	}
 	th->th_ta  = ta;
 	th->th_tid = id;
+	th->th_thread = pt;
 	return (TD_OK);
 }
 
@@ -333,6 +334,7 @@
 		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 @@
 			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 @@
 		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 @@
 		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;

==== //depot/projects/davidxu_thread/src/lib/libthread_db/thread_db.h#2 (text+ko) ====

@@ -176,6 +176,7 @@
 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;


More information about the p4-projects mailing list