Date: Sat, 6 Aug 2011 17:48:30 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r224683 - head/lib/libthread_db Message-ID: <201108061748.p76HmUbM061259@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Sat Aug 6 17:48:30 2011 New Revision: 224683 URL: http://svn.freebsd.org/changeset/base/224683 Log: 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 Approved by: re (kib) MFC after: 1 week Modified: head/lib/libthread_db/libthr_db.c Modified: head/lib/libthread_db/libthr_db.c ============================================================================== --- head/lib/libthread_db/libthr_db.c Sat Aug 6 17:45:52 2011 (r224682) +++ head/lib/libthread_db/libthr_db.c Sat Aug 6 17:48:30 2011 (r224683) @@ -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; + long 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; + long 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; + long 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; + long 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?201108061748.p76HmUbM061259>