This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: meaningful error message in gdbserver
- From: Daniel Jacobowitz <drow at false dot org>
- To: SZOKOVACS Robert <szo at ies dot hu>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 17 Sep 2005 19:12:01 -0400
- Subject: Re: meaningful error message in gdbserver
- References: <Pine.LNX.4.33.0508311929060.17751-100000@server.ies-hungary.intra>
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 <dan@codesourcery.com>
* acinclude.m4: Correct quoting.
* aclocal.m4: Regenerated.
Suggested by SZOKOVACS Robert <szo@ies.hu>:
* 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 <thread_db.h>], [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;