From 5da18e19030103b0c8fba67762b9eb5cf621d172 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 18 Nov 2005 06:03:31 +0000 Subject: import new linuxthreads_db from glibc HEAD --- libpthread/linuxthreads_db/.cvsignore | 4 + libpthread/linuxthreads_db/Banner | 1 + libpthread/linuxthreads_db/CVS/Entries | 49 +++ libpthread/linuxthreads_db/CVS/Repository | 1 + libpthread/linuxthreads_db/CVS/Root | 1 + libpthread/linuxthreads_db/ChangeLog | 459 ++++++++++++++++++++++ libpthread/linuxthreads_db/Makefile | 15 + libpthread/linuxthreads_db/Makefile.in | 61 +++ libpthread/linuxthreads_db/Makefile.old | 57 +++ libpthread/linuxthreads_db/Versions | 24 ++ libpthread/linuxthreads_db/libthread_db_so.a | Bin 0 -> 44056 bytes libpthread/linuxthreads_db/proc_service.h | 70 ++++ libpthread/linuxthreads_db/shlib-versions | 2 + libpthread/linuxthreads_db/td_init.c | 32 ++ libpthread/linuxthreads_db/td_log.c | 32 ++ libpthread/linuxthreads_db/td_symbol_list.c | 61 +++ libpthread/linuxthreads_db/td_ta_clear_event.c | 53 +++ libpthread/linuxthreads_db/td_ta_delete.c | 58 +++ libpthread/linuxthreads_db/td_ta_enable_stats.c | 35 ++ libpthread/linuxthreads_db/td_ta_event_addr.c | 73 ++++ libpthread/linuxthreads_db/td_ta_event_getmsg.c | 129 ++++++ libpthread/linuxthreads_db/td_ta_get_nthreads.c | 42 ++ libpthread/linuxthreads_db/td_ta_get_ph.c | 36 ++ libpthread/linuxthreads_db/td_ta_get_stats.c | 35 ++ libpthread/linuxthreads_db/td_ta_map_id2thr.c | 79 ++++ libpthread/linuxthreads_db/td_ta_map_lwp2thr.c | 91 +++++ libpthread/linuxthreads_db/td_ta_new.c | 149 +++++++ libpthread/linuxthreads_db/td_ta_reset_stats.c | 35 ++ libpthread/linuxthreads_db/td_ta_set_event.c | 53 +++ libpthread/linuxthreads_db/td_ta_setconcurrency.c | 35 ++ libpthread/linuxthreads_db/td_ta_thr_iter.c | 176 +++++++++ libpthread/linuxthreads_db/td_ta_tsd_iter.c | 56 +++ libpthread/linuxthreads_db/td_thr_clear_event.c | 62 +++ libpthread/linuxthreads_db/td_thr_dbresume.c | 30 ++ libpthread/linuxthreads_db/td_thr_dbsuspend.c | 30 ++ libpthread/linuxthreads_db/td_thr_event_enable.c | 57 +++ libpthread/linuxthreads_db/td_thr_event_getmsg.c | 65 +++ libpthread/linuxthreads_db/td_thr_get_info.c | 83 ++++ libpthread/linuxthreads_db/td_thr_getfpregs.c | 58 +++ libpthread/linuxthreads_db/td_thr_getgregs.c | 58 +++ libpthread/linuxthreads_db/td_thr_getxregs.c | 30 ++ libpthread/linuxthreads_db/td_thr_getxregsize.c | 30 ++ libpthread/linuxthreads_db/td_thr_set_event.c | 62 +++ libpthread/linuxthreads_db/td_thr_setfpregs.c | 47 +++ libpthread/linuxthreads_db/td_thr_setgregs.c | 47 +++ libpthread/linuxthreads_db/td_thr_setprio.c | 30 ++ libpthread/linuxthreads_db/td_thr_setsigpending.c | 31 ++ libpthread/linuxthreads_db/td_thr_setxregs.c | 30 ++ libpthread/linuxthreads_db/td_thr_sigsetmask.c | 30 ++ libpthread/linuxthreads_db/td_thr_tls_get_addr.c | 45 +++ libpthread/linuxthreads_db/td_thr_tlsbase.c | 71 ++++ libpthread/linuxthreads_db/td_thr_tsd.c | 82 ++++ libpthread/linuxthreads_db/td_thr_validate.c | 70 ++++ libpthread/linuxthreads_db/thread_db.h | 459 ++++++++++++++++++++++ libpthread/linuxthreads_db/thread_dbP.h | 108 +++++ 55 files changed, 3619 insertions(+) create mode 100644 libpthread/linuxthreads_db/.cvsignore create mode 100644 libpthread/linuxthreads_db/Banner create mode 100644 libpthread/linuxthreads_db/CVS/Entries create mode 100644 libpthread/linuxthreads_db/CVS/Repository create mode 100644 libpthread/linuxthreads_db/CVS/Root create mode 100644 libpthread/linuxthreads_db/ChangeLog create mode 100644 libpthread/linuxthreads_db/Makefile create mode 100644 libpthread/linuxthreads_db/Makefile.in create mode 100644 libpthread/linuxthreads_db/Makefile.old create mode 100644 libpthread/linuxthreads_db/Versions create mode 100644 libpthread/linuxthreads_db/libthread_db_so.a create mode 100644 libpthread/linuxthreads_db/proc_service.h create mode 100644 libpthread/linuxthreads_db/shlib-versions create mode 100644 libpthread/linuxthreads_db/td_init.c create mode 100644 libpthread/linuxthreads_db/td_log.c create mode 100644 libpthread/linuxthreads_db/td_symbol_list.c create mode 100644 libpthread/linuxthreads_db/td_ta_clear_event.c create mode 100644 libpthread/linuxthreads_db/td_ta_delete.c create mode 100644 libpthread/linuxthreads_db/td_ta_enable_stats.c create mode 100644 libpthread/linuxthreads_db/td_ta_event_addr.c create mode 100644 libpthread/linuxthreads_db/td_ta_event_getmsg.c create mode 100644 libpthread/linuxthreads_db/td_ta_get_nthreads.c create mode 100644 libpthread/linuxthreads_db/td_ta_get_ph.c create mode 100644 libpthread/linuxthreads_db/td_ta_get_stats.c create mode 100644 libpthread/linuxthreads_db/td_ta_map_id2thr.c create mode 100644 libpthread/linuxthreads_db/td_ta_map_lwp2thr.c create mode 100644 libpthread/linuxthreads_db/td_ta_new.c create mode 100644 libpthread/linuxthreads_db/td_ta_reset_stats.c create mode 100644 libpthread/linuxthreads_db/td_ta_set_event.c create mode 100644 libpthread/linuxthreads_db/td_ta_setconcurrency.c create mode 100644 libpthread/linuxthreads_db/td_ta_thr_iter.c create mode 100644 libpthread/linuxthreads_db/td_ta_tsd_iter.c create mode 100644 libpthread/linuxthreads_db/td_thr_clear_event.c create mode 100644 libpthread/linuxthreads_db/td_thr_dbresume.c create mode 100644 libpthread/linuxthreads_db/td_thr_dbsuspend.c create mode 100644 libpthread/linuxthreads_db/td_thr_event_enable.c create mode 100644 libpthread/linuxthreads_db/td_thr_event_getmsg.c create mode 100644 libpthread/linuxthreads_db/td_thr_get_info.c create mode 100644 libpthread/linuxthreads_db/td_thr_getfpregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_getgregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_getxregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_getxregsize.c create mode 100644 libpthread/linuxthreads_db/td_thr_set_event.c create mode 100644 libpthread/linuxthreads_db/td_thr_setfpregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_setgregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_setprio.c create mode 100644 libpthread/linuxthreads_db/td_thr_setsigpending.c create mode 100644 libpthread/linuxthreads_db/td_thr_setxregs.c create mode 100644 libpthread/linuxthreads_db/td_thr_sigsetmask.c create mode 100644 libpthread/linuxthreads_db/td_thr_tls_get_addr.c create mode 100644 libpthread/linuxthreads_db/td_thr_tlsbase.c create mode 100644 libpthread/linuxthreads_db/td_thr_tsd.c create mode 100644 libpthread/linuxthreads_db/td_thr_validate.c create mode 100644 libpthread/linuxthreads_db/thread_db.h create mode 100644 libpthread/linuxthreads_db/thread_dbP.h (limited to 'libpthread') diff --git a/libpthread/linuxthreads_db/.cvsignore b/libpthread/linuxthreads_db/.cvsignore new file mode 100644 index 000000000..b8456e2ca --- /dev/null +++ b/libpthread/linuxthreads_db/.cvsignore @@ -0,0 +1,4 @@ +.cvsignore +*.os +Makefile +Makefile.in diff --git a/libpthread/linuxthreads_db/Banner b/libpthread/linuxthreads_db/Banner new file mode 100644 index 000000000..6f4f3f818 --- /dev/null +++ b/libpthread/linuxthreads_db/Banner @@ -0,0 +1 @@ +libthread_db work sponsored by Alpha Processor Inc diff --git a/libpthread/linuxthreads_db/CVS/Entries b/libpthread/linuxthreads_db/CVS/Entries new file mode 100644 index 000000000..eed928270 --- /dev/null +++ b/libpthread/linuxthreads_db/CVS/Entries @@ -0,0 +1,49 @@ +/Makefile/1.11/Sat Mar 15 23:09:01 2003// +/td_symbol_list.c/1.5/Thu Dec 18 02:22:04 2003// +/td_ta_new.c/1.13/Thu Jan 30 08:20:09 2003// +/Banner/1.1/Tue Nov 15 14:20:48 2005// +/ChangeLog/1.69/Tue Nov 15 14:20:48 2005// +/Versions/1.4/Tue Nov 15 14:20:48 2005// +/proc_service.h/1.9/Tue Nov 15 14:20:48 2005// +/shlib-versions/1.1/Tue Nov 15 14:20:48 2005// +/td_init.c/1.4/Tue Nov 15 14:20:48 2005// +/td_log.c/1.3/Tue Nov 15 14:20:48 2005// +/td_ta_clear_event.c/1.5/Tue Nov 15 14:20:48 2005// +/td_ta_delete.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_enable_stats.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_event_addr.c/1.6/Tue Nov 15 14:20:48 2005// +/td_ta_event_getmsg.c/1.7/Tue Nov 15 14:20:48 2005// +/td_ta_get_nthreads.c/1.6/Tue Nov 15 14:20:48 2005// +/td_ta_get_ph.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_get_stats.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_map_id2thr.c/1.7/Tue Nov 15 14:20:48 2005// +/td_ta_map_lwp2thr.c/1.8/Tue Nov 15 14:20:48 2005// +/td_ta_reset_stats.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_set_event.c/1.6/Tue Nov 15 14:20:48 2005// +/td_ta_setconcurrency.c/1.4/Tue Nov 15 14:20:48 2005// +/td_ta_thr_iter.c/1.16/Tue Nov 15 14:20:48 2005// +/td_ta_tsd_iter.c/1.6/Tue Nov 15 14:20:48 2005// +/td_thr_clear_event.c/1.6/Tue Nov 15 14:20:48 2005// +/td_thr_dbresume.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_dbsuspend.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_event_enable.c/1.7/Tue Nov 15 14:20:48 2005// +/td_thr_event_getmsg.c/1.5/Tue Nov 15 14:20:48 2005// +/td_thr_get_info.c/1.11/Tue Nov 15 14:20:48 2005// +/td_thr_getfpregs.c/1.7/Tue Nov 15 14:20:48 2005// +/td_thr_getgregs.c/1.11/Tue Nov 15 14:20:48 2005// +/td_thr_getxregs.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_getxregsize.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_set_event.c/1.7/Tue Nov 15 14:20:48 2005// +/td_thr_setfpregs.c/1.6/Tue Nov 15 14:20:48 2005// +/td_thr_setgregs.c/1.8/Tue Nov 15 14:20:48 2005// +/td_thr_setprio.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_setsigpending.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_setxregs.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_sigsetmask.c/1.3/Tue Nov 15 14:20:48 2005// +/td_thr_tls_get_addr.c/1.8/Tue Nov 15 14:20:48 2005// +/td_thr_tlsbase.c/1.4/Tue Nov 15 14:20:48 2005// +/td_thr_tsd.c/1.6/Tue Nov 15 14:20:48 2005// +/td_thr_validate.c/1.8/Tue Nov 15 14:20:48 2005// +/thread_db.h/1.14/Tue Nov 15 14:20:48 2005// +/thread_dbP.h/1.14/Tue Nov 15 14:20:48 2005// +D diff --git a/libpthread/linuxthreads_db/CVS/Repository b/libpthread/linuxthreads_db/CVS/Repository new file mode 100644 index 000000000..8f0007634 --- /dev/null +++ b/libpthread/linuxthreads_db/CVS/Repository @@ -0,0 +1 @@ +ports/linuxthreads_db diff --git a/libpthread/linuxthreads_db/CVS/Root b/libpthread/linuxthreads_db/CVS/Root new file mode 100644 index 000000000..ca45c5d4d --- /dev/null +++ b/libpthread/linuxthreads_db/CVS/Root @@ -0,0 +1 @@ +:pserver:anoncvs@sources.redhat.com:/cvs/glibc diff --git a/libpthread/linuxthreads_db/ChangeLog b/libpthread/linuxthreads_db/ChangeLog new file mode 100644 index 000000000..e39097a58 --- /dev/null +++ b/libpthread/linuxthreads_db/ChangeLog @@ -0,0 +1,459 @@ +2005-11-02 Daniel Jacobowitz + + * td_ta_clear_event.c (td_ta_clear_event): Correct arguments to + sizeof. + * td_ta_set_event.c (td_ta_set_event): Likewise. + * td_thr_clear_event.c (td_thr_clear_event): Likewise. + * td_thr_set_event.c (td_thr_set_event): Likewise. + +2005-01-09 Andreas Jaeger + + * td_thr_tlsbase.c (td_thr_tlsbase): Adjust for dtv change. + +2004-05-01 Jakub Jelinek + + * thread_dbP.h (LOG): Use write instead of __libc_write. + +2004-03-13 Jakub Jelinek + + * td_thr_tlsbase.c: Remove dl-tls.h include. Don't use + TLS_TP_OFFSET in the #if, but TLS_TCB_SIZE == 0 ?:. + +2004-03-12 Roland McGrath + + * td_thr_tlsbase.c [TLS_DTV_AT_TP && TLS_TP_OFFSET > 0]: Handle this + case (PowerPC) differently. + +2003-11-25 Roland McGrath + + * td_symbol_list.c (symbol_list_arr) [HAVE_ASM_GLOBAL_DOT_NAME]: + Prepend "." to symbol names for functions. + +2003-08-18 Daniel Jacobowitz + + * td_thr_getfpregs.c (td_thr_getfpregs): Use the main thread if + the descriptor is uninitialized. + * td_thr_getgregs.c (td_thr_getgregs): Likewise. + +2003-03-15 Roland McGrath + + * thread_db.h (td_err_e): Add TD_NOTLS and TD_TLSDEFER. + (td_thr_tlsbase): Declare it. + * td_thr_tlsbase.c: New file. + * Makefile (libthread_db-routines): Add it. + * Versions (libthread_db: GLIBC_2.3.3): New set, add td_thr_tlsbase. + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Use td_thr_tlsbase. + +2003-02-27 Roland McGrath + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Handle TLS_DTV_AT_TP. + + * td_ta_thr_iter.c (handle_descr) [!defined USE_TLS || !TLS_DTV_AT_TP]: + Conditionalize p_header use on this. + +2003-01-29 Roland McGrath + + * td_ta_new.c (td_ta_new): Cap the `sizeof_descr' value read from the + inferior at `sizeof (struct _pthread_descr_struct)', since we use it + as a length in copies to our own structures. + +2003-01-05 Ulrich Drepper + + * Makefile (libthread_db.so-no-z-defs): Define. + +2002-09-29 Ulrich Drepper + + * td_thr_tsd.c (td_thr_tsd): Read correct entry from pthread_keys + array. + +2002-09-28 Andreas Jaeger + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Fix reference to dtv. + +2002-09-24 Roland McGrath + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Fetch just the + individual members we need, not the whole structures. + +2002-09-24 Ulrich Drepper + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Change second + parameter to be the address of the link map in the inferior process. + * thread_db.h: Update prototype for td_thr_tls_get_addr. + +2002-08-23 Ulrich Drepper + + * thread_dbP.h: Define LINUXTHREADS_VERSION. + * td_symbol_list.c (symbol_list_arr): Add LINUXTHREADS_VERSION string. + * td_ta_new.c (td_ta_new): After verifying the thread library is + there check version. + * thread_db.h: Add new error TD_VERSION. + +2002-08-21 Roland McGrath + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): __attribute_used__ -> + __attribute__ ((unused)) for arguments. + +2002-08-07 Ulrich Drepper + + * thread_dbP.h: Define LINUXTHREADS_INITIAL_REPORT_EVENTS. + * td_thr_event_enable.c (td_thr_event_enable): If th->th_unique is + null write to __linuxthreads_initial_report_events. + * td_symbol_list.c (symbol_list_arr): Add + __linuxthreads_initial_report_events. + +2002-07-16 Ulrich Drepper + + * td_thr_clear_event.c: Yet more changes to help with TLS-enabled + libpthread. + * td_thr_event_enable.c: Likewise. + * td_thr_event_getmsg.c: Likewise. + * td_thr_set_event.c: Likewise. + * td_thr_setfpregs.c: Likewise. + * td_thr_setgregs.c: Likewise. + * td_thr_tsd.c: Likewise. + * td_thr_validate.c: Likewise. + +2002-07-15 Ulrich Drepper + + * td_ta_thr_iter.c: Some more changes to enable using TLS-enabled + libpthread. + * td_thr_event_enable.c: Likewise. + * td_thr_getfpregs.c: Likewise. + * td_thr_getgregs.c: Likewise. + +2002-07-14 Ulrich Drepper + + * td_ta_map_id2thr.c: Begin fixing implementation for libpthread with + TLS support. + * td_ta_map_lwp2thr.c: Likewise. + * td_ta_thr_iter.c: Likewise. + * td_thr_get_info.c: Likewise. + +2002-07-10 Ulrich Drepper + + * Versions [libthread_db] (GLIBC_2.3): Add td_thr_tls_get_addr. + +2002-06-14 H.J. Lu + + * td_thr_tls_get_addr.c (td_thr_tls_get_addr): Don't include + "tls.h". Return TD_ERR if USE_TLS is not defined. + +2002-06-12 Ulrich Drepper + + * td_thr_tls_get_addr.c: New file. + * thread_db.h: Add prototype for td_thr_tls_get_addr. + * Makefile (libthread_db-routines): Add td_thr_tls_get_addr. + +2002-03-03 Andreas Jaeger + + * thread_dbP.h: Include for prototypes of __libc_write. + +2002-02-04 Ulrich Drepper + + * thread_dbP.h: Include descr.h instead of internals.h. + * td_ta_event_getmsg.c: Also include . + * td_ta_map_id2thr.c: Likewise. + * td_ta_map_lwp2thr.c: Likewise. + * td_ta_thr_iter.c: Likewise. + * td_ta_tsd_iter.c: Likewise. + * td_thr_tsd.c: Likewise. + * td_thr_validate.c: Likewise. + +2001-12-28 Andreas Jaeger + + * td_init.c (td_init): Don't use __FUNCTION__ as literal. + * td_log.c (td_log): Likewise. + * td_ta_delete.c (td_ta_delete): Likewise. + * td_ta_get_nthreads.c (td_ta_get_nthreads): Likewise. + * td_ta_get_ph.c (td_ta_get_ph): Likewise. + * td_ta_map_id2thr.c (td_ta_map_id2thr): Likewise. + * td_ta_map_lwp2thr.c (td_ta_map_lwp2thr): Likewise. + * td_ta_new.c (td_ta_new): Likewise. + * td_ta_clear_event.c (td_ta_clear_event): Likewise. + * td_ta_enable_stats.c (td_ta_enable_stats): Likewise. + * td_ta_event_addr.c (td_ta_event_addr): Likewise. + * td_ta_event_getmsg.c (td_ta_event_getmsg): Likewise. + * td_ta_get_stats.c (td_ta_get_stats): Likewise. + * td_ta_reset_stats.c (td_ta_reset_stats): Likewise. + * td_ta_set_event.c (td_ta_set_event): Likewise. + * td_ta_setconcurrency.c (td_ta_setconcurrency): Likewise. + * td_ta_thr_iter.c (td_ta_thr_iter): Likewise. + * td_ta_tsd_iter.c (td_ta_tsd_iter): Likewise. + * td_thr_clear_event.c (td_thr_clear_event): Likewise. + * td_thr_dbresume.c (td_thr_dbresume): Likewise. + * td_thr_dbsuspend.c (td_thr_dbsuspend): Likewise. + * td_thr_event_enable.c (td_thr_event_enable): Likewise. + * td_thr_event_getmsg.c (td_thr_event_getmsg): Likewise. + * td_thr_get_info.c (td_thr_get_info): Likewise. + * td_thr_getfpregs.c (td_thr_getfpregs): Likewise. + * td_thr_getgregs.c (td_thr_getgregs): Likewise. + * td_thr_getxregs.c (td_thr_getxregs): Likewise. + * td_thr_getxregsize.c (td_thr_getxregsize): Likewise. + * td_thr_set_event.c (td_thr_set_event): Likewise. + * td_thr_setfpregs.c (td_thr_setfpregs): Likewise. + * td_thr_setgregs.c (td_thr_setgregs): Likewise. + * td_thr_setprio.c (td_thr_setprio): Likewise. + * td_thr_setsigpending.c (td_thr_setsigpending): Likewise. + * td_thr_setxregs.c (td_thr_setxregs): Likewise. + * td_thr_sigsetmask.c (td_thr_sigsetmask): Likewise. + * td_thr_tsd.c (td_thr_tsd): Likewise. + * td_thr_validate.c (td_thr_validate): Likewise. + +2001-04-12 Ulrich Drepper + + * td_ta_map_id2thr.c: If thread terminated return TD_NOTHR. + * td_thr_validate.c: Likewise. + +2001-04-04 Ulrich Drepper + + * td_thr_getfpregs.c: If p_pid is zero use ps_getpid(). + * td_thr_getgregs.c: Likewise. + * td_thr_setfpregs.c: Likewise. + * td_thr_setgregs.c: Likewise. + +2001-03-20 Ulrich Drepper + + * Makefile (libthread_db-routines): Add td_symbol_list. + * Versions [libthread_db] (GLIBC_2.2.3): Add td_symbol_list. + * td_symbol_list.c: New file. + * thread_db.h: Add prototype for td_symbol_list. + * thread_dbP.h: Define symbol name indices. + Add prototype for td_lookup. + * td_ta_event_addr.c: Use td_lookup instead of directly using + ps_pglobal_lookup to find symbol address. + * td_ta_get_nthreads.c: Likewise. + * td_ta_new.c: Likewise. + +2001-03-18 Ulrich Drepper + + * Makefile: When generating DSO link with libc_nonshared.a. + +2000-08-01 Andreas Jaeger + + * Makefile (distribute): Add missing files. + +2000-04-24 Mark Kettenis + + * td_thr_get_info.c (td_thr_get_info): Set ti_state to + TD_THR_ACTIVE instead of TD_THR_RUN. If the thread is no longer + running but is still joinable, set it to TD_THR_ZOMBIE. Otherwise + set it to TD_THR_UNKNOWN. + +2000-02-25 Andreas Jaeger + + * td_ta_thr_iter.c: Include for prototype declaration. + * td_ta_tsd_iter.c: Likewise. + +2000-01-20 Andreas Jaeger + + * td_thr_getgregs.c (td_thr_getgregs): Fix typo. + +2000-01-19 Ulrich Drepper + + * td_thr_getgregs.c: Correct size parameter of memset call. + +1999-12-02 Ulrich Drepper + + * proc_service.h: Fix typos in last added declaractions. + +1999-12-01 Ulrich Drepper + + * proc_service.h: Add ps_pstop, ps_pcontinue, ps_lstop, and + ps_lcontinue prototypes. + +1999-11-23 Ulrich Drepper + + * Makefile: Correct dependency for shared object. + +1999-11-22 Ulrich Drepper + + * td_ta_map_lwp2thr.c: Add missing brace in comparison. + + * thread_dbP.h (LOG): Only print message if __td_debug is nonzero. + * td_init.c: Add __td_debug. + +1999-11-12 Ulrich Drepper + + * td_ta_thr_iter.c: Start copying list of descriptors from right + position in target process. + + * td_ta_thr_iter.c: Fix loop starting point over all but main and + manager thread. + + * td_ta_thr_iter.c: Read descriptors for main and manager thread + special since after this we can assume that no new threads will be + created anymore (at least in the gdb implementation). + + * Makefile: Define version correctly. + +1999-11-10 Ulrich Drepper + + * td_ta_map_lwp2thr.c: If p_pid field is zero, this is before the + thread library is initialized and we get the PID from the + debugger. + +1999-11-08 Ulrich Drepper + + * td_thr_get_info.c: Make sure ti_lid is never zero. + + * proc_service.h: Add ps_getpid prototype. + +1999-11-03 Ulrich Drepper + + * thread_dbP.h (ta_ok): New function. + * td_ta_new.c: Add new handle to list. + * td_ta_delete.c: Remove handle from list. + * td_ta_clear_event.c: Use ta_ok to check for correct ta parameter. + * td_ta_enable_stats.c: Likewise. + * td_ta_event_addr.c: Likewise. + * td_ta_event_getmsg.c: Likewise. + * td_ta_get_nthreads.c: Likewise. + * td_ta_get_ph.c: Likewise. + * td_ta_get_stats.c: Likewise. + * td_ta_map_id2thr.c: Likewise. + * td_ta_map_lwp2thr.c: Likewise. + * td_ta_reset_stats.c: Likewise. + * td_ta_set_event.c: Likewise. + * td_ta_setconcurrency.c: Likewise. + * td_ta_thr_iter.c: Likewise. + + * td_ta_tsd_iter.c: Optimize memory retrieving. + + * Versions: New file. + + * td_thr_get_info.c (td_thr_get_info): Initialize ti_traceme. + +1999-11-02 Ulrich Drepper + + * td_ta_thr_iter.c (td_ta_thr_iter): Optimize a bit. Read all + handles at once. + + * thread_dbP.h (struct th_thragent): Add pthread_handle_num. + * td_ta_new.c: Initialize pthread_handle_num. + * td_ta_event_getmsg.c: If last event was already reported search + for another unreported event. + + * td_thr_get_info.c (td_thr_get_info): Initialize ti_events. + + * Makefile (libthread_db-routines): Add td_ta_set_event, + td_ta_event_getmsg, and td_ta_clear_event. + * td_ta_clear_event.c: New file. + * td_ta_event_getmsg.c: New file. + * td_ta_new.c: Get address of __pthread_last_event in target. + * td_ta_set_event.c: Don't overwrite old mask, set additional bits. + * td_thr_set_event.c: Likewise. + * td_thr_clear_event.c: Implement. + * thread_db.h: Declare td_ta_clear_event and td_ta_event_getmsg. + * thread_dbP.h (struct td_thragent): Add pthread_last_event. + + * td_ta_new.c: Don't test for __pthread_threads_debug. Get address + of __pthread_threads_events and fail if this is not possible. + * td_ta_event_addr.c: Implement. + * td_thr_event_enable.c: Implement. + * td_thr_event_getmsg.c: Implement. + * td_thr_set_event.c: Implement. + * td_ta_set_event.c: New file. + * thread_db.h (td_eventbuf_t): Define. + Declare td_ta_set_event. + * thread_dbP.h (struct td_thragent): Add pthread_threads_eventsp. + + * td_thr_getfpregs.c: For terminated threads return empty structure. + * td_thr_getgregs.c: Likewise. + * td_thr_setfpregs.c: Likewise. + * td_thr_setgregs.c: Likewise. + +1999-11-01 Ulrich Drepper + + * thread_db.h: Shuffle types around to make things work for gdb. + * thread_dbP.h: Include proc_service.h before thread_db.h. + + * thread_db.h: It's TD_NOLIBTHREAD, not TD_LIBTHREAD. + * td_ta_new.c: Likewise. + +1999-10-14 Ulrich Drepper + + * td_ta_new.c: p_startfct does not exist anymore. + + * td_thr_get_info.c: Always initialize start function. + + * td_ta_thr_iter.c: Don't return threads which exited (but are not + joined). + + * td_thr_validate.c: Don't skip manager thread. + +1999-10-13 Ulrich Drepper + + * td_ta_thr_iter.c: Use size of descriptor from *TA. + Don't return manager thread before it's actually running. + Actually use state parameter to distingusih at least a few states. + + * td_thr_get_info.c: Handle manager thread special. Fill in ti_lid, + ti_state, and ti_startfunc fields. + +1999-10-12 Andreas Jaeger + + * thread_dbP.h: Include for strlen declaration. Remove + __libc_write prototype since this is already declared in + linuxthreads/internals.h. + +1999-10-11 Ulrich Drepper + + * thread_db.h: Fix comment for ti_type. + + * td_thr_get_info.c: Initialize ti_type field. + + * td_ta_thr_iter.c: Also report the manager thread. + +1999-10-08 Andreas Jaeger + + * thread_db.h: Fix typos in comments. + + * td_ta_get_nthreads.c (td_ta_get_nthreads): Don't hardcode + libpthread library name, get it from instead. + * td_ta_new.c (td_ta_new): Likewise. + +1999-10-08 Ulrich Drepper + + * shlib-versions: New file. + +1999-10-07 Ulrich Drepper + + * Makefile: New file. + * proc_service.h: New file. + * td_init.c: New file. + * td_log.c: New file. + * td_ta_delete.c: New file. + * td_ta_enable_stats.c: New file. + * td_ta_event_addr.c: New file. + * td_ta_get_nthreads.c: New file. + * td_ta_get_ph.c: New file. + * td_ta_get_stats.c: New file. + * td_ta_map_id2thr.c: New file. + * td_ta_map_lwp2thr.c: New file. + * td_ta_new.c: New file. + * td_ta_reset_stats.c: New file. + * td_ta_setconcurrency.c: New file. + * td_ta_thr_iter.c: New file. + * td_ta_tsd_iter.c: New file. + * td_thr_clear_event.c: New file. + * td_thr_dbresume.c: New file. + * td_thr_dbsuspend.c: New file. + * td_thr_event_enable.c: New file. + * td_thr_event_getmsg.c: New file. + * td_thr_get_info.c: New file. + * td_thr_getfpregs.c: New file. + * td_thr_getgregs.c: New file. + * td_thr_getxregs.c: New file. + * td_thr_getxregsize.c: New file. + * td_thr_set_event.c: New file. + * td_thr_setfpregs.c: New file. + * td_thr_setgregs.c: New file. + * td_thr_setprio.c: New file. + * td_thr_setsigpending.c: New file. + * td_thr_setxregs.c: New file. + * td_thr_sigsetmask.c: New file. + * td_thr_tsd.c: New file. + * td_thr_validate.c: New file. + * thread_db.h: New file. + * thread_dbP.h: New file. diff --git a/libpthread/linuxthreads_db/Makefile b/libpthread/linuxthreads_db/Makefile new file mode 100644 index 000000000..f92f205a5 --- /dev/null +++ b/libpthread/linuxthreads_db/Makefile @@ -0,0 +1,15 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +TOPDIR=../../ + +top_srcdir=$(TOPDIR) +top_builddir=../../ +include $(top_builddir)Rules.mak +all: libs +include Makefile.in +include $(top_srcdir)Makerules diff --git a/libpthread/linuxthreads_db/Makefile.in b/libpthread/linuxthreads_db/Makefile.in new file mode 100644 index 000000000..ad2401c02 --- /dev/null +++ b/libpthread/linuxthreads_db/Makefile.in @@ -0,0 +1,61 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +# Get the thread include dependencies and shared object name +CFLAGS-linuxthreads_db := -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\"" +CFLAGS-linuxthreads_db += -I$(top_srcdir)libpthread -D_GNU_SOURCE + +LDFLAGS-libthread_db.so := $(LDFLAGS_NOSTRIP) -s --warn-unresolved-symbols + +LIBS-libthread_db.so := $(LIBS) + +libthread_db_FULL_NAME := libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +libthread_db_DIR := $(top_srcdir)libpthread/linuxthreads_db +libthread_db_OUT := $(top_builddir)libpthread/linuxthreads_db + +libthread_db_SRC := $(wildcard $(libthread_db_DIR)/*.c) + +libthread_db_OBJ := $(patsubst $(libthread_db_DIR)/%.c,$(libthread_db_OUT)/%.o,$(libthread_db_SRC)) + +libthread_db-a-y := $(libthread_db_OBJ) +libthread_db-so-y := $(libthread_db_OBJ:.o=.os) + +libthread_db-multi-y := $(libthread_db_SRC) + +lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a +lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so +objclean-y += libthread_db_clean +headers-$(PTHREADS_DEBUG_SUPPORT) += linuxthreads_db_headers +headers_clean-y += linuxthreads_db_headers_clean + +$(top_builddir)lib/libthread_db.so: $(libthread_db_OUT)/libthread_db_so.a libc-y + $(call link.so,$(libthread_db_FULL_NAME),1) + +$(libthread_db_OUT)/libthread_db_so.a: $(libthread_db-so-y) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +ifeq ($(DOPIC),y) +$(top_builddir)lib/libthread_db.a: $(libthread_db-a-y:.o=.os) +else +$(top_builddir)lib/libthread_db.a: $(libthread_db-a-y) +endif + $(Q)$(INSTALL) -d $(dir $@) + $(Q)$(RM) $@ + $(do_strip) + $(do_ar) + +linuxthreads_db_headers: + $(LN) -sf ../$(PTDIR)_db/thread_db.h $(top_builddir)include/ + +linuxthreads_db_headers_clean: + $(RM) $(top_builddir)include/thread_db.h + +libthread_db_clean: + $(RM) $(libthread_db_OUT)/*.{o,os,a} diff --git a/libpthread/linuxthreads_db/Makefile.old b/libpthread/linuxthreads_db/Makefile.old new file mode 100644 index 000000000..53e46f775 --- /dev/null +++ b/libpthread/linuxthreads_db/Makefile.old @@ -0,0 +1,57 @@ +# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +# Makefile for linuxthreads debug library subdirectory of GNU C Library. + +subdir := linuxthreads_db + +linuxthreads_db-version = 1.0 + +extra-libs = libthread_db +extra-libs-others := $(extra-libs) + +headers = thread_db.h +libthread_db-routines = td_init td_log td_ta_delete td_ta_get_nthreads \ + td_ta_get_ph td_ta_map_id2thr td_ta_map_lwp2thr \ + td_ta_new td_ta_thr_iter td_ta_tsd_iter \ + td_thr_get_info td_thr_getfpregs td_thr_getgregs \ + td_thr_getxregs td_thr_getxregsize td_thr_setfpregs \ + td_thr_setgregs td_thr_setprio td_thr_setsigpending \ + td_thr_setxregs td_thr_sigsetmask td_thr_tsd \ + td_thr_validate td_thr_dbsuspend td_thr_dbresume \ + td_ta_setconcurrency td_ta_enable_stats \ + td_ta_reset_stats td_ta_get_stats td_ta_event_addr \ + td_thr_event_enable td_thr_set_event \ + td_thr_clear_event td_thr_event_getmsg \ + td_ta_set_event td_ta_event_getmsg \ + td_ta_clear_event td_symbol_list \ + td_thr_tlsbase td_thr_tls_get_addr + +libthread_db-inhibit-o = $(filter-out .os,$(object-suffixes)) + +# The ps_* callback functions are not defined. +libthread_db.so-no-z-defs = yes + +distribute = thread_dbP.h shlib-versions proc_service.h +include ../Rules + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(objpfx)libthread_db.so: $(common-objpfx)libc.so \ + $(common-objpfx)libc_nonshared.a diff --git a/libpthread/linuxthreads_db/Versions b/libpthread/linuxthreads_db/Versions new file mode 100644 index 000000000..063493c67 --- /dev/null +++ b/libpthread/linuxthreads_db/Versions @@ -0,0 +1,24 @@ +libthread_db { + GLIBC_2.1.3 { + # t* + td_init; td_log; td_ta_clear_event; td_ta_delete; td_ta_enable_stats; + td_ta_event_addr; td_ta_event_getmsg; td_ta_get_nthreads; td_ta_get_ph; + td_ta_get_stats; td_ta_map_id2thr; td_ta_map_lwp2thr; td_ta_new; + td_ta_reset_stats; td_ta_set_event; td_ta_setconcurrency; + td_ta_thr_iter; td_ta_tsd_iter; td_thr_clear_event; td_thr_dbresume; + td_thr_dbsuspend; td_thr_event_enable; td_thr_event_getmsg; + td_thr_get_info; td_thr_getfpregs; td_thr_getgregs; td_thr_getxregs; + td_thr_getxregsize; td_thr_set_event; td_thr_setfpregs; td_thr_setgregs; + td_thr_setprio; td_thr_setsigpending; td_thr_setxregs; td_thr_sigsetmask; + td_thr_tsd; td_thr_validate; + } + GLIBC_2.2.3 { + td_symbol_list; + } + GLIBC_2.3 { + td_thr_tls_get_addr; + } + GLIBC_2.3.3 { + td_thr_tlsbase; + } +} diff --git a/libpthread/linuxthreads_db/libthread_db_so.a b/libpthread/linuxthreads_db/libthread_db_so.a new file mode 100644 index 000000000..026a77d5e Binary files /dev/null and b/libpthread/linuxthreads_db/libthread_db_so.a differ diff --git a/libpthread/linuxthreads_db/proc_service.h b/libpthread/linuxthreads_db/proc_service.h new file mode 100644 index 000000000..74136c03e --- /dev/null +++ b/libpthread/linuxthreads_db/proc_service.h @@ -0,0 +1,70 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* The definitions in this file must correspond to those in the debugger. */ +#include + +typedef enum +{ + PS_OK, /* generic "call succeeded" */ + PS_ERR, /* generic. */ + PS_BADPID, /* bad process handle */ + PS_BADLID, /* bad lwp identifier */ + PS_BADADDR, /* bad address */ + PS_NOSYM, /* p_lookup() could not find given symbol */ + PS_NOFREGS + /* + * FPU register set not available for given + * lwp + */ +} ps_err_e; + + +struct ps_prochandle; /* user defined. */ + + +extern ps_err_e ps_pdread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_pdwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); +extern ps_err_e ps_ptread(struct ps_prochandle *, + psaddr_t, void *, size_t); +extern ps_err_e ps_ptwrite(struct ps_prochandle *, + psaddr_t, const void *, size_t); + +extern ps_err_e ps_pglobal_lookup(struct ps_prochandle *, + const char *object_name, const char *sym_name, psaddr_t *sym_addr); + + +extern ps_err_e ps_lgetregs(struct ps_prochandle *, + lwpid_t, prgregset_t); +extern ps_err_e ps_lsetregs(struct ps_prochandle *, + lwpid_t, const prgregset_t); +extern ps_err_e ps_lgetfpregs(struct ps_prochandle *, + lwpid_t, prfpregset_t *); +extern ps_err_e ps_lsetfpregs(struct ps_prochandle *, + lwpid_t, const prfpregset_t *); + +extern pid_t ps_getpid (struct ps_prochandle *); + + +extern ps_err_e ps_pstop (const struct ps_prochandle *); +extern ps_err_e ps_pcontinue (const struct ps_prochandle *); + +extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t); +extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t); diff --git a/libpthread/linuxthreads_db/shlib-versions b/libpthread/linuxthreads_db/shlib-versions new file mode 100644 index 000000000..592f7fa28 --- /dev/null +++ b/libpthread/linuxthreads_db/shlib-versions @@ -0,0 +1,2 @@ +# The thread debug library +.*-.*-linux.* libthread_db=1 diff --git a/libpthread/linuxthreads_db/td_init.c b/libpthread/linuxthreads_db/td_init.c new file mode 100644 index 000000000..d714f1ba0 --- /dev/null +++ b/libpthread/linuxthreads_db/td_init.c @@ -0,0 +1,32 @@ +/* Initialization function of thread debugger support library. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + +int __td_debug; + + +td_err_e +td_init (void) +{ + /* XXX We have to figure out what has to be done. */ + LOG ("td_init"); + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_log.c b/libpthread/linuxthreads_db/td_log.c new file mode 100644 index 000000000..025273a63 --- /dev/null +++ b/libpthread/linuxthreads_db/td_log.c @@ -0,0 +1,32 @@ +/* Noop, left for historical reasons. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_log (void) +{ + /* This interface is deprecated in the Sun interface. We provide it + for compatibility but don't do anything ourself. We might in + future do some logging if this seems reasonable. */ + LOG ("td_log"); + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_symbol_list.c b/libpthread/linuxthreads_db/td_symbol_list.c new file mode 100644 index 000000000..599c04596 --- /dev/null +++ b/libpthread/linuxthreads_db/td_symbol_list.c @@ -0,0 +1,61 @@ +/* Return list of symbols the library can request. + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include "thread_dbP.h" + +#ifdef HAVE_ASM_GLOBAL_DOT_NAME +# define DOT "." /* PPC64 requires . prefix on code symbols. */ +#else +# define DOT /* No prefix. */ +#endif + +static const char *symbol_list_arr[] = +{ + [PTHREAD_THREADS_EVENTS] = "__pthread_threads_events", + [PTHREAD_LAST_EVENT] = "__pthread_last_event", + [PTHREAD_HANDLES_NUM] = "__pthread_handles_num", + [PTHREAD_HANDLES] = "__pthread_handles", + [PTHREAD_KEYS] = "pthread_keys", + [LINUXTHREADS_PTHREAD_THREADS_MAX] = "__linuxthreads_pthread_threads_max", + [LINUXTHREADS_PTHREAD_KEYS_MAX] = "__linuxthreads_pthread_keys_max", + [LINUXTHREADS_PTHREAD_SIZEOF_DESCR] = "__linuxthreads_pthread_sizeof_descr", + [LINUXTHREADS_CREATE_EVENT] = DOT "__linuxthreads_create_event", + [LINUXTHREADS_DEATH_EVENT] = DOT "__linuxthreads_death_event", + [LINUXTHREADS_REAP_EVENT] = DOT "__linuxthreads_reap_event", + [LINUXTHREADS_INITIAL_REPORT_EVENTS] = "__linuxthreads_initial_report_events", + [LINUXTHREADS_VERSION] = "__linuxthreads_version", + [NUM_MESSAGES] = NULL +}; + + +const char ** +td_symbol_list (void) +{ + return symbol_list_arr; +} + + +int +td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr) +{ + assert (idx >= 0 && idx < NUM_MESSAGES); + return ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx], sym_addr); +} diff --git a/libpthread/linuxthreads_db/td_ta_clear_event.c b/libpthread/linuxthreads_db/td_ta_clear_event.c new file mode 100644 index 000000000..cbb7ddc97 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_clear_event.c @@ -0,0 +1,53 @@ +/* Globally disable events. + Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_clear_event (ta, event) + const td_thragent_t *ta; + td_thr_events_t *event; +{ + td_thr_events_t old_event; + int i; + + LOG ("td_ta_clear_event"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Write the new value into the thread data structure. */ + if (ps_pdread (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thr_events_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Remove the set bits in. */ + for (i = 0; i < TD_EVENTSIZE; ++i) + old_event.event_bits[i] &= ~event->event_bits[i]; + + /* Write the new value into the thread data structure. */ + if (ps_pdwrite (ta->ph, ta->pthread_threads_eventsp, + &old_event, sizeof (td_thr_events_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_delete.c b/libpthread/linuxthreads_db/td_ta_delete.c new file mode 100644 index 000000000..0e6ec17d0 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_delete.c @@ -0,0 +1,58 @@ +/* Detach to target process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#include "thread_dbP.h" + + +td_err_e +td_ta_delete (td_thragent_t *ta) +{ + LOG ("td_ta_delete"); + + /* Safety check. */ + if (ta == NULL || __td_agent_list == NULL) + return TD_BADTA; + + /* Remove the handle from the list. */ + if (ta == __td_agent_list->ta) + /* It's the first element of the list. */ + __td_agent_list = __td_agent_list->next; + else + { + /* We have to search for it. */ + struct agent_list *runp = __td_agent_list; + + while (runp->next != NULL && runp->next->ta != ta) + runp = runp->next; + + if (runp->next == NULL) + /* It's not a valid decriptor since it is not in the list. */ + return TD_BADTA; + + runp->next = runp->next->next; + } + + /* The handle was allocated in `td_ta_new'. */ + free (ta); + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_enable_stats.c b/libpthread/linuxthreads_db/td_ta_enable_stats.c new file mode 100644 index 000000000..1d4c34a8d --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_enable_stats.c @@ -0,0 +1,35 @@ +/* Enable collection of statistics for process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_enable_stats (const td_thragent_t *ta, int enable) +{ + /* XXX We have to figure out what has to be done. */ + LOG ("td_ta_enable_stats"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_event_addr.c b/libpthread/linuxthreads_db/td_ta_event_addr.c new file mode 100644 index 000000000..8bce35ae8 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_event_addr.c @@ -0,0 +1,73 @@ +/* Get event address. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_event_addr (const td_thragent_t *ta, td_event_e event, td_notify_t *addr) +{ + td_err_e res = TD_NOEVENT; + int idx = -1; + + LOG ("td_ta_event_addr"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + switch (event) + { + case TD_CREATE: + idx = LINUXTHREADS_CREATE_EVENT; + break; + + case TD_DEATH: + idx = LINUXTHREADS_DEATH_EVENT; + break; + + case TD_REAP: + idx = LINUXTHREADS_REAP_EVENT; + break; + + default: + /* Event cannot be handled. */ + break; + } + + /* Now get the address. */ + if (idx != -1) + { + psaddr_t taddr; + + if (td_lookup (ta->ph, idx, &taddr) == PS_OK) + { + /* Success, we got the address. */ + addr->type = NOTIFY_BPT; + addr->u.bptaddr = taddr; + + res = TD_OK; + } + else + res = TD_ERR; + } + + return res; +} diff --git a/libpthread/linuxthreads_db/td_ta_event_getmsg.c b/libpthread/linuxthreads_db/td_ta_event_getmsg.c new file mode 100644 index 000000000..c3a4492a1 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_event_getmsg.c @@ -0,0 +1,129 @@ +/* Retrieve event. + Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#include "thread_dbP.h" +#include + + +td_err_e +td_ta_event_getmsg (const td_thragent_t *ta, td_event_msg_t *msg) +{ + /* XXX I cannot think of another way but using a static variable. */ + static td_thrhandle_t th; + td_eventbuf_t event; + psaddr_t addr; + + LOG ("td_ta_event_getmsg"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Get the pointer to the thread descriptor with the last event. */ + if (ps_pdread (ta->ph, ta->pthread_last_event, + &addr, sizeof (void *)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* If the pointer is NULL no event occurred. */ + if (addr == 0) + return TD_NOMSG; + + /* Read the even structure from the target. */ + if (ps_pdread (ta->ph, + ((char *) addr + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Check whether an event occurred. */ + if (event.eventnum == TD_EVENT_NONE) + { + /* Oh well, this means the last event was already read. So + we have to look for any other event. */ + struct pthread_handle_struct handles[ta->pthread_threads_max]; + int num; + int i; + + /* Read the number of currently active threads. */ + if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) + != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Now read the handles. */ + if (ps_pdread (ta->ph, ta->handles, handles, + ta->pthread_threads_max * sizeof (handles[0])) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + for (i = 0; i < ta->pthread_threads_max && num > 0; ++i) + { + if (handles[i].h_descr == NULL) + /* No entry here. */ + continue; + + /* First count this active thread. */ + --num; + + if (handles[i].h_descr == addr) + /* We already handled this. */ + continue; + + /* Read the event data for this thread. */ + if (ps_pdread (ta->ph, + ((char *) handles[i].h_descr + + offsetof (struct _pthread_descr_struct, + p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; + + if (event.eventnum != TD_EVENT_NONE) + { + /* We found a thread with an unreported event. */ + addr = handles[i].h_descr; + break; + } + } + + /* If we haven't found any other event signal this to the user. */ + if (event.eventnum == TD_EVENT_NONE) + return TD_NOMSG; + } + + /* Generate the thread descriptor. */ + th.th_ta_p = (td_thragent_t *) ta; + th.th_unique = addr; + + /* Fill the user's data structure. */ + msg->event = event.eventnum; + msg->th_p = &th; + msg->msg.data = (uintptr_t) event.eventdata; + + /* And clear the event message in the target. */ + memset (&event, '\0', sizeof (td_eventbuf_t)); + if (ps_pdwrite (ta->ph, + ((char *) addr + + offsetof (struct _pthread_descr_struct, p_eventbuf)), + &event, sizeof (td_eventbuf_t)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_get_nthreads.c b/libpthread/linuxthreads_db/td_ta_get_nthreads.c new file mode 100644 index 000000000..839b56be5 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_get_nthreads.c @@ -0,0 +1,42 @@ +/* Get the number of threads in the process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + +td_err_e +td_ta_get_nthreads (const td_thragent_t *ta, int *np) +{ + psaddr_t addr; + + LOG ("td_ta_get_nthreads"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Access the variable `__pthread_handles_num'. */ + if (td_lookup (ta->ph, PTHREAD_HANDLES_NUM, &addr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if (ps_pdread (ta->ph, addr, np, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_get_ph.c b/libpthread/linuxthreads_db/td_ta_get_ph.c new file mode 100644 index 000000000..23d328508 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_get_ph.c @@ -0,0 +1,36 @@ +/* Get external process handle. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_get_ph (const td_thragent_t *ta, struct ps_prochandle **ph) +{ + LOG ("td_ta_get_ph"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + *ph = ta->ph; + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_get_stats.c b/libpthread/linuxthreads_db/td_ta_get_stats.c new file mode 100644 index 000000000..6bf2f5352 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_get_stats.c @@ -0,0 +1,35 @@ +/* Retrieve statistics for process. + Copyright (C) 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" + + +td_err_e +td_ta_get_stats (const td_thragent_t *ta, td_ta_stats_t *statsp) +{ + /* XXX We have to figure out what has to be done. */ + LOG ("td_ta_get_stats"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_map_id2thr.c b/libpthread/linuxthreads_db/td_ta_map_id2thr.c new file mode 100644 index 000000000..ddeb2d3c4 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_map_id2thr.c @@ -0,0 +1,79 @@ +/* Map thread ID to thread handle. + Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" +#include + + +td_err_e +td_ta_map_id2thr (const td_thragent_t *ta, pthread_t pt, td_thrhandle_t *th) +{ + struct pthread_handle_struct phc; + struct _pthread_descr_struct pds; + int pthread_threads_max; + + LOG ("td_ta_map_id2thr"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Make the following expression a bit smaller. */ + pthread_threads_max = ta->pthread_threads_max; + + /* We can compute the entry in the handle array we want. */ + if (ps_pdread (ta->ph, ta->handles + pt % pthread_threads_max, &phc, + sizeof (struct pthread_handle_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + /* Test whether this entry is in use. */ + if (phc.h_descr == NULL) + { + if (pt % pthread_threads_max == 0) + { + /* The initial thread always exists but the thread library + might not yet be initialized. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = NULL; + + return TD_OK; + } + + return TD_BADTH; + } + + /* Next test: get the descriptor to see whether this is not an old + thread handle. */ + if (ps_pdread (ta->ph, phc.h_descr, &pds, + sizeof (struct _pthread_descr_struct)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if (pds.p_tid != pt) + return TD_BADTH; + + if (pds.p_terminated != 0) + return TD_NOTHR; + + /* Create the `td_thrhandle_t' object. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = phc.h_descr; + + return TD_OK; +} diff --git a/libpthread/linuxthreads_db/td_ta_map_lwp2thr.c b/libpthread/linuxthreads_db/td_ta_map_lwp2thr.c new file mode 100644 index 000000000..dd2fcbfe4 --- /dev/null +++ b/libpthread/linuxthreads_db/td_ta_map_lwp2thr.c @@ -0,0 +1,91 @@ +/* Which thread is running on an lwp? + Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1999. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "thread_dbP.h" +#include + + +td_err_e +td_ta_map_lwp2thr (const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th) +{ + int pthread_threads_max = ta->pthread_threads_max; + size_t sizeof_descr = ta->sizeof_descr; + struct pthread_handle_struct phc[pthread_threads_max]; + size_t cnt; +#ifdef ALL_THREADS_STOPPED + int num; +#else +# define num 1 +#endif + + LOG ("td_ta_map_lwp2thr"); + + /* Test whether the TA parameter is ok. */ + if (! ta_ok (ta)) + return TD_BADTA; + + /* Read all the descriptors. */ + if (ps_pdread (ta->ph, ta->handles, phc, + sizeof (struct pthread_handle_struct) * pthread_threads_max) + != PS_OK) + return TD_ERR; /* XXX Other error value? */ + +#ifdef ALL_THREADS_STOPPED + /* Read the number of currently active threads. */ + if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) != PS_OK) + return TD_ERR; /* XXX Other error value? */ +#endif + + /* Get the entries one after the other and find out whether the ID + matches. */ + for (cnt = 0; cnt < pthread_threads_max && num > 0; ++cnt) + if (phc[cnt].h_descr != NULL) + { + struct _pthread_descr_struct pds; + +#ifdef ALL_THREADS_STOPPED + /* First count this active thread. */ + --num; +#endif + + if (ps_pdread (ta->ph, phc[cnt].h_descr, &pds, sizeof_descr) != PS_OK) + return TD_ERR; /* XXX Other error value? */ + + if ((pds.p_pid ?: ps_getpid (ta->ph)) == lwpid) + { + /* Found it. Now fill in the `td_thrhandle_t' object. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = phc[cnt].h_descr; + + return TD_OK; + } + } + else if (cnt == 0) + { + /* The initial thread always exists. But it might not yet be + initialized. Construct a value. */ + th->th_ta_p = (td_thragent_t *) ta; + th->th_unique = NULL; + + return TD_OK; + } + + return TD_NOLWP; +} diff --git a/libpthread/linuxthreads_db/td_ta_new.c b/libpthread/linuxthreads_db/td_ta_new.c new file mode 1006