From 069125e53a03f46341754a9458d9ff9d0d119241 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 24 Aug 2002 03:35:35 +0000 Subject: [PATCH] Update. 2002-08-23 Ulrich Drepper * pthread.c (__linuxthreads_version): New global constant. --- linuxthreads/ChangeLog | 4 ++++ linuxthreads/pthread.c | 3 +++ linuxthreads_db/ChangeLog | 8 ++++++++ linuxthreads_db/td_symbol_list.c | 1 + linuxthreads_db/td_ta_new.c | 17 ++++++++++++++++- linuxthreads_db/thread_db.h | 3 ++- linuxthreads_db/thread_dbP.h | 1 + 7 files changed, 35 insertions(+), 2 deletions(-) diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 728eaf8..814dba0 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +2002-08-23 Ulrich Drepper + + * pthread.c (__linuxthreads_version): New global constant. + 2002-08-23 Andreas Jaeger * sysdeps/x86_64/pt-machine.h: Use %fs instead of %gs diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index b0ef7fb..1848bfb 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -33,6 +33,7 @@ #include #include #include /* for __uselocale */ +#include /* Sanity check. */ #if __ASSUME_REALTIME_SIGNALS && !defined __SIGRTMIN @@ -238,6 +239,8 @@ const int __linuxthreads_pthread_sizeof_descr const int __linuxthreads_initial_report_events; +const char __linuxthreads_version[] = VERSION; + /* Forward declarations */ static void pthread_onexit_process(int retcode, void *arg); diff --git a/linuxthreads_db/ChangeLog b/linuxthreads_db/ChangeLog index f8028b4..a869c3c 100644 --- a/linuxthreads_db/ChangeLog +++ b/linuxthreads_db/ChangeLog @@ -1,3 +1,11 @@ +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__ -> diff --git a/linuxthreads_db/td_symbol_list.c b/linuxthreads_db/td_symbol_list.c index 8132618..2e8edec 100644 --- a/linuxthreads_db/td_symbol_list.c +++ b/linuxthreads_db/td_symbol_list.c @@ -37,6 +37,7 @@ static const char *symbol_list_arr[] = [LINUXTHREADS_DEATH_EVENT] = "__linuxthreads_death_event", [LINUXTHREADS_REAP_EVENT] = "__linuxthreads_reap_event", [LINUXTHREADS_INITIAL_REPORT_EVENTS] = "__linuxthreads_initial_report_events", + [LINUXTHREADS_VERSION] = "__linuxthreads_version", [NUM_MESSAGES] = NULL }; diff --git a/linuxthreads_db/td_ta_new.c b/linuxthreads_db/td_ta_new.c index 7505f53..50ddf0a 100644 --- a/linuxthreads_db/td_ta_new.c +++ b/linuxthreads_db/td_ta_new.c @@ -1,5 +1,5 @@ /* Attach to target process. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1999. @@ -20,6 +20,8 @@ #include #include +#include +#include #include "thread_dbP.h" @@ -33,6 +35,8 @@ td_err_e td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta) { psaddr_t addr; + psaddr_t versaddr; + char versbuf[sizeof (VERSION)]; struct agent_list *elemp; LOG ("td_ta_new"); @@ -43,6 +47,17 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta) if (td_lookup (ps, PTHREAD_THREADS_EVENTS, &addr) != PS_OK) return TD_NOLIBTHREAD; + /* Check whether the versions match. */ + if (td_lookup (ps, LINUXTHREADS_VERSION, &versaddr) != PS_OK) + return TD_VERSION; + if (ps_pdread (ps, versaddr, versbuf, sizeof (versbuf)) != PS_OK) + return TD_ERR; + + versbuf[sizeof (versbuf) - 1] = '\0'; + if (strcmp (versbuf, VERSION) != 0) + /* Not the right version. */ + return TD_VERSION; + /* Fill in the appropriate information. */ *ta = (td_thragent_t *) malloc (sizeof (td_thragent_t)); if (*ta == NULL) diff --git a/linuxthreads_db/thread_db.h b/linuxthreads_db/thread_db.h index 65cdb84..906f48c 100644 --- a/linuxthreads_db/thread_db.h +++ b/linuxthreads_db/thread_db.h @@ -52,7 +52,8 @@ typedef enum TD_MALLOC, /* Out of memory. */ TD_PARTIALREG, /* Not entire register set was read or written. */ TD_NOXREGS, /* X register set not available for given thread. */ - TD_NOTALLOC /* TLS memory not yet allocated. */ + TD_NOTALLOC, /* TLS memory not yet allocated. */ + TD_VERSION /* Version if libpthread and libthread_db do not match. */ } td_err_e; diff --git a/linuxthreads_db/thread_dbP.h b/linuxthreads_db/thread_dbP.h index 85222ab..8e0a78a 100644 --- a/linuxthreads_db/thread_dbP.h +++ b/linuxthreads_db/thread_dbP.h @@ -24,6 +24,7 @@ enum LINUXTHREADS_DEATH_EVENT, LINUXTHREADS_REAP_EVENT, LINUXTHREADS_INITIAL_REPORT_EVENTS, + LINUXTHREADS_VERSION, NUM_MESSAGES }; -- 2.7.4