From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2880 invoked by alias); 17 Sep 2005 23:12:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2847 invoked by uid 22791); 17 Sep 2005 23:12:03 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 17 Sep 2005 23:12:03 +0000 Received: from drow by nevyn.them.org with local (Exim 4.52) id 1EGlqj-0007Ir-Bs; Sat, 17 Sep 2005 19:12:01 -0400 Date: Sat, 17 Sep 2005 23:12:00 -0000 From: Daniel Jacobowitz To: SZOKOVACS Robert Cc: gdb-patches@sources.redhat.com Subject: Re: meaningful error message in gdbserver Message-ID: <20050917231201.GN8777@nevyn.them.org> Mail-Followup-To: SZOKOVACS Robert , gdb-patches@sources.redhat.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-SW-Source: 2005-09/txt/msg00137.txt.bz2 On Wed, Aug 31, 2005 at 07:30:05PM +0200, SZOKOVACS Robert wrote: > Hi, > > I had a long day fighting with remote debugging, until I found out that my > libpthread and libthread_db versions didn't match. So I created the patch > below that makes gdbserver more verbose when failing, maybe it can save > some time for somebody in the future. Thanks for the suggestion. I've checked in this instead - a bit more thorough. [As an aside, I don't know how I've managed to fix this bit of aclocal.m4 so many times without realizing I'd scrogged the braces.] -- Daniel Jacobowitz CodeSourcery, LLC 2005-09-17 Daniel Jacobowitz * acinclude.m4: Correct quoting. * aclocal.m4: Regenerated. Suggested by SZOKOVACS Robert : * thread-db.c (thread_db_err_str): Handle TD_VERSION. (thread_db_init): Call thread_db_err_str. * configure.ac: Check for TD_VERSION. * config.in, configure: Regenerated. Index: acinclude.m4 =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/acinclude.m4,v retrieving revision 1.3 diff -u -p -r1.3 acinclude.m4 --- acinclude.m4 24 Feb 2005 20:26:32 -0000 1.3 +++ acinclude.m4 17 Sep 2005 23:08:56 -0000 @@ -38,6 +38,6 @@ AC_DEFUN([SRV_CHECK_THREAD_DB], [td_ta_new();], [srv_cv_thread_db="$thread_db"], [srv_cv_thread_db=no]) - ]]) + ]) LIBS="$old_LIBS" -)]) +])]) Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v retrieving revision 1.6 diff -u -p -r1.6 configure.ac --- configure.ac 13 Jul 2005 15:21:02 -0000 1.6 +++ configure.ac 17 Sep 2005 23:08:57 -0000 @@ -142,6 +142,13 @@ fi if test "$srv_linux_thread_db" = "yes"; then srv_thread_depfiles="thread-db.o proc-service.o" USE_THREAD_DB="-DUSE_THREAD_DB" + AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version, + [AC_TRY_COMPILE([#include ], [TD_VERSION;], + [gdbsrv_cv_have_td_version=yes], + [gdbsrv_cv_have_td_version=no])]) + if test $gdbsrv_cv_have_td_version = yes; then + AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.]) + fi fi GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" Index: thread-db.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/thread-db.c,v retrieving revision 1.2 diff -u -p -r1.2 thread-db.c --- thread-db.c 16 Oct 2004 17:42:00 -0000 1.2 +++ thread-db.c 17 Sep 2005 23:08:57 -0000 @@ -103,6 +103,10 @@ thread_db_err_str (td_err_e err) return "only part of register set was written/read"; case TD_NOXREGS: return "X register set not available for this thread"; +#ifdef HAVE_TD_VERSION + case TD_VERSION: + return "version mismatch between libthread_db and libpthread"; +#endif default: snprintf (buf, sizeof (buf), "unknown thread_db error '%d'", err); return buf; @@ -361,7 +365,8 @@ thread_db_init () return 1; default: - warning ("error initializing thread_db library."); + warning ("error initializing thread_db library: %s", + thread_db_err_str (err)); } return 0;