[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#619879: fix gdb threads problems for Hurd



Package: gdb
Version: 7.2-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd

Attached please find a small patch for gdb to work properly under
GNU/Hurd. It can safely be added last to the series file.

The last two parts of the patch (finding and linking with libhurduser
and libmachuser) will not be needed in next version of libc0.3, where
they will be integrated into libc itself (according to Samuel Thibault).

This bug is related to bug  #579834 which will be merged when this bug
report is registered.

Thank you for your attention.
--- gdb-7.2/gdb/gnu-nat.c.orig	2010-05-14 22:17:37.000000000 +0200
+++ gdb-7.2/gdb/gnu-nat.c	2011-03-28 09:07:49.000000000 +0200
@@ -1578,8 +1578,8 @@
 	  if (--inf->pending_execs == 0)
 	    /* We're done!  */
 	    {
+	      prune_threads ();	/* Get rid of the old shell threads */
 #if 0				/* do we need this? */
-	      prune_threads (1);	/* Get rid of the old shell threads */
 	      renumber_threads (0);	/* Give our threads reasonable names. */
 #endif
 	    }
--- gdb-7.2/gdb/thread.c.orig	2010-08-06 21:51:49.000000000 +0200
+++ gdb-7.2/gdb/thread.c	2011-03-28 09:04:52.000000000 +0200
@@ -61,7 +61,6 @@
 static void info_threads_command (char *, int);
 static void thread_apply_command (char *, int);
 static void restore_current_thread (ptid_t);
-static void prune_threads (void);
 
 /* Frontend view of the thread state.  Possible extensions: stepping,
    finishing, until(ling),...  */
@@ -518,7 +517,7 @@
   return 1;
 }
 
-static void
+void
 prune_threads (void)
 {
   struct thread_info *tp, *next;
--- gdb-7.2/gdb/gdbthread.h.orig	2010-01-12 22:40:24.000000000 +0100
+++ gdb-7.2/gdb/gdbthread.h	2011-03-28 09:03:55.000000000 +0200
@@ -213,6 +213,9 @@
 /* Delete an existing thread list entry.  */
 extern void delete_thread (ptid_t);
 
+/* Prune inactive threads  */
+extern void prune_threads (void);
+
 /* Delete an existing thread list entry, and be quiet about it.  Used
    after the process this thread having belonged to having already
    exited, for example.  */
--- gdb-7.2/gdb/configure.ac.orig	2010-08-19 00:55:57.000000000 +0200
+++ gdb-7.2/gdb/configure.ac	2011-03-21 19:02:58.000000000 +0100
@@ -425,6 +425,10 @@
 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
 AC_SEARCH_LIBS(socketpair, socket)
 
+# Needed to link properly for GNU/Hurd
+AC_SEARCH_LIBS(mach_port_destroy, machuser)
+AC_SEARCH_LIBS(proc_getmsgport, hurduser)
+
 # Link in zlib if we can.  This allows us to read compressed debug sections.
 AM_ZLIB
 
--- gdb-7.2/gdb/configure.orig	2010-08-19 00:55:56.000000000 +0200
+++ gdb-7.2/gdb/configure	2011-03-21 20:13:27.000000000 +0100
@@ -9173,6 +9173,118 @@
 
 fi
 
+# Needed to link properly for GNU/Hurd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mach_po
+rt_destroy" >&5
+$as_echo_n "checking for library containing mach_port_destroy... " >&6; }
+if test "${ac_cv_search_mach_port_destroy+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mach_port_destroy ();
+int
+main ()
+{
+return mach_port_destroy ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' machuser; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_mach_port_destroy=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_mach_port_destroy+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_mach_port_destroy+set}" = set; then :
+
+else
+  ac_cv_search_mach_port_destroy=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mach_port_destroy" >&5
+$as_echo "$ac_cv_search_mach_port_destroy" >&6; }
+ac_res=$ac_cv_search_mach_port_destroy
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing proc_getmsgport" >&5
+$as_echo_n "checking for library containing proc_getmsgport... " >&6; }
+if test "${ac_cv_search_proc_getmsgport+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char proc_getmsgport ();
+int
+main ()
+{
+return proc_getmsgport ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' hurduser; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_proc_getmsgport=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_proc_getmsgport+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_proc_getmsgport+set}" = set; then :
+
+else
+  ac_cv_search_proc_getmsgport=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_proc_getmsgport" >&5
+$as_echo "$ac_cv_search_proc_getmsgport" >&6; }
+ac_res=$ac_cv_search_proc_getmsgport
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
 
 # Link in zlib if we can.  This allows us to read compressed debug sections.
 

Reply to: