PR 17185
authorDoug Evans <xdje42@gmail.com>
Sat, 26 Jul 2014 21:49:04 +0000 (14:49 -0700)
committerDoug Evans <xdje42@gmail.com>
Sat, 26 Jul 2014 21:49:04 +0000 (14:49 -0700)
PR 17185 describes a problem with using gdb+guile with libgc 7.4.0.
The symptom is a hang in sigsuspend.
[The thread referenced in the PR has the details.]
It's not clear what the right fix is, or even where the bug is yet.
This patch applies the same workaround Guile has applied.
There is no functionality or real performance loss with this,
and Guile has been using it for awhile.

* configure.ac: Add check for header gc/gc.h.
Add check for function setenv.
* configure: Regenerate.
* config.in: Regenerate.
* guile/guile.c (_initialize_guile): Add workaround for libgc 7.4.0.

gdb/ChangeLog
gdb/config.in
gdb/configure
gdb/configure.ac
gdb/guile/guile.c

index a73b37f25aab630356b4291064b66a951e0672d4..c5ebd2a37125f72751f2824709d18da6085fe7a8 100644 (file)
@@ -1,3 +1,12 @@
+2014-07-26  Doug Evans  <xdje42@gmail.com>
+
+       PR 17185
+       * configure.ac: Add check for header gc/gc.h.
+       Add check for function setenv.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+       * guile/guile.c (_initialize_guile): Add workaround for libgc 7.4.0.
+
 2014-07-25  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * mips-tdep.c (mips_gdbarch_init): Also check the compressed ISA
index 8585b49a99a217748a6345511ec0da7a0886186a..fb9b0cdc20ceb86e339db1c86a3ec7eabfea371a 100644 (file)
 /* Define if <sys/procfs.h> has fpregset_t. */
 #undef HAVE_FPREGSET_T
 
+/* Define to 1 if you have the <gc/gc.h> header file. */
+#undef HAVE_GC_GC_H
+
 /* Define to 1 if you have the `getgid' function. */
 #undef HAVE_GETGID
 
 /* Define to 1 if you have the `scm_new_smob' function. */
 #undef HAVE_SCM_NEW_SMOB
 
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
 /* Define to 1 if you have the `setlocale' function. */
 #undef HAVE_SETLOCALE
 
index a4c0a8ce7f5e30939105b9060c1f77f7cdc14af7..58fa47768df914a672a0aaf328bd9101c9bd7f52 100755 (executable)
@@ -9103,6 +9103,32 @@ fi
 
 
 
+# PR 17185, see if we can get the libgc version to see if we need
+# to apply the workaround.
+for ac_header in gc/gc.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "gc/gc.h" "ac_cv_header_gc_gc_h" "$ac_includes_default"
+if test "x$ac_cv_header_gc_gc_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GC_GC_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in setenv
+do :
+  ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv"
+if test "x$ac_cv_func_setenv" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SETENV 1
+_ACEOF
+
+fi
+done
+
+
 # --------------------- #
 # Check for libmcheck.  #
 # --------------------- #
index a2ac15f6d74407d06178d355720529897727c38a..e348144a1aa86324e25284492102e0fab37f6d25 100644 (file)
@@ -1218,6 +1218,11 @@ fi
 AC_SUBST(GUILE_CPPFLAGS)
 AC_SUBST(GUILE_LIBS)
 
+# PR 17185, see if we can get the libgc version to see if we need
+# to apply the workaround.
+AC_CHECK_HEADERS(gc/gc.h)
+AC_CHECK_FUNCS([setenv])
+
 # --------------------- #
 # Check for libmcheck.  #
 # --------------------- #
index 05dba69139e9c97bc2163a2f2b1ad71000d06de2..6bc078f779160d65a57f97cc3fcce038fbc61ba0 100644 (file)
@@ -35,6 +35,9 @@
 #ifdef HAVE_GUILE
 #include "guile.h"
 #include "guile-internal.h"
+#ifdef HAVE_GC_GC_H
+#include <gc/gc.h> /* PR 17185 */
+#endif
 #endif
 
 /* The Guile version we're using.
@@ -750,6 +753,18 @@ _initialize_guile (void)
      side to define module "gdb" which imports "_gdb".  There is evidently no
      similar convention in Guile so we skip this.  */
 
+  /* PR 17185 There are problems with using libgc 7.4.0.
+     Copy over the workaround Guile uses (Guile is working around a different
+     problem, but the workaround is the same).  */
+#if (GC_VERSION_MAJOR == 7 && GC_VERSION_MINOR == 4 && GC_VERSION_MICRO == 0)
+  /* The bug is only known to appear with pthreads.  We assume any system
+     using pthreads also uses setenv (and not putenv).  That is why we don't
+     have a similar call to putenv here.  */
+#if defined (HAVE_SETENV)
+  setenv ("GC_MARKERS", "1", 1);
+#endif
+#endif
+
   /* scm_with_guile is the most portable way to initialize Guile.
      Plus we need to initialize the Guile support while in Guile mode
      (e.g., called from within a call to scm_with_guile).  */
This page took 0.042117 seconds and 4 git commands to generate.