Blob Blame History Raw
This should fix the error  with glib.  An error message will still be
printed, but a default backtrace will occur in this case.

--

--- gdb-7.7.90.20140613/gdb/python/py-framefilter.c-orig	2014-06-13 03:59:37.000000000 +0200
+++ gdb-7.7.90.20140613/gdb/python/py-framefilter.c	2014-06-27 17:20:00.945271945 +0200
@@ -1475,6 +1475,7 @@ gdbpy_apply_frame_filter (const struct e
   volatile struct gdb_exception except;
   PyObject *item;
   htab_t levels_printed;
+  int count_printed = 0;
 
   if (!gdb_python_initialized)
     return EXT_LANG_BT_NO_FILTERS;
@@ -1494,24 +1495,7 @@ gdbpy_apply_frame_filter (const struct e
   iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
 
   if (iterable == NULL)
-    {
-      /* Normally if there is an error GDB prints the exception,
-	 abandons the backtrace and exits.  The user can then call "bt
-	 no-filters", and get a default backtrace (it would be
-	 confusing to automatically start a standard backtrace halfway
-	 through a Python filtered backtrace).  However in the case
-	 where GDB cannot initialize the frame filters (most likely
-	 due to incorrect auto-load paths), GDB has printed nothing.
-	 In this case it is OK to print the default backtrace after
-	 printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
-	 here to signify there are no filters after printing the
-	 initialization error.  This return code will trigger a
-	 default backtrace.  */
-
-      gdbpy_print_stack ();
-      do_cleanups (cleanups);
-      return EXT_LANG_BT_NO_FILTERS;
-    }
+    goto error_nothing_printed;
 
   /* If iterable is None, then there are no frame filters registered.
      If this is the case, defer to default GDB printing routines in MI
@@ -1540,15 +1524,39 @@ gdbpy_apply_frame_filter (const struct e
 	gdbpy_print_stack ();
 
       Py_DECREF (item);
+      count_printed++;
     }
 
   if (item == NULL && PyErr_Occurred ())
-    goto error;
+    {
+      if (count_printed > 0)
+	goto error;
+      else
+	goto error_nothing_printed;
+    }
 
  done:
   do_cleanups (cleanups);
   return success;
 
+  /* Normally if there is an error GDB prints the exception,
+     abandons the backtrace and exits.  The user can then call "bt
+     no-filters", and get a default backtrace (it would be
+     confusing to automatically start a standard backtrace halfway
+     through a Python filtered backtrace).  However in the case
+     where GDB cannot initialize the frame filters (most likely
+     due to incorrect auto-load paths), GDB has printed nothing.
+     In this case it is OK to print the default backtrace after
+     printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
+     here to signify there are no filters after printing the
+     initialization error.  This return code will trigger a
+     default backtrace.  */
+
+ error_nothing_printed:
+  gdbpy_print_stack ();
+  do_cleanups (cleanups);
+  return EXT_LANG_BT_NO_FILTERS;
+
   /* Exit and abandon backtrace on error, printing the exception that
      is set.  */
  error: