Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* meaningful error message in gdbserver
@ 2005-08-31 19:04 SZOKOVACS Robert
  2005-09-17 23:12 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: SZOKOVACS Robert @ 2005-08-31 19:04 UTC (permalink / raw)
  To: gdb-patches

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.

br

Szo

==========================================================================

diff -ruw gdb-6.3.50.20050831-orig/gdb/gdbserver/thread-db.c gdb-6.3.50.20050831/gdb/gdbserver/thread-db.c
--- gdb-6.3.50.20050831-orig/gdb/gdbserver/thread-db.c	2005-08-31 18:12:56.000000000 +0200
+++ gdb-6.3.50.20050831/gdb/gdbserver/thread-db.c	2005-08-31 18:27:18.000000000 +0200
@@ -351,6 +351,10 @@
       /* No thread library was detected.  */
       return 0;

+    case TD_VERSION:
+      warning ("error initializing thread_db library:\nVersion of libpthread and libthread_db mismatch.");
+      return 0;
+
     case TD_OK:
       /* The thread library was detected.  */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: meaningful error message in gdbserver
  2005-08-31 19:04 meaningful error message in gdbserver SZOKOVACS Robert
@ 2005-09-17 23:12 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2005-09-17 23:12 UTC (permalink / raw)
  To: SZOKOVACS Robert; +Cc: gdb-patches

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;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-17 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-31 19:04 meaningful error message in gdbserver SZOKOVACS Robert
2005-09-17 23:12 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox