Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jul 2004 03:52:56 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 57038 for review
Message-ID:  <200407110352.i6B3qukI055731@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=57038

Change 57038 by davidxu@davidxu_alona on 2004/07/11 03:52:28

	use ps_lstop, ps_lcontinue to stop/resume bound thread, however
	signal thread won't be stopped.

Affected files ...

.. //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.c#7 edit
.. //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.h#2 edit

Differences ...

==== //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.c#7 (text+ko) ====

@@ -444,6 +444,8 @@
 {
 	struct pthread pt;
 	pt_thragent_t *ta = (pt_thragent_t *)th->th_ta_p;
+	psaddr_t tcb_addr;
+	uint32_t dflags;
 	int ret;
 
 	TDBG_FUNC();
@@ -468,12 +470,15 @@
 		return (P2T(ret));
 	if (pt.magic != THR_MAGIC)
 		return (TD_BADTH);
+	tcb_addr = (psaddr_t) pt.tcb;
 	ret = ps_pdread(ta->ph,
-	        ((psaddr_t)pt.tcb) + offsetof(struct tcb, tcb_tmbx.tm_lwp),
+	        tcb_addr + offsetof(struct tcb, tcb_tmbx.tm_lwp),
 	        &info->ti_lid, sizeof(lwpid_t));
 	if (ret != 0)
 		return (P2T(ret));
-
+	ret = ps_pdread(ta->ph,
+		tcb_addr + offsetof(struct tcb, tcb_tmbx.tm_dflags),
+		&dflags, sizeof(dflags));
 	info->ti_ta_p = th->th_ta_p;
 	info->ti_tid = th->th_unique;
 	info->ti_tls = (char *)pt.specific; 
@@ -503,7 +508,7 @@
 		break;
 	}
 
-	info->ti_db_suspended = 0;
+	info->ti_db_suspended = ((dflags & TMDF_DONOTRUNUSER) != 0);
 	info->ti_type = TD_THR_USER;
 	info->ti_pri = pt.active_priority;
 	info->ti_sigmask = pt.sigmask;
@@ -815,14 +820,10 @@
 		return (ret);
 
 	if (ta->map[th->th_unique].type == PT_LWP) {
-#if 0
 		if (suspend)
 			ret = ps_lstop(ta->ph, ta->map[th->th_unique].lwp);
 		else
 			ret = ps_lcontinue(ta->ph, ta->map[th->th_unique].lwp);
-#else
-		ret = 0;
-#endif
 		return (P2T(ret));
 	}
 
@@ -841,15 +842,18 @@
 	ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
 	if (ret != 0)
 		return (P2T(ret));
+	/*
+	 * don't stop lwp assigned to a M:N thread, it belongs
+	 * to UTS, UTS shouldn't be stopped.
+	 */
 	if (lwp != 0 && (attrflags & PTHREAD_SCOPE_SYSTEM)) {
-#if 0
+		/* dont' suspend signal thread */
+		if (attrflags & THR_SIGNAL_THREAD)
+			return 0;
 		if (suspend)
 			ret = ps_lstop(ta->ph, lwp);
 		else
 			ret = ps_lcontinue(ta->ph, lwp);
-#else
-		ret = 0;
-#endif
 		return (P2T(ret));
 	}
 

==== //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.h#2 (text+ko) ====



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407110352.i6B3qukI055731>