From owner-p4-projects@FreeBSD.ORG Sat Jul 3 20:32:40 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E4ACD16A4D0; Sat, 3 Jul 2004 20:32:39 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A8E7516A4CE for ; Sat, 3 Jul 2004 20:32:39 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1E3D43D45 for ; Sat, 3 Jul 2004 20:32:39 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i63KWdlb097898 for ; Sat, 3 Jul 2004 20:32:39 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i63KWdIb097895 for perforce@freebsd.org; Sat, 3 Jul 2004 20:32:39 GMT (envelope-from marcel@freebsd.org) Date: Sat, 3 Jul 2004 20:32:39 GMT Message-Id: <200407032032.i63KWdIb097895@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 56387 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2004 20:32:40 -0000 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 ==== //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 * 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 +#include + +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