PERFORCE change 55986 for review

Marcel Moolenaar marcel at FreeBSD.org
Sun Jun 27 23:47:46 PDT 2004


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

Change 55986 by marcel at marcel_nfs on 2004/06/28 06:46:43

	Pass the lwpid in the thread info structure. This allows GDB
	to construct the thread list and select the right thread
	as the current thread. For libc_r only...

Affected files ...

.. //depot/projects/gdb/lib/libthread_db/td_ta_new.c#3 edit
.. //depot/projects/gdb/lib/libthread_db/td_thr_get_info.c#4 edit
.. //depot/projects/gdb/lib/libthread_db/thread_db_int.h#2 edit

Differences ...

==== //depot/projects/gdb/lib/libthread_db/td_ta_new.c#3 (text+ko) ====

@@ -48,8 +48,14 @@
 	if (err != PS_OK)
 		return (TD_ERR);
 
-	err = ps_pglobal_lookup(ta->ta_ph, NULL, "_thread_next_offset",
-	    &addr);
+	err = ps_pglobal_lookup(ta->ta_ph, NULL, "_libc_r_lwpid", &addr);
+	if (err != PS_OK)
+		return (TD_ERR);
+	err = ps_pread(ta->ta_ph, addr, &ta->ta.libc_r.lwpid, sizeof(lwpid_t));
+	if (err != PS_OK)
+		return (TD_ERR);
+
+	err = ps_pglobal_lookup(ta->ta_ph, NULL, "_thread_next_offset", &addr);
 	if (err != PS_OK)
 		return (TD_ERR);
 	err = ps_pread(ta->ta_ph, addr, &ta->ta.libc_r.offset_next,

==== //depot/projects/gdb/lib/libthread_db/td_thr_get_info.c#4 (text+ko) ====

@@ -36,18 +36,23 @@
 td_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *ti)
 {
 	const td_thragent_t *ta;
-	psaddr_t addr;
+	psaddr_t addr, current;
 	ps_err_e err;
 
 	ta = th->th_ta;
 	ti->ti_ta = ta;
 	switch (ta->ta_lib) {
 	case PTHREAD_LIBC_R:
+		err = ps_pread(ta->ta_ph, ta->ta.libc_r.thread_run, &current,
+		    sizeof(psaddr_t));
 		addr = (psaddr_t)((uintptr_t)th->th_thread +
 		    ta->ta.libc_r.offset_uniqueid);
 		err = ps_pread(ta->ta_ph, addr, &ti->ti_tid,
 		    sizeof(thread_t));
-		ti->ti_tid++;
+		if (current == th->th_thread)
+			ti->ti_lid = ta->ta.libc_r.lwpid;
+		else
+			ti->ti_lid = 0;
 		return (err == PS_OK) ? TD_OK : TD_ERR;
 	default:
 		break;

==== //depot/projects/gdb/lib/libthread_db/thread_db_int.h#2 (text+ko) ====

@@ -44,6 +44,7 @@
 		struct {
 			psaddr_t thread_list;
 			psaddr_t thread_run;
+			lwpid_t	lwpid;
 			int	offset_next;
 			int	offset_uniqueid;
 		} libc_r;


More information about the p4-projects mailing list