diff options
author | marcel <marcel@FreeBSD.org> | 2008-09-14 16:07:21 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2008-09-14 16:07:21 +0000 |
commit | ead754945e1303f4902bb9c1d2f3da9dcc13c967 (patch) | |
tree | 02668a21719febb89d083b97a83b079abb56473a /lib/libthread_db/thread_db.c | |
parent | ae2f507eb0c3fb503f9f2b78128db903aceeabc1 (diff) | |
download | FreeBSD-src-ead754945e1303f4902bb9c1d2f3da9dcc13c967.zip FreeBSD-src-ead754945e1303f4902bb9c1d2f3da9dcc13c967.tar.gz |
Allow psaddr_t to be widened by using thr_pread_{int,long,ptr},
where critical. Some places still use ps_pread/ps_pwrite directly,
but only need changed when byte-order comes into the picture.
Also, change th_p in td_event_msg_t from a pointer type to
psaddr_t, so that events also work when psaddr_t is widened.
Diffstat (limited to 'lib/libthread_db/thread_db.c')
-rw-r--r-- | lib/libthread_db/thread_db.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/libthread_db/thread_db.c b/lib/libthread_db/thread_db.c index 69cc42e..dc8195d 100644 --- a/lib/libthread_db/thread_db.c +++ b/lib/libthread_db/thread_db.c @@ -324,7 +324,7 @@ thr_pread(struct ps_prochandle *ph, psaddr_t addr, uint64_t *val, } int -thr_pread_int(struct td_thragent *ta, psaddr_t addr, uint32_t *val) +thr_pread_int(const struct td_thragent *ta, psaddr_t addr, uint32_t *val) { uint64_t tmp; int error; @@ -337,17 +337,23 @@ thr_pread_int(struct td_thragent *ta, psaddr_t addr, uint32_t *val) } int -thr_pread_long(struct td_thragent *ta, psaddr_t addr, uint64_t *val) +thr_pread_long(const struct td_thragent *ta, psaddr_t addr, uint64_t *val) { return (thr_pread(ta->ph, addr, val, sizeof(long), BYTE_ORDER)); } int -thr_pread_ptr(struct td_thragent *ta, psaddr_t addr, uint64_t *val) +thr_pread_ptr(const struct td_thragent *ta, psaddr_t addr, psaddr_t *val) { + uint64_t tmp; + int error; + + error = thr_pread(ta->ph, addr, &tmp, sizeof(void *), BYTE_ORDER); + if (!error) + *val = tmp; - return (thr_pread(ta->ph, addr, val, sizeof(void *), BYTE_ORDER)); + return (error); } static int @@ -406,21 +412,21 @@ thr_pwrite(struct ps_prochandle *ph, psaddr_t addr, uint64_t val, } int -thr_pwrite_int(struct td_thragent *ta, psaddr_t addr, uint32_t val) +thr_pwrite_int(const struct td_thragent *ta, psaddr_t addr, uint32_t val) { return (thr_pwrite(ta->ph, addr, val, sizeof(int), BYTE_ORDER)); } int -thr_pwrite_long(struct td_thragent *ta, psaddr_t addr, uint64_t val) +thr_pwrite_long(const struct td_thragent *ta, psaddr_t addr, uint64_t val) { return (thr_pwrite(ta->ph, addr, val, sizeof(long), BYTE_ORDER)); } int -thr_pwrite_ptr(struct td_thragent *ta, psaddr_t addr, uint64_t val) +thr_pwrite_ptr(const struct td_thragent *ta, psaddr_t addr, psaddr_t val) { return (thr_pwrite(ta->ph, addr, val, sizeof(void *), BYTE_ORDER)); |