From owner-p4-projects@FreeBSD.ORG Thu Apr 7 07:21:04 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F288816A4D0; Thu, 7 Apr 2005 07:21:03 +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 B521816A4CE for ; Thu, 7 Apr 2005 07:21:03 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88BAD43D2D for ; Thu, 7 Apr 2005 07:21:03 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j377L3LO020747 for ; Thu, 7 Apr 2005 07:21:03 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j377L3EQ020743 for perforce@freebsd.org; Thu, 7 Apr 2005 07:21:03 GMT (envelope-from davidxu@freebsd.org) Date: Thu, 7 Apr 2005 07:21:03 GMT Message-Id: <200504070721.j377L3EQ020743@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 74642 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: Thu, 07 Apr 2005 07:21:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=74642 Change 74642 by davidxu@davidxu_celeron on 2005/04/07 07:20:51 Add code to support event reporting. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthr/pthread.map#3 edit .. //depot/projects/davidxu_thread/src/lib/libthr/thread/Makefile.inc#3 edit .. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_init.c#7 edit .. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_private.h#7 edit .. //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_symbols.c#2 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthr/pthread.map#3 (text+ko) ==== @@ -362,6 +362,8 @@ _thread_size_key; _thread_state_running; _thread_state_zoombie; + _thread_off_per_thread_event_mask; + _thread_event_mask; local: *; }; ==== //depot/projects/davidxu_thread/src/lib/libthr/thread/Makefile.inc#3 (text+ko) ==== @@ -15,6 +15,7 @@ thr_create.c \ thr_detach.c \ thr_equal.c \ + thr_event.c \ thr_exit.c \ thr_fork.c \ thr_getprio.c \ ==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_init.c#7 (text+ko) ==== @@ -384,6 +384,7 @@ _thr_umtx_init(&_rwlock_static_lock); _thr_umtx_init(&_keytable_lock); _thr_umtx_init(&_thr_atfork_lock); + _thr_umtx_init(&_thr_event_lock); _thr_spinlock_init(); _thr_list_init(); ==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_private.h#7 (text+ko) ==== @@ -491,6 +491,9 @@ /* Cleanup handlers Link List */ struct pthread_cleanup *cleanup; + + /* Event reporting mask */ + int event_mask; }; #define THR_UMTX_TRYLOCK(thrd, lck) \ @@ -573,6 +576,17 @@ #define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0) +struct pthread_event +{ + int event; + struct pthread *thread; + void *data; +}; + +/* XXX this must match thread_db.h */ +#define TD_CREATE 0x0004 +#define TD_DEATH 0x0008 + extern int __isthreaded; /* @@ -581,9 +595,12 @@ SCLASS void *_usrstack SCLASS_PRESET(NULL); SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); +SCLASS int _thr_scope_system SCLASS_PRESET(0); + /* For debugger */ SCLASS int _libthr_debug SCLASS_PRESET(0); -SCLASS int _thr_scope_system SCLASS_PRESET(0); +SCLASS int _thread_event_mask SCLASS_PRESET(0); +SCLASS struct pthread_event _thread_event; /* List of all threads: */ SCLASS TAILQ_HEAD(, pthread) _thread_list @@ -643,6 +660,7 @@ SCLASS umtx_t _rwlock_static_lock; SCLASS umtx_t _keytable_lock; SCLASS umtx_t _thr_list_lock; +SCLASS umtx_t _thr_event_lock; /* Undefine the storage class and preset specifiers: */ #undef SCLASS @@ -720,6 +738,11 @@ void _thr_unlink(struct pthread *curthread, struct pthread *thread); void _thr_suspend_check(struct pthread *curthread); void _thr_assert_lock_level() __dead2; +void _thr_report_create(struct pthread *curthread); +void _thr_report_death(struct pthread *curthread); +void _thr_report_event(struct pthread *curthread, int event); +int _thr_create_bp(void); +int _thr_death_bp(void); /* #include */ #ifdef _SYS_AIO_H_ ==== //depot/projects/davidxu_thread/src/lib/libthr/thread/thr_symbols.c#2 (text+ko) ==== @@ -49,6 +49,7 @@ int _thread_off_linkmap = offsetof(Obj_Entry, linkmap); int _thread_off_tlsindex = offsetof(Obj_Entry, tlsindex); int _thread_off_isdead = offsetof(struct pthread, terminated); +int _thread_off_per_thread_event_mask = offsetof(struct pthread, event_mask); int _thread_size_key = sizeof(struct pthread_key); int _thread_off_key_allocated = offsetof(struct pthread_key, allocated); int _thread_off_key_destructor = offsetof(struct pthread_key, destructor);