Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2011 12:47:09 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r224824 - stable/8/lib/libthread_db
Message-ID:  <201108131247.p7DCl9l2016379@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Aug 13 12:47:09 2011
New Revision: 224824
URL: http://svn.freebsd.org/changeset/base/224824

Log:
  MFC: r224683, r224693
  
  The tid member of struct pthread actually is long so read it as such.
  Accessing it as an int causes failure on big-endian LP64, i.e. mips64be,
  powerpc64 and sparc64.
  
  Reviewed by:	marcel

Modified:
  stable/8/lib/libthread_db/libthr_db.c
Directory Properties:
  stable/8/lib/libthread_db/   (props changed)

Modified: stable/8/lib/libthread_db/libthr_db.c
==============================================================================
--- stable/8/lib/libthread_db/libthr_db.c	Sat Aug 13 12:43:35 2011	(r224823)
+++ stable/8/lib/libthread_db/libthr_db.c	Sat Aug 13 12:47:09 2011	(r224824)
@@ -202,7 +202,7 @@ static td_err_e
 pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
 {
 	psaddr_t pt;
-	int32_t lwp;
+	int64_t lwp;
 	int ret;
 
 	TDBG_FUNC();
@@ -214,7 +214,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta
 		return (TD_ERR);
 	/* Iterate through thread list to find pthread */
 	while (pt != 0) {
-		ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp);
+		ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp);
 		if (ret != 0)
 			return (TD_ERR);
 		if (lwp == id)
@@ -245,7 +245,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, 
 {
 	td_thrhandle_t th;
 	psaddr_t pt;
-	int32_t lwp;
+	int64_t lwp;
 	int ret;
 
 	TDBG_FUNC();
@@ -254,7 +254,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, 
 	if (ret != 0)
 		return (TD_ERR);
 	while (pt != 0) {
-		ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp);
+		ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp);
 		if (ret != 0)
 			return (TD_ERR);
 		if (lwp != 0 && lwp != TERMINATED) {
@@ -368,7 +368,7 @@ pt_ta_event_getmsg(const td_thragent_t *
 
 	psaddr_t pt;
 	td_thr_events_e	tmp;
-	int32_t lwp;
+	int64_t lwp;
 	int ret;
 
 	TDBG_FUNC();
@@ -395,7 +395,7 @@ pt_ta_event_getmsg(const td_thragent_t *
 	ps_pwrite(ta->ph, pt + ta->thread_off_event_buf, &tmp, sizeof(tmp));
 	/* Convert event */
 	pt = msg->th_p;
-	ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp);
+	ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp);
 	if (ret != 0)
 		return (TD_ERR);
 	handle.th_ta = ta;
@@ -672,7 +672,7 @@ pt_thr_event_getmsg(const td_thrhandle_t
 	static td_thrhandle_t handle;
 	const td_thragent_t *ta = th->th_ta;
 	psaddr_t pt, pt_temp;
-	int32_t lwp;
+	int64_t lwp;
 	int ret;
 	td_thr_events_e	tmp;
 
@@ -699,7 +699,7 @@ pt_thr_event_getmsg(const td_thrhandle_t
 	ps_pwrite(ta->ph, pt + ta->thread_off_event_buf, &tmp, sizeof(tmp));
 	/* Convert event */
 	pt = msg->th_p;
-	ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp);
+	ret = thr_pread_long(ta, pt + ta->thread_off_tid, &lwp);
 	if (ret != 0)
 		return (TD_ERR);
 	handle.th_ta = ta;



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