summaryrefslogtreecommitdiffstats
path: root/lib/libthread_db
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-07-30 00:59:19 +0000
committermarcel <marcel@FreeBSD.org>2008-07-30 00:59:19 +0000
commitb40c2c680dab0e4c2250a79f7e6e931adb991a37 (patch)
tree455d667c1dc638f27b2788d1fd4c5bb6b3099870 /lib/libthread_db
parent7938797d4a0017c36f6908b4da0427faa244ae80 (diff)
downloadFreeBSD-src-b40c2c680dab0e4c2250a79f7e6e931adb991a37.zip
FreeBSD-src-b40c2c680dab0e4c2250a79f7e6e931adb991a37.tar.gz
Change the type of psaddr_t from void* to uintptr_t. A pointer
type cannot be made wider to allow ILP32 platforms to target LP64 platforms.
Diffstat (limited to 'lib/libthread_db')
-rw-r--r--lib/libthread_db/libpthread_db.c16
-rw-r--r--lib/libthread_db/libthr_db.c25
-rw-r--r--lib/libthread_db/thread_db.c4
-rw-r--r--lib/libthread_db/thread_db.h3
-rw-r--r--lib/libthread_db/thread_db_int.h4
5 files changed, 25 insertions, 27 deletions
diff --git a/lib/libthread_db/libpthread_db.c b/lib/libthread_db/libpthread_db.c
index 2e2889e..527cd85 100644
--- a/lib/libthread_db/libpthread_db.c
+++ b/lib/libthread_db/libpthread_db.c
@@ -240,8 +240,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
* mapped to user thread.
*/
while (pt != 0) {
- ret = ps_pread(ta->ph,
- pt + ta->thread_off_tcb,
+ ret = ps_pread(ta->ph, pt + ta->thread_off_tcb,
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
@@ -1075,16 +1074,15 @@ pt_validate(const td_thrhandle_t *th)
}
td_err_e
-pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
- void **address)
+pt_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t _linkmap, size_t offset,
+ psaddr_t *address)
{
- char *obj_entry;
const td_thragent_t *ta = th->th_ta;
- psaddr_t tcb_addr, *dtv_addr;
+ psaddr_t dtv_addr, obj_entry, tcb_addr;
int tls_index, ret;
/* linkmap is a member of Obj_Entry */
- obj_entry = (char *)_linkmap - ta->thread_off_linkmap;
+ obj_entry = _linkmap - ta->thread_off_linkmap;
/* get tlsindex of the object file */
ret = ps_pread(ta->ph,
@@ -1106,8 +1104,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
if (ret != 0)
return (P2T(ret));
/* now get the object's tls block base address */
- ret = ps_pread(ta->ph, &dtv_addr[tls_index+1], address,
- sizeof(*address));
+ ret = ps_pread(ta->ph, dtv_addr + sizeof(void *) * (tls_index + 1),
+ address, sizeof(*address));
if (ret != 0)
return (P2T(ret));
diff --git a/lib/libthread_db/libthr_db.c b/lib/libthread_db/libthr_db.c
index 07b8763..bb5b46d 100644
--- a/lib/libthread_db/libthr_db.c
+++ b/lib/libthread_db/libthr_db.c
@@ -216,7 +216,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
return (P2T(ret));
/* Iterate through thread list to find pthread */
pt = (psaddr_t)thread_list.tqh_first;
- while (pt != NULL) {
+ while (pt != 0) {
ret = ps_pread(ta->ph, pt + ta->thread_off_tid,
&lwp, sizeof(lwp));
if (ret != 0)
@@ -230,7 +230,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
if (ret != 0)
return (P2T(ret));
}
- if (pt == NULL)
+ if (pt == 0)
return (TD_NOTHR);
th->th_ta = ta;
th->th_tid = id;
@@ -389,13 +389,13 @@ pt_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg)
ret = ps_pread(ta->ph, ta->thread_last_event_addr, &pt, sizeof(pt));
if (ret != 0)
return (P2T(ret));
- if (pt == NULL)
+ if (pt == 0)
return (TD_NOMSG);
/*
* Take the event pointer, at the time, libthr only reports event
* once a time, so it is not a link list.
*/
- pt_temp = NULL;
+ pt_temp = 0;
ps_pwrite(ta->ph, ta->thread_last_event_addr, &pt_temp, sizeof(pt_temp));
/* Read event info */
@@ -684,7 +684,7 @@ pt_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg)
* once a time, so it is not a link list.
*/
if (pt == pt_temp) {
- pt_temp = NULL;
+ pt_temp = 0;
ps_pwrite(ta->ph, ta->thread_last_event_addr, &pt_temp, sizeof(pt_temp));
}
/* Clear event */
@@ -714,22 +714,21 @@ static int
pt_validate(const td_thrhandle_t *th)
{
- if (th->th_tid == 0 || th->th_thread == NULL)
+ if (th->th_tid == 0 || th->th_thread == 0)
return (TD_ERR);
return (TD_OK);
}
static td_err_e
-pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
- void **address)
+pt_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t _linkmap, size_t offset,
+ psaddr_t *address)
{
- char *obj_entry;
const td_thragent_t *ta = th->th_ta;
- psaddr_t tcb_addr, *dtv_addr;
+ psaddr_t dtv_addr, obj_entry, tcb_addr;
int tls_index, ret;
/* linkmap is a member of Obj_Entry */
- obj_entry = (char *)_linkmap - ta->thread_off_linkmap;
+ obj_entry = _linkmap - ta->thread_off_linkmap;
/* get tlsindex of the object file */
ret = ps_pread(ta->ph,
@@ -750,8 +749,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
if (ret != 0)
return (P2T(ret));
/* now get the object's tls block base address */
- ret = ps_pread(ta->ph, &dtv_addr[tls_index+1], address,
- sizeof(*address));
+ ret = ps_pread(ta->ph, dtv_addr + sizeof(void *) * (tls_index+1),
+ address, sizeof(*address));
if (ret != 0)
return (P2T(ret));
diff --git a/lib/libthread_db/thread_db.c b/lib/libthread_db/thread_db.c
index dcfde691..6daea63 100644
--- a/lib/libthread_db/thread_db.c
+++ b/lib/libthread_db/thread_db.c
@@ -244,8 +244,8 @@ td_thr_validate(const td_thrhandle_t *th)
}
td_err_e
-td_thr_tls_get_addr(const td_thrhandle_t *th, void *linkmap, size_t offset,
- void **address)
+td_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t linkmap, size_t offset,
+ psaddr_t *address)
{
const td_thragent_t *ta = th->th_ta;
return (ta->ta_ops->to_thr_tls_get_addr(th, linkmap, offset, address));
diff --git a/lib/libthread_db/thread_db.h b/lib/libthread_db/thread_db.h
index a05274e..3a1fc7f 100644
--- a/lib/libthread_db/thread_db.h
+++ b/lib/libthread_db/thread_db.h
@@ -239,7 +239,8 @@ td_err_e td_thr_setxmmregs(const td_thrhandle_t *, const char *);
td_err_e td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *);
td_err_e td_thr_setgregs(const td_thrhandle_t *, const prgregset_t);
td_err_e td_thr_validate(const td_thrhandle_t *);
-td_err_e td_thr_tls_get_addr(const td_thrhandle_t *, void *, size_t, void **);
+td_err_e td_thr_tls_get_addr(const td_thrhandle_t *, psaddr_t, size_t,
+ psaddr_t *);
/* FreeBSD specific extensions. */
td_err_e td_thr_sstep(const td_thrhandle_t *, int);
diff --git a/lib/libthread_db/thread_db_int.h b/lib/libthread_db/thread_db_int.h
index 2e5ecba..de545e3 100644
--- a/lib/libthread_db/thread_db_int.h
+++ b/lib/libthread_db/thread_db_int.h
@@ -74,8 +74,8 @@ struct ta_ops {
const prfpregset_t *);
td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
td_err_e (*to_thr_validate)(const td_thrhandle_t *);
- td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *,
- void *, size_t, void **);
+ td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *, psaddr_t,
+ size_t, psaddr_t *);
/* FreeBSD specific extensions. */
td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int);
OpenPOWER on IntegriCloud