PERFORCE change 57582 for review
David Xu
davidxu at FreeBSD.org
Sat Jul 17 20:25:54 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=57582
Change 57582 by davidxu at davidxu_alona on 2004/07/18 03:25:10
Use ps_pwrite ps_pread
Affected files ...
.. //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.c#10 edit
Differences ...
==== //depot/projects/davidxu_ksedbg/src/lib/libthread_db/pthread/pthread_db.c#10 (text+ko) ====
@@ -129,7 +129,7 @@
* If this fails it probably means we're debugging a core file and
* can't write to it.
*/
- ps_pdwrite(ph, ta->libkse_debug_addr, &dbg, sizeof(int));
+ ps_pwrite(ph, ta->libkse_debug_addr, &dbg, sizeof(int));
*pta = ta;
return (0);
@@ -150,7 +150,7 @@
* Error returns from this write are not really a problem;
* the process doesn't exist any more.
*/
- ps_pdwrite(ta->ph, ta->libkse_debug_addr, &dbg, sizeof(int));
+ ps_pwrite(ta->ph, ta->libkse_debug_addr, &dbg, sizeof(int));
if (ta->map)
free(ta->map);
free(ta);
@@ -164,7 +164,7 @@
TDBG_FUNC();
- ret = ps_pdread(ta->ph, ta->thread_active_threads_addr, np,
+ ret = ps_pread(ta->ph, ta->thread_active_threads_addr, np,
sizeof(int));
return (P2T(ret));
}
@@ -191,7 +191,7 @@
if (id < 0 || id >= ta->map_len || ta->map[id].type == PT_NONE)
return (TD_NOTHR);
- ret = ps_pdread(ta->ph, ta->thread_list_addr, &thread_list,
+ ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list,
sizeof(thread_list));
if (ret != 0)
return (P2T(ret));
@@ -202,12 +202,12 @@
* mapped to user thread.
*/
while (pt != 0) {
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
tcb_addr + offsetof(struct tcb,
tcb_tmbx.tm_lwp),
&lwp, sizeof(lwp));
@@ -222,7 +222,7 @@
return (TD_NOTHR);
}
/* get next thread */
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tle.tqe_next),
&pt, sizeof(pt));
if (ret != 0)
@@ -237,13 +237,13 @@
}
} else {
while (pt != 0 && ta->map[id].thr != pt) {
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
/* get next thread */
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tle.tqe_next),
&pt, sizeof(pt));
if (ret != 0)
@@ -271,18 +271,18 @@
TDBG_FUNC();
- ret = ps_pdread(ta->ph, ta->thread_list_addr, &thread_list,
+ ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list,
sizeof(thread_list));
if (ret != 0)
return (P2T(ret));
pt = (psaddr_t)thread_list.tqh_first;
while (pt != 0) {
- ret = ps_pdread(ta->ph, pt + offsetof(struct pthread, tcb),
+ ret = ps_pread(ta->ph, pt + offsetof(struct pthread, tcb),
&ptr, sizeof(ptr));
if (ret != 0)
return (P2T(ret));
ptr += offsetof(struct tcb, tcb_tmbx.tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &tmp_lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &tmp_lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
if (tmp_lwp == lwp) {
@@ -295,7 +295,7 @@
}
/* get next thread */
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tle.tqe_next),
&pt, sizeof(pt));
if (ret != 0)
@@ -324,7 +324,7 @@
return (P2T(ret));
if (!activated)
return (0);
- ret = ps_pdread(ta->ph, ta->thread_list_addr, &thread_list,
+ ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list,
sizeof(thread_list));
if (ret != 0)
return (P2T(ret));
@@ -338,7 +338,7 @@
if ((*callback)(&th, cbdata_p))
return (TD_DBERR);
/* get next thread */
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
pt + offsetof(struct pthread, tle.tqe_next),
&pt, sizeof(pt));
if (ret != 0)
@@ -355,7 +355,7 @@
TDBG_FUNC();
- ret = ps_pdread(ta->ph, (psaddr_t)ta->thread_keytable_addr, keytable,
+ ret = ps_pread(ta->ph, (psaddr_t)ta->thread_keytable_addr, keytable,
sizeof(keytable));
if (ret != 0)
return (P2T(ret));
@@ -464,19 +464,19 @@
return (TD_OK);
}
- ret = ps_pdread(ta->ph, (psaddr_t)(ta->map[th->th_unique].thr),
+ ret = ps_pread(ta->ph, (psaddr_t)(ta->map[th->th_unique].thr),
&pt, sizeof(pt));
if (ret != 0)
return (P2T(ret));
if (pt.magic != THR_MAGIC)
return (TD_BADTH);
tcb_addr = (psaddr_t) pt.tcb;
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
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,
+ ret = ps_pread(ta->ph,
tcb_addr + offsetof(struct tcb, tcb_tmbx.tm_dflags),
&dflags, sizeof(dflags));
info->ti_ta_p = th->th_ta_p;
@@ -538,14 +538,14 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
tmbx_addr = tcb_addr + offsetof(struct tcb, tcb_tmbx);
ptr = tmbx_addr + offsetof(struct kse_thr_mailbox, tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
if (lwp != 0) {
@@ -553,7 +553,7 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
if (ret != 0)
return (P2T(ret));
pt_ucontext_to_fpreg(&tmbx.tm_context, fpregs);
@@ -581,21 +581,21 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
tmbx_addr = tcb_addr + offsetof(struct tcb, tcb_tmbx);
ptr = tmbx_addr + offsetof(struct kse_thr_mailbox, tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
if (lwp != 0) {
ret = ps_lgetregs(ta->ph, lwp, gregs);
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
if (ret != 0)
return (P2T(ret));
pt_ucontext_to_reg(&tmbx.tm_context, gregs);
@@ -634,14 +634,14 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
tmbx_addr = tcb_addr + offsetof(struct tcb, tcb_tmbx);
ptr = tmbx_addr + offsetof(struct kse_thr_mailbox, tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
if (lwp != 0) {
@@ -652,12 +652,12 @@
* Read a copy of context, this makes sure that registers
* not covered by structure reg won't be clobbered
*/
- ret = ps_pdread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
if (ret != 0)
return (P2T(ret));
pt_fpreg_to_ucontext(fpregs, &tmbx.tm_context);
- ret = ps_pdwrite(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pwrite(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
return (P2T(ret));
}
@@ -681,14 +681,14 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
tmbx_addr = tcb_addr + offsetof(struct tcb, tcb_tmbx);
ptr = tmbx_addr + offsetof(struct kse_thr_mailbox, tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
if (lwp != 0) {
@@ -700,11 +700,11 @@
* Read a copy of context, make sure that registers
* not covered by structure reg won't be clobbered
*/
- ret = ps_pdread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
if (ret != 0)
return (P2T(ret));
pt_reg_to_ucontext(gregs, &tmbx.tm_context);
- ret = ps_pdwrite(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pwrite(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
return (P2T(ret));
}
@@ -786,7 +786,7 @@
return (TD_OK);
}
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
ta->map[th->th_unique].thr +
offsetof(struct pthread, specific),
&spec, sizeof(spec));
@@ -795,7 +795,7 @@
*data = NULL;
return (0);
}
- ret = ps_pdread(ta->ph, (psaddr_t)&spec[key],
+ ret = ps_pread(ta->ph, (psaddr_t)&spec[key],
&elem, sizeof(elem));
if (ret == 0)
*data = (void *)elem.data;
@@ -827,19 +827,19 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, attr.flags),
&attrflags, sizeof(attrflags));
if (ret != 0)
return (P2T(ret));
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
tmbx_addr = tcb_addr + offsetof(struct tcb, tcb_tmbx);
ptr = tmbx_addr + offsetof(struct kse_thr_mailbox, tm_lwp);
- ret = ps_pdread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
+ ret = ps_pread(ta->ph, ptr, &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
/*
@@ -857,7 +857,7 @@
return (P2T(ret));
}
- ret = ps_pdread(ta->ph,
+ ret = ps_pread(ta->ph,
tmbx_addr + offsetof(struct kse_thr_mailbox, tm_dflags),
&dflags, sizeof(dflags));
if (ret != 0)
@@ -867,7 +867,7 @@
dflags |= TMDF_DONOTRUNUSER;
else
dflags &= ~TMDF_DONOTRUNUSER;
- ret = ps_pdwrite(ta->ph,
+ ret = ps_pwrite(ta->ph,
tmbx_addr + offsetof(struct kse_thr_mailbox, tm_dflags),
&dflags, sizeof(dflags));
return (P2T(ret));
@@ -898,7 +898,7 @@
*a = ta->thread_activated;
return (TD_OK);
}
- ret = ps_pdread(ta->ph, ta->thread_activated_addr,
+ ret = ps_pread(ta->ph, ta->thread_activated_addr,
&ta->thread_activated, sizeof(int));
if (ret == 0)
*a = ta->thread_activated;
@@ -927,7 +927,7 @@
return (0);
}
- ret = ps_pdread(ta->ph, ta->map[th->th_unique].thr +
+ ret = ps_pread(ta->ph, ta->map[th->th_unique].thr +
offsetof(struct pthread, tcb),
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
@@ -935,12 +935,12 @@
/* Clear or set single step flag in thread mailbox */
tmp = step ? TMDF_SSTEP : 0;
- ret = ps_pdwrite(ta->ph, tcb_addr + offsetof(struct tcb,
+ ret = ps_pwrite(ta->ph, tcb_addr + offsetof(struct tcb,
tcb_tmbx.tm_dflags), &tmp, sizeof(tmp));
if (ret != 0)
return (P2T(ret));
/* Get lwp */
- ret = ps_pdread(ta->ph, tcb_addr + offsetof(struct tcb,
+ ret = ps_pread(ta->ph, tcb_addr + offsetof(struct tcb,
tcb_tmbx.tm_lwp), &lwp, sizeof(lwpid_t));
if (ret != 0)
return (P2T(ret));
@@ -953,13 +953,13 @@
* single step status in registers, we should change
* these registers.
*/
- ret = ps_pdread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
+ ret = ps_pread(ta->ph, tmbx_addr, &tmbx, sizeof(tmbx));
if (ret == 0) {
pt_ucontext_to_reg(&tmbx.tm_context, ®s);
/* only write out if it is really changed. */
if (pt_reg_sstep(®s, step) != 0) {
pt_reg_to_ucontext(®s, &tmbx.tm_context);
- ret = ps_pdwrite(ta->ph, tmbx_addr, &tmbx,
+ ret = ps_pwrite(ta->ph, tmbx_addr, &tmbx,
sizeof(tmbx));
}
}
More information about the p4-projects
mailing list