Date: Mon, 18 May 2009 08:55:19 +0100 (BST) From: Robert Watson <rwatson@FreeBSD.org> To: Attilio Rao <attilio@FreeBSD.org> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-6@freebsd.org Subject: Re: svn commit: r192098 - in stable/6: gnu/usr.bin/gdb/libgdb lib/libthr/thread lib/libthread_db lib/libthread_db/arch/alpha lib/libthread_db/arch/amd64 lib/libthread_db/arch/i386 lib/libthread_db/arch... Message-ID: <alpine.BSF.2.00.0905180853370.24449@fledge.watson.org> In-Reply-To: <200905141336.n4EDadT4092402@svn.freebsd.org> References: <200905141336.n4EDadT4092402@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 14 May 2009, Attilio Rao wrote: > Author: attilio > Date: Thu May 14 13:36:39 2009 > New Revision: 192098 > URL: http://svn.freebsd.org/changeset/base/192098 > > Log: > MFC libthread_db modifies until r181651: > - Introduce and use new functions pthread_{read, write}_* > - Move psaddr_t from void * to uintptr_t > - Fix some ABI mismatches > - Introduce WARN 6 for compilation The 6-STABLE amd64 build has been broken for four days now. Please fix, or back out this change. Robert N M Watson Computer Laboratory University of Cambridge > > Added: > stable/6/lib/libthread_db/libc_r_db.h (contents, props changed) > Modified: > stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c > stable/6/lib/libthr/thread/thr_event.c > stable/6/lib/libthread_db/Makefile > stable/6/lib/libthread_db/arch/alpha/libc_r_md.c > stable/6/lib/libthread_db/arch/alpha/libpthread_md.c > stable/6/lib/libthread_db/arch/amd64/libc_r_md.c > stable/6/lib/libthread_db/arch/amd64/libpthread_md.c > stable/6/lib/libthread_db/arch/i386/libc_r_md.c > stable/6/lib/libthread_db/arch/i386/libpthread_md.c > stable/6/lib/libthread_db/arch/ia64/libc_r_md.c > stable/6/lib/libthread_db/arch/ia64/libpthread_md.c > stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c > stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c > stable/6/lib/libthread_db/libc_r_db.c > stable/6/lib/libthread_db/libpthread_db.c > stable/6/lib/libthread_db/libpthread_db.h > stable/6/lib/libthread_db/libthr_db.c > stable/6/lib/libthread_db/thread_db.c > stable/6/lib/libthread_db/thread_db.h > stable/6/lib/libthread_db/thread_db_int.h > stable/6/sys/sys/procfs.h > > Modified: stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c > ============================================================================== > --- stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/gnu/usr.bin/gdb/libgdb/fbsd-threads.c Thu May 14 13:36:39 2009 (r192098) > @@ -710,7 +710,7 @@ check_event (ptid_t ptid) > error ("Cannot get thread event message: %s", > thread_db_err_str (err)); > } > - err = td_thr_get_info_p (msg.th_p, &ti); > + err = td_thr_get_info_p ((void*)(uintptr_t)msg.th_p, &ti); > if (err != TD_OK) > error ("Cannot get thread info: %s", thread_db_err_str (err)); > ptid = BUILD_THREAD (ti.ti_tid, GET_PID (ptid)); > @@ -720,7 +720,7 @@ check_event (ptid_t ptid) > /* We may already know about this thread, for instance when the > user has issued the `info threads' command before the SIGTRAP > for hitting the thread creation breakpoint was reported. */ > - attach_thread (ptid, msg.th_p, &ti, 1); > + attach_thread (ptid, (void *)(uintptr_t)msg.th_p, &ti, 1); > break; > case TD_DEATH: > if (!in_thread_list (ptid)) > @@ -1178,13 +1178,14 @@ fbsd_thread_pid_to_str (ptid_t ptid) > > if (ti.ti_lid != 0) > { > - snprintf (buf, sizeof (buf), "Thread %p (LWP %d)", > - th.th_thread, ti.ti_lid); > + snprintf (buf, sizeof (buf), "Thread %llx (LWP %d)", > + (unsigned long long)th.th_thread, ti.ti_lid); > } > else > { > - snprintf (buf, sizeof (buf), "Thread %p (%s)", > - th.th_thread, thread_db_state_str (ti.ti_state)); > + snprintf (buf, sizeof (buf), "Thread %llx (%s)", > + (unsigned long long)th.th_thread, > + thread_db_state_str (ti.ti_state)); > } > > return buf; > > Modified: stable/6/lib/libthr/thread/thr_event.c > ============================================================================== > --- stable/6/lib/libthr/thread/thr_event.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthr/thread/thr_event.c Thu May 14 13:36:39 2009 (r192098) > @@ -42,7 +42,7 @@ void > _thr_report_creation(struct pthread *curthread, struct pthread *newthread) > { > curthread->event_buf.event = TD_CREATE; > - curthread->event_buf.th_p = (td_thrhandle_t *)newthread; > + curthread->event_buf.th_p = (uintptr_t)newthread; > curthread->event_buf.data = 0; > THR_UMTX_LOCK(curthread, &_thr_event_lock); > _thread_last_event = curthread; > @@ -55,7 +55,7 @@ void > _thr_report_death(struct pthread *curthread) > { > curthread->event_buf.event = TD_DEATH; > - curthread->event_buf.th_p = (td_thrhandle_t *)curthread; > + curthread->event_buf.th_p = (uintptr_t)curthread; > curthread->event_buf.data = 0; > THR_UMTX_LOCK(curthread, &_thr_event_lock); > _thread_last_event = curthread; > > Modified: stable/6/lib/libthread_db/Makefile > ============================================================================== > --- stable/6/lib/libthread_db/Makefile Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/Makefile Thu May 14 13:36:39 2009 (r192098) > @@ -9,7 +9,7 @@ SRCS+= libpthread_db.c libpthread_md.c > SRCS+= libc_r_db.c libc_r_md.c > SRCS+= libthr_db.c > INCS= thread_db.h > -WARNS?= 1 > +WARNS?= 6 > > CFLAGS+=-I. -I${.CURDIR} > > > Modified: stable/6/lib/libthread_db/arch/alpha/libc_r_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/alpha/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/alpha/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,8 +27,7 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <sys/procfs.h> > -#include <machine/setjmp.h> > +#include "libc_r_db.h" > > void > libc_r_md_getgregs(jmp_buf jb, prgregset_t r) > @@ -68,6 +67,6 @@ libc_r_md_getgregs(jmp_buf jb, prgregset > } > > void > -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) > +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) > { > } > > Modified: stable/6/lib/libthread_db/arch/alpha/libpthread_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/alpha/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -30,23 +30,25 @@ __FBSDID("$FreeBSD$"); > #include <sys/procfs.h> > #include <ucontext.h> > > +#include "libpthread_db.h" > + > void > -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) > +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) > +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) > { > } > > void > -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) > +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) > +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) > { > } > > @@ -56,7 +58,7 @@ pt_md_init(void) > } > > int > -pt_reg_sstep(struct reg *reg, int step) > +pt_reg_sstep(struct reg *reg __unused, int step __unused) > { > return (0); > } > > Modified: stable/6/lib/libthread_db/arch/amd64/libc_r_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/amd64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/amd64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,15 +27,14 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <sys/procfs.h> > -#include <machine/setjmp.h> > +#include "libc_r_db.h" > > void > -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) > +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) > { > } > > void > -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) > +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) > { > } > > Modified: stable/6/lib/libthread_db/arch/amd64/libpthread_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/amd64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/amd64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -29,8 +29,11 @@ > __FBSDID("$FreeBSD$"); > > #include <sys/procfs.h> > +#include <thread_db.h> > #include <ucontext.h> > > +#include "libpthread_db.h" > + > void > pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) > { > > Modified: stable/6/lib/libthread_db/arch/i386/libc_r_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/i386/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/i386/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,8 +27,7 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <sys/procfs.h> > -#include <machine/setjmp.h> > +#include "libc_r_db.h" > > void > libc_r_md_getgregs(jmp_buf jb, prgregset_t r) > @@ -43,6 +42,6 @@ libc_r_md_getgregs(jmp_buf jb, prgregset > } > > void > -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) > +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) > { > } > > Modified: stable/6/lib/libthread_db/arch/i386/libpthread_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/i386/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/i386/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,11 +27,10 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <string.h> > #include <sys/types.h> > -#include <proc_service.h> > -#include <thread_db.h> > #include <machine/npx.h> > +#include <string.h> > +#include <thread_db.h> > > #include "libpthread_db.h" > > > Modified: stable/6/lib/libthread_db/arch/ia64/libc_r_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/ia64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/ia64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,15 +27,14 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <sys/procfs.h> > -#include <machine/setjmp.h> > +#include "libc_r_db.h" > > void > -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) > +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) > { > } > > void > -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) > +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) > { > } > > Modified: stable/6/lib/libthread_db/arch/ia64/libpthread_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/ia64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/ia64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -28,25 +28,28 @@ > __FBSDID("$FreeBSD$"); > > #include <sys/procfs.h> > +#include <thread_db.h> > #include <ucontext.h> > > +#include "libpthread_db.h" > + > void > -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) > +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) > +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) > { > } > > void > -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) > +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) > +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) > { > } > > @@ -56,7 +59,7 @@ pt_md_init(void) > } > > int > -pt_reg_sstep(struct reg *reg, int step) > +pt_reg_sstep(struct reg *reg __unused, int step __unused) > { > return (0); > } > > Modified: stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/sparc64/libc_r_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -27,15 +27,14 @@ > #include <sys/cdefs.h> > __FBSDID("$FreeBSD$"); > > -#include <sys/procfs.h> > -#include <machine/setjmp.h> > +#include "libc_r_db.h" > > void > -libc_r_md_getgregs(jmp_buf jb, prgregset_t *r) > +libc_r_md_getgregs(jmp_buf jb __unused, prgregset_t r __unused) > { > } > > void > -libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r) > +libc_r_md_getfpregs(jmp_buf jb __unused, prfpregset_t *r __unused) > { > } > > Modified: stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c > ============================================================================== > --- stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/arch/sparc64/libpthread_md.c Thu May 14 13:36:39 2009 (r192098) > @@ -28,25 +28,28 @@ > __FBSDID("$FreeBSD$"); > > #include <sys/procfs.h> > +#include <thread_db.h> > #include <ucontext.h> > > +#include "libpthread_db.h" > + > void > -pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc) > +pt_reg_to_ucontext(const struct reg *r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r) > +pt_ucontext_to_reg(const ucontext_t *uc __unused, struct reg *r __unused) > { > } > > void > -pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc) > +pt_fpreg_to_ucontext(const struct fpreg* r __unused, ucontext_t *uc __unused) > { > } > > void > -pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r) > +pt_ucontext_to_fpreg(const ucontext_t *uc __unused, struct fpreg *r __unused) > { > } > > @@ -56,7 +59,7 @@ pt_md_init(void) > } > > int > -pt_reg_sstep(struct reg *reg, int step) > +pt_reg_sstep(struct reg *reg __unused, int step __unused) > { > return (0); > } > > Modified: stable/6/lib/libthread_db/libc_r_db.c > ============================================================================== > --- stable/6/lib/libthread_db/libc_r_db.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/libc_r_db.c Thu May 14 13:36:39 2009 (r192098) > @@ -34,11 +34,9 @@ __FBSDID("$FreeBSD$"); > #include <string.h> > #include <thread_db.h> > > +#include "libc_r_db.h" > #include "thread_db_int.h" > > -void libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *); > -void libc_r_md_getgregs(jmp_buf jb, prgregset_t); > - > struct td_thragent { > TD_THRAGENT_FIELDS; > struct ps_prochandle *ta_ph; > @@ -51,13 +49,14 @@ struct td_thragent { > }; > > static td_err_e > -libc_r_db_init() > +libc_r_db_init(void) > { > return (TD_OK); > } > > static td_err_e > -libc_r_db_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *ev) > +libc_r_db_ta_clear_event(const td_thragent_t *ta __unused, > + td_thr_events_t *ev __unused) > { > return (0); > } > @@ -70,27 +69,28 @@ libc_r_db_ta_delete(td_thragent_t *ta) > } > > static td_err_e > -libc_r_db_ta_event_addr(const td_thragent_t *ta, td_thr_events_e ev, > - td_notify_t *n) > +libc_r_db_ta_event_addr(const td_thragent_t *ta __unused, > + td_thr_events_e ev __unused, td_notify_t *n __unused) > { > return (TD_ERR); > } > > static td_err_e > -libc_r_db_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg) > +libc_r_db_ta_event_getmsg(const td_thragent_t *ta __unused, > + td_event_msg_t *msg __unused) > { > return (TD_ERR); > } > > static td_err_e > -libc_r_db_ta_map_id2thr(const td_thragent_t *ta, thread_t tid, > - td_thrhandle_t *th) > +libc_r_db_ta_map_id2thr(const td_thragent_t *ta __unused, thread_t tid __unused, > + td_thrhandle_t *th __unused) > { > return (TD_ERR); > } > > static td_err_e > -libc_r_db_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwpid, > +libc_r_db_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwpid __unused, > td_thrhandle_t *th) > { > psaddr_t addr; > @@ -100,7 +100,7 @@ libc_r_db_ta_map_lwp2thr(const td_thrage > err = ps_pread(ta->ta_ph, ta->ta_thread_initial, &addr, sizeof(addr)); > if (err != PS_OK) > return (TD_ERR); > - if (addr == NULL) > + if (addr == 0) > return (TD_NOLWP); > err = ps_pread(ta->ta_ph, ta->ta_thread_run, &th->th_thread, > sizeof(psaddr_t)); > @@ -159,14 +159,16 @@ libc_r_db_ta_new(struct ps_prochandle *p > } > > static td_err_e > -libc_r_db_ta_set_event(const td_thragent_t *ta, td_thr_events_t *ev) > +libc_r_db_ta_set_event(const td_thragent_t *ta __unused, > + td_thr_events_t *ev __unused) > { > return (0); > } > > static td_err_e > libc_r_db_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *cb, void *data, > - td_thr_state_e state, int pri, sigset_t *mask, unsigned int flags) > + td_thr_state_e state __unused, int pri __unused, sigset_t *mask __unused, > + unsigned int flags __unused) > { > td_thrhandle_t th; > psaddr_t addr; > @@ -178,10 +180,10 @@ libc_r_db_ta_thr_iter(const td_thragent_ > sizeof(th.th_thread)); > if (err != PS_OK) > return (TD_ERR); > - while (th.th_thread != NULL) { > + while (th.th_thread != 0) { > if (cb(&th, data) != 0) > return (TD_OK); > - addr = (psaddr_t)((uintptr_t)th.th_thread + ta->ta_ofs_next); > + addr = (psaddr_t)(th.th_thread + ta->ta_ofs_next); > err = ps_pread(ta->ta_ph, addr, &th.th_thread, > sizeof(th.th_thread)); > if (err != PS_OK) > @@ -191,19 +193,21 @@ libc_r_db_ta_thr_iter(const td_thragent_ > } > > static td_err_e > -libc_r_db_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *ev) > +libc_r_db_thr_clear_event(const td_thrhandle_t *th __unused, > + td_thr_events_t *ev __unused) > { > return (0); > } > > static td_err_e > -libc_r_db_thr_event_enable(const td_thrhandle_t *th, int oo) > +libc_r_db_thr_event_enable(const td_thrhandle_t *th __unused, int oo __unused) > { > return (0); > } > > static td_err_e > -libc_r_db_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg) > +libc_r_db_thr_event_getmsg(const td_thrhandle_t *th __unused, > + td_event_msg_t *msg __unused) > { > return (TD_ERR); > } > @@ -231,7 +235,8 @@ libc_r_db_thr_get_info(const td_thrhandl > > #ifdef __i386__ > static td_err_e > -libc_r_db_thr_getxmmregs(const td_thrhandle_t *th, char *fxsave) > +libc_r_db_thr_getxmmregs(const td_thrhandle_t *th __unused, > + char *fxsave __unused) > { > return (TD_NOFPREGS); > } > @@ -288,33 +293,37 @@ libc_r_db_thr_getgregs(const td_thrhandl > } > > static td_err_e > -libc_r_db_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *ev) > +libc_r_db_thr_set_event(const td_thrhandle_t *th __unused, > + td_thr_events_t *ev __unused) > { > return (0); > } > > #ifdef __i386__ > static td_err_e > -libc_r_db_thr_setxmmregs(const td_thrhandle_t *th, const char *fxsave) > +libc_r_db_thr_setxmmregs(const td_thrhandle_t *th __unused, > + const char *fxsave __unused) > { > return (TD_NOFPREGS); > } > #endif > > static td_err_e > -libc_r_db_thr_setfpregs(const td_thrhandle_t *th, const prfpregset_t *r) > +libc_r_db_thr_setfpregs(const td_thrhandle_t *th __unused, > + const prfpregset_t *r __unused) > { > return (TD_ERR); > } > > static td_err_e > -libc_r_db_thr_setgregs(const td_thrhandle_t *th, const prgregset_t r) > +libc_r_db_thr_setgregs(const td_thrhandle_t *th __unused, > + const prgregset_t r __unused) > { > return (TD_ERR); > } > > static td_err_e > -libc_r_db_thr_validate(const td_thrhandle_t *th) > +libc_r_db_thr_validate(const td_thrhandle_t *th __unused) > { > return (TD_ERR); > } > > Added: stable/6/lib/libthread_db/libc_r_db.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/6/lib/libthread_db/libc_r_db.h Thu May 14 13:36:39 2009 (r192098) > @@ -0,0 +1,41 @@ > +/* > + * Copyright (c) 2008 Sandvine Incorporated > + * All rights reserved. > + * > + * This software was developed by Attilio Rao for the SVOS project under > + * contract to Sandvine Incorporated. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _LIBC_R_DB_H_ > +#define _LIBC_R_DB_H_ > + > +#include <sys/procfs.h> > +#include <machine/setjmp.h> > + > +void libc_r_md_getgregs(jmp_buf jb, prgregset_t r); > +void libc_r_md_getfpregs(jmp_buf jb, prfpregset_t *r); > + > +#endif /* _LIBC_R_DB_H_ */ > > Modified: stable/6/lib/libthread_db/libpthread_db.c > ============================================================================== > --- stable/6/lib/libthread_db/libpthread_db.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/libpthread_db.c Thu May 14 13:36:39 2009 (r192098) > @@ -70,7 +70,7 @@ ps2td(int c) > } > > static long > -pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, int type) > +pt_map_thread(const td_thragent_t *const_ta, psaddr_t pt, enum pt_type type) > { > td_thragent_t *ta = __DECONST(td_thragent_t *, const_ta); > struct pt_map *new; > @@ -220,7 +220,6 @@ static td_err_e > pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) > { > prgregset_t gregs; > - TAILQ_HEAD(, pthread) thread_list; > psaddr_t pt, tcb_addr; > lwpid_t lwp; > int ret; > @@ -229,28 +228,24 @@ pt_ta_map_id2thr(const td_thragent_t *ta > > if (id < 0 || id >= ta->map_len || ta->map[id].type == PT_NONE) > return (TD_NOTHR); > - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, > - sizeof(thread_list)); > + > + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); > if (ret != 0) > - return (P2T(ret)); > - pt = (psaddr_t)thread_list.tqh_first; > + return (TD_ERR); > if (ta->map[id].type == PT_LWP) { > /* > * if we are referencing a lwp, make sure it was not already > * mapped to user thread. > */ > while (pt != 0) { > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_tcb, > - &tcb_addr, sizeof(tcb_addr)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, > + &tcb_addr); > if (ret != 0) > - return (P2T(ret)); > - ret = ps_pread(ta->ph, > - tcb_addr + ta->thread_off_tmbx + > - offsetof(struct kse_thr_mailbox, tm_lwp), > - &lwp, sizeof(lwp)); > + return (TD_ERR); > + ret = thr_pread_int(ta, tcb_addr + ta->thread_off_tmbx + > + offsetof(struct kse_thr_mailbox, tm_lwp), &lwp); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > /* > * If the lwp was already mapped to userland thread, > * we shouldn't reference it directly in future. > @@ -260,11 +255,9 @@ pt_ta_map_id2thr(const td_thragent_t *ta > return (TD_NOTHR); > } > /* get next thread */ > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_next, > - &pt, sizeof(pt)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > } > /* check lwp */ > ret = ps_lgetregs(ta->ph, ta->map[id].lwp, gregs); > @@ -275,17 +268,14 @@ pt_ta_map_id2thr(const td_thragent_t *ta > } > } else { > while (pt != 0 && ta->map[id].thr != pt) { > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_tcb, > - &tcb_addr, sizeof(tcb_addr)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, > + &tcb_addr); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > /* get next thread */ > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_next, > - &pt, sizeof(pt)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > } > > if (pt == 0) { > @@ -303,29 +293,24 @@ pt_ta_map_id2thr(const td_thragent_t *ta > static td_err_e > pt_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwp, td_thrhandle_t *th) > { > - TAILQ_HEAD(, pthread) thread_list; > - psaddr_t pt, ptr; > - lwpid_t tmp_lwp; > + psaddr_t pt, tcb_addr; > + lwpid_t lwp1; > int ret; > - > + > TDBG_FUNC(); > > - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, > - sizeof(thread_list)); > + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); > if (ret != 0) > - return (P2T(ret)); > - pt = (psaddr_t)thread_list.tqh_first; > + return (TD_ERR); > while (pt != 0) { > - ret = ps_pread(ta->ph, pt + ta->thread_off_tcb, > - &ptr, sizeof(ptr)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_tcb, &tcb_addr); > if (ret != 0) > - return (P2T(ret)); > - ptr += ta->thread_off_tmbx + > - offsetof(struct kse_thr_mailbox, tm_lwp); > - ret = ps_pread(ta->ph, ptr, &tmp_lwp, sizeof(lwpid_t)); > + return (TD_ERR); > + ret = thr_pread_int(ta, tcb_addr + ta->thread_off_tmbx + > + offsetof(struct kse_thr_mailbox, tm_lwp), &lwp1); > if (ret != 0) > - return (P2T(ret)); > - if (tmp_lwp == lwp) { > + return (TD_ERR); > + if (lwp1 == lwp) { > th->th_ta = ta; > th->th_tid = pt_map_thread(ta, pt, PT_USER); > if (th->th_tid == -1) > @@ -336,28 +321,23 @@ pt_ta_map_lwp2thr(const td_thragent_t *t > } > > /* get next thread */ > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_next, > - &pt, sizeof(pt)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > } > > return (TD_NOTHR); > } > > static td_err_e > -pt_ta_thr_iter(const td_thragent_t *ta, > - td_thr_iter_f *callback, void *cbdata_p, > - td_thr_state_e state, int ti_pri, > - sigset_t *ti_sigmask_p, > - unsigned int ti_user_flags) > +pt_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *callback, > + void *cbdata_p, td_thr_state_e state __unused, int ti_pri __unused, > + sigset_t *ti_sigmask_p __unused, unsigned int ti_user_flags __unused) > { > - TAILQ_HEAD(, pthread) thread_list; > td_thrhandle_t th; > psaddr_t pt; > ps_err_e pserr; > - int activated; > + int activated, ret; > > TDBG_FUNC(); > > @@ -368,11 +348,9 @@ pt_ta_thr_iter(const td_thragent_t *ta, > if (!activated) > return (TD_OK); > > - pserr = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, > - sizeof(thread_list)); > - if (pserr != 0) > - return (P2T(pserr)); > - pt = (psaddr_t)thread_list.tqh_first; > + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); > + if (ret != 0) > + return (TD_ERR); > while (pt != 0) { > th.th_ta = ta; > th.th_tid = pt_map_thread(ta, pt, PT_USER); > @@ -383,11 +361,9 @@ pt_ta_thr_iter(const td_thragent_t *ta, > if ((*callback)(&th, cbdata_p)) > return (TD_DBERR); > /* get next thread */ > - pserr = ps_pread(ta->ph, > - pt + ta->thread_off_next, &pt, > - sizeof(pt)); > - if (pserr != PS_OK) > - return (P2T(pserr)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); > + if (ret != 0) > + return (TD_ERR); > } > return (TD_OK); > } > @@ -395,7 +371,7 @@ pt_ta_thr_iter(const td_thragent_t *ta, > static td_err_e > pt_ta_tsd_iter(const td_thragent_t *ta, td_key_iter_f *ki, void *arg) > { > - char *keytable; > + void *keytable; > void *destructor; > int i, ret, allocated; > > @@ -411,10 +387,10 @@ pt_ta_tsd_iter(const td_thragent_t *ta, > return (P2T(ret)); > } > for (i = 0; i < ta->thread_max_keys; i++) { > - allocated = *(int *)(keytable + i * ta->thread_size_key + > - ta->thread_off_key_allocated); > - destructor = *(void **)(keytable + i * ta->thread_size_key + > - ta->thread_off_key_destructor); > + allocated = *(int *)(void *)((uintptr_t)keytable + > + i * ta->thread_size_key + ta->thread_off_key_allocated); > + destructor = *(void **)(void *)((uintptr_t)keytable + > + i * ta->thread_size_key + ta->thread_off_key_destructor); > if (allocated) { > ret = (ki)(i, destructor, arg); > if (ret != 0) { > @@ -428,28 +404,32 @@ pt_ta_tsd_iter(const td_thragent_t *ta, > } > > static td_err_e > -pt_ta_event_addr(const td_thragent_t *ta, td_event_e event, td_notify_t *ptr) > +pt_ta_event_addr(const td_thragent_t *ta __unused, td_event_e event __unused, > + td_notify_t *ptr __unused) > { > TDBG_FUNC(); > return (TD_ERR); > } > > static td_err_e > -pt_ta_set_event(const td_thragent_t *ta, td_thr_events_t *events) > +pt_ta_set_event(const td_thragent_t *ta __unused, > + td_thr_events_t *events __unused) > { > TDBG_FUNC(); > return (0); > } > > static td_err_e > -pt_ta_clear_event(const td_thragent_t *ta, td_thr_events_t *events) > +pt_ta_clear_event(const td_thragent_t *ta __unused, > + td_thr_events_t *events __unused) > { > TDBG_FUNC(); > return (0); > } > > static td_err_e > -pt_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg) > +pt_ta_event_getmsg(const td_thragent_t *ta __unused, > + td_event_msg_t *msg __unused) > { > TDBG_FUNC(); > return (TD_NOMSG); > @@ -458,7 +438,7 @@ pt_ta_event_getmsg(const td_thragent_t * > static td_err_e > pt_dbsuspend(const td_thrhandle_t *th, int suspend) > { > - td_thragent_t *ta = (td_thragent_t *)th->th_ta; > + const td_thragent_t *ta = th->th_ta; > psaddr_t tcb_addr, tmbx_addr, ptr; > lwpid_t lwp; > uint32_t dflags; > @@ -952,28 +932,31 @@ pt_thr_setgregs(const td_thrhandle_t *th > } > > static td_err_e > -pt_thr_event_enable(const td_thrhandle_t *th, int en) > +pt_thr_event_enable(const td_thrhandle_t *th __unused, int en __unused) > { > TDBG_FUNC(); > return (0); > } > > static td_err_e > -pt_thr_set_event(const td_thrhandle_t *th, td_thr_events_t *setp) > +pt_thr_set_event(const td_thrhandle_t *th __unused, > + td_thr_events_t *setp __unused) > { > TDBG_FUNC(); > return (0); > } > > static td_err_e > -pt_thr_clear_event(const td_thrhandle_t *th, td_thr_events_t *setp) > +pt_thr_clear_event(const td_thrhandle_t *th __unused, > + td_thr_events_t *setp __unused) > { > TDBG_FUNC(); > return (0); > } > > static td_err_e > -pt_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg) > +pt_thr_event_getmsg(const td_thrhandle_t *th __unused, > + td_event_msg_t *msg __unused) > { > TDBG_FUNC(); > return (TD_NOMSG); > @@ -1074,17 +1057,16 @@ pt_validate(const td_thrhandle_t *th) > return (TD_OK); > } > > -td_err_e > -pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset, > - void **address) > +static td_err_e > +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 +1088,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t > 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)); > > > Modified: stable/6/lib/libthread_db/libpthread_db.h > ============================================================================== > --- stable/6/lib/libthread_db/libpthread_db.h Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/libpthread_db.h Thu May 14 13:36:39 2009 (r192098) > @@ -34,13 +34,14 @@ > > #include "thread_db_int.h" > > -struct pt_map { > - enum { > - PT_NONE, > - PT_USER, > - PT_LWP > - } type; > +enum pt_type { > + PT_NONE, > + PT_USER, > + PT_LWP > +}; > > +struct pt_map { > + enum pt_type type; > union { > lwpid_t lwp; > psaddr_t thr; > > Modified: stable/6/lib/libthread_db/libthr_db.c > ============================================================================== > --- stable/6/lib/libthread_db/libthr_db.c Thu May 14 13:32:33 2009 (r192097) > +++ stable/6/lib/libthread_db/libthr_db.c Thu May 14 13:36:39 2009 (r192098) > @@ -201,36 +201,30 @@ pt_ta_delete(td_thragent_t *ta) > static td_err_e > pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th) > { > - TAILQ_HEAD(, pthread) thread_list; > psaddr_t pt; > - long lwp; > + int32_t lwp; > int ret; > > TDBG_FUNC(); > > if (id == 0) > return (TD_NOTHR); > - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, > - sizeof(thread_list)); > + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > /* Iterate through thread list to find pthread */ > - pt = (psaddr_t)thread_list.tqh_first; > - while (pt != NULL) { > - ret = ps_pread(ta->ph, pt + ta->thread_off_tid, > - &lwp, sizeof(lwp)); > + while (pt != 0) { > + ret = thr_pread_int(ta, pt + ta->thread_off_tid, &lwp); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > if (lwp == id) > break; > /* get next thread */ > - ret = ps_pread(ta->ph, > - pt + ta->thread_off_next, > - &pt, sizeof(pt)); > + ret = thr_pread_ptr(ta, pt + ta->thread_off_next, &pt); > if (ret != 0) > - return (P2T(ret)); > + return (TD_ERR); > } > - if (pt == NULL) > + if (pt == 0) > return (TD_NOTHR); > th->th_ta = ta; > th->th_tid = id; > @@ -245,30 +239,24 @@ pt_ta_map_lwp2thr(const td_thragent_t *t > } > > static td_err_e > -pt_ta_thr_iter(const td_thragent_t *ta, > - td_thr_iter_f *callback, void *cbdata_p, > - td_thr_state_e state, int ti_pri, > - sigset_t *ti_sigmask_p, > - unsigned int ti_user_flags) > +pt_ta_thr_iter(const td_thragent_t *ta, td_thr_iter_f *callback, > + void *cbdata_p, td_thr_state_e state __unused, int ti_pri __unused, > + sigset_t *ti_sigmask_p __unused, unsigned int ti_user_flags __unused) > { > - TAILQ_HEAD(, pthread) thread_list; > td_thrhandle_t th; > psaddr_t pt; > - long lwp; > + int32_t lwp; > int ret; > > TDBG_FUNC(); > > - ret = ps_pread(ta->ph, ta->thread_list_addr, &thread_list, > - sizeof(thread_list)); > + ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); > if (ret != 0) > - return (P2T(ret)); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.0905180853370.24449>