Date: Sat, 3 Jul 2004 20:32:39 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 56387 for review Message-ID: <200407032032.i63KWdIb097895@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=56387 Change 56387 by marcel@marcel_nfs on 2004/07/03 20:31:41 Merge with David's libthread_db implementation. This is not a verbatim copy of his work. It's a step in his direction nonetheless. Debugging of libpthread doesn't work because there are changes on his branch I didn't pull in. Affected files ... .. //depot/projects/gdb/lib/libthread_db/Makefile#3 edit .. //depot/projects/gdb/lib/libthread_db/libc_r_db.c#1 add .. //depot/projects/gdb/lib/libthread_db/libpthread_db.c#1 add .. //depot/projects/gdb/lib/libthread_db/libthr_db.c#1 add .. //depot/projects/gdb/lib/libthread_db/thread_db.c#1 add .. //depot/projects/gdb/lib/libthread_db/thread_db.h#5 edit .. //depot/projects/gdb/lib/libthread_db/thread_db_int.h#3 edit Differences ... ==== //depot/projects/gdb/lib/libthread_db/Makefile#3 (text+ko) ==== @@ -2,13 +2,8 @@ LIB= thread_db SHLIB_MAJOR= 1 -SRCS= td_init.c td_ta_delete.c td_ta_event_addr.c td_ta_event_getmsg.c \ - td_ta_map_id2thr.c td_ta_map_lwp2thr.c td_ta_new.c td_ta_set_event.c \ - td_ta_thr_iter.c td_thr_event_enable.c td_thr_get_info.c \ - td_thr_getfpregs.c td_thr_getgregs.c td_thr_setfpregs.c \ - td_thr_setgregs.c td_thr_validate.c +SRCS= libc_r_db.c libthr_db.c thread_db.c INCS= thread_db.h - -WARNS?= 4 +WARNS?= 2 .include <bsd.lib.mk> ==== //depot/projects/gdb/lib/libthread_db/thread_db.h#5 (text+ko) ==== @@ -165,6 +165,8 @@ __BEGIN_DECLS td_err_e td_init(void); + +td_err_e td_ta_clear_event(const td_thragent_t *, td_thr_events_t *); td_err_e td_ta_delete(td_thragent_t *); td_err_e td_ta_event_addr(const td_thragent_t *, td_thr_events_e, td_notify_t *); @@ -175,10 +177,14 @@ td_err_e td_ta_set_event(const td_thragent_t *, td_thr_events_t *); td_err_e td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *, td_thr_state_e, int, sigset_t *, unsigned int); + +td_err_e td_thr_clear_event(const td_thrhandle_t *, td_thr_events_t *); td_err_e td_thr_event_enable(const td_thrhandle_t *, int); +td_err_e td_thr_event_getmsg(const td_thrhandle_t *, td_event_msg_t *); +td_err_e td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *); td_err_e td_thr_getfpregs(const td_thrhandle_t *, prfpregset_t *); td_err_e td_thr_getgregs(const td_thrhandle_t *, prgregset_t *); -td_err_e td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *); +td_err_e td_thr_set_event(const td_thrhandle_t *, td_thr_events_t *); 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 *); ==== //depot/projects/gdb/lib/libthread_db/thread_db_int.h#3 (text+ko) ==== @@ -1,27 +1,27 @@ /* - * Copyright (c) 2004 Marcel Moolenaar + * Copyright (c) 2004 David Xu <davidxu@freebsd.org> * All rights reserved. * * 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 ``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 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. + * 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$ */ @@ -29,30 +29,55 @@ #ifndef _THREAD_DB_INT_H_ #define _THREAD_DB_INT_H_ -enum pthread_lib { - PTHREAD_LIBC_R, - PTHREAD_LIBKSE, - PTHREAD_LIBTHR +#include <sys/types.h> +#include <sys/queue.h> + +struct ta_ops { + td_err_e (*to_init)(void); + + td_err_e (*to_ta_clear_event)(const td_thragent_t *, + td_thr_events_t *); + td_err_e (*to_ta_delete)(td_thragent_t *); + td_err_e (*to_ta_event_addr)(const td_thragent_t *, td_thr_events_e, + td_notify_t *); + td_err_e (*to_ta_event_getmsg)(const td_thragent_t *, + td_event_msg_t *); + td_err_e (*to_ta_map_id2thr)(const td_thragent_t *, thread_t, + td_thrhandle_t *); + td_err_e (*to_ta_map_lwp2thr)(const td_thragent_t *, lwpid_t, + td_thrhandle_t *); + td_err_e (*to_ta_new)(struct ps_prochandle *, td_thragent_t **); + td_err_e (*to_ta_set_event)(const td_thragent_t *, td_thr_events_t *); + td_err_e (*to_ta_thr_iter)(const td_thragent_t *, td_thr_iter_f *, + void *, td_thr_state_e, int, sigset_t *, unsigned int); + + td_err_e (*to_thr_clear_event)(const td_thrhandle_t *, + td_thr_events_t *); + td_err_e (*to_thr_event_enable)(const td_thrhandle_t *, int); + td_err_e (*to_thr_event_getmsg)(const td_thrhandle_t *, + td_event_msg_t *); + td_err_e (*to_thr_get_info)(const td_thrhandle_t *, td_thrinfo_t *); + td_err_e (*to_thr_getfpregs)(const td_thrhandle_t *, prfpregset_t *); + td_err_e (*to_thr_getgregs)(const td_thrhandle_t *, prgregset_t *); + td_err_e (*to_thr_set_event)(const td_thrhandle_t *, + td_thr_events_t *); + td_err_e (*to_thr_setfpregs)(const td_thrhandle_t *, + 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 *); }; -struct td_thragent { - enum pthread_lib ta_lib; - struct ps_prochandle *ta_ph; - psaddr_t ta_debug; +#define TD_THRAGENT_FIELDS \ + TAILQ_ENTRY(td_thragent) ta_next; \ + struct ta_ops *ta_ops - union { - struct { - psaddr_t thread_list; - psaddr_t thread_run; - lwpid_t lwpid; - int offset_next; - int offset_uniqueid; - } libc_r; - struct { - } libkse; - struct { - } libthr; - } ta; -}; +#ifdef TD_DEBUG +#define TDBG(...) ps_plog(__VA_ARGS__) +#define TDBG_FUNC() ps_plog("%s\n", __func__) +#else +#define TDBG(...) +#define TDBG_FUNC() +#endif -#endif /* _THREAD_DB_INT_H_ */ +#endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407032032.i63KWdIb097895>