Jan Kratochvil dd2c5ed
This should fix the error  with glib.  An error message will still be
Jan Kratochvil dd2c5ed
printed, but a default backtrace will occur in this case.
Jan Kratochvil dd2c5ed
Jan Kratochvil dd2c5ed
--
Jan Kratochvil dd2c5ed
Jan Kratochvil 32f92b2
Index: gdb-7.9.50.20150520/gdb/python/py-framefilter.c
Jan Kratochvil 7cbf529
===================================================================
Jan Kratochvil 32f92b2
--- gdb-7.9.50.20150520.orig/gdb/python/py-framefilter.c	2015-05-31 17:36:34.681952530 +0200
Jan Kratochvil 32f92b2
+++ gdb-7.9.50.20150520/gdb/python/py-framefilter.c	2015-05-31 17:55:01.884788031 +0200
Jan Kratochvil 32f92b2
@@ -1523,6 +1523,7 @@ gdbpy_apply_frame_filter (const struct e
Jan Kratochvil 32f92b2
   PyObject *iterable;
Jan Kratochvil dd2c5ed
   PyObject *item;
Jan Kratochvil dd2c5ed
   htab_t levels_printed;
Jan Kratochvil dd2c5ed
+  int count_printed = 0;
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
   if (!gdb_python_initialized)
Jan Kratochvil dd2c5ed
     return EXT_LANG_BT_NO_FILTERS;
Jan Kratochvil 32f92b2
@@ -1543,24 +1544,7 @@ gdbpy_apply_frame_filter (const struct e
Jan Kratochvil dd2c5ed
   iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
   if (iterable == NULL)
Jan Kratochvil dd2c5ed
-    {
Jan Kratochvil dd2c5ed
-      /* Normally if there is an error GDB prints the exception,
Jan Kratochvil dd2c5ed
-	 abandons the backtrace and exits.  The user can then call "bt
Jan Kratochvil dd2c5ed
-	 no-filters", and get a default backtrace (it would be
Jan Kratochvil dd2c5ed
-	 confusing to automatically start a standard backtrace halfway
Jan Kratochvil dd2c5ed
-	 through a Python filtered backtrace).  However in the case
Jan Kratochvil dd2c5ed
-	 where GDB cannot initialize the frame filters (most likely
Jan Kratochvil dd2c5ed
-	 due to incorrect auto-load paths), GDB has printed nothing.
Jan Kratochvil dd2c5ed
-	 In this case it is OK to print the default backtrace after
Jan Kratochvil dd2c5ed
-	 printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
Jan Kratochvil dd2c5ed
-	 here to signify there are no filters after printing the
Jan Kratochvil dd2c5ed
-	 initialization error.  This return code will trigger a
Jan Kratochvil dd2c5ed
-	 default backtrace.  */
Jan Kratochvil dd2c5ed
-
Jan Kratochvil dd2c5ed
-      gdbpy_print_stack ();
Jan Kratochvil dd2c5ed
-      do_cleanups (cleanups);
Jan Kratochvil dd2c5ed
-      return EXT_LANG_BT_NO_FILTERS;
Jan Kratochvil dd2c5ed
-    }
Jan Kratochvil dd2c5ed
+    goto error_nothing_printed;
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
   /* If iterable is None, then there are no frame filters registered.
Jan Kratochvil dd2c5ed
      If this is the case, defer to default GDB printing routines in MI
Jan Kratochvil 32f92b2
@@ -1591,15 +1575,40 @@ gdbpy_apply_frame_filter (const struct e
Jan Kratochvil 7cbf529
 	 error and continue with other frames.  */
Jan Kratochvil 7cbf529
       if (success == EXT_LANG_BT_ERROR)
Jan Kratochvil dd2c5ed
 	gdbpy_print_stack ();
Jan Kratochvil 7cbf529
+
Jan Kratochvil dd2c5ed
+      count_printed++;
Jan Kratochvil dd2c5ed
     }
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
   if (item == NULL && PyErr_Occurred ())
Jan Kratochvil dd2c5ed
-    goto error;
Jan Kratochvil dd2c5ed
+    {
Jan Kratochvil dd2c5ed
+      if (count_printed > 0)
Jan Kratochvil dd2c5ed
+	goto error;
Jan Kratochvil dd2c5ed
+      else
Jan Kratochvil dd2c5ed
+	goto error_nothing_printed;
Jan Kratochvil dd2c5ed
+    }
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
  done:
Jan Kratochvil dd2c5ed
   do_cleanups (cleanups);
Jan Kratochvil dd2c5ed
   return success;
Jan Kratochvil dd2c5ed
 
Jan Kratochvil dd2c5ed
+  /* Normally if there is an error GDB prints the exception,
Jan Kratochvil dd2c5ed
+     abandons the backtrace and exits.  The user can then call "bt
Jan Kratochvil dd2c5ed
+     no-filters", and get a default backtrace (it would be
Jan Kratochvil dd2c5ed
+     confusing to automatically start a standard backtrace halfway
Jan Kratochvil dd2c5ed
+     through a Python filtered backtrace).  However in the case
Jan Kratochvil dd2c5ed
+     where GDB cannot initialize the frame filters (most likely
Jan Kratochvil dd2c5ed
+     due to incorrect auto-load paths), GDB has printed nothing.
Jan Kratochvil dd2c5ed
+     In this case it is OK to print the default backtrace after
Jan Kratochvil dd2c5ed
+     printing the error message.  GDB returns EXT_LANG_BT_NO_FILTERS
Jan Kratochvil dd2c5ed
+     here to signify there are no filters after printing the
Jan Kratochvil dd2c5ed
+     initialization error.  This return code will trigger a
Jan Kratochvil dd2c5ed
+     default backtrace.  */
Jan Kratochvil dd2c5ed
+
Jan Kratochvil dd2c5ed
+ error_nothing_printed:
Jan Kratochvil dd2c5ed
+  gdbpy_print_stack ();
Jan Kratochvil dd2c5ed
+  do_cleanups (cleanups);
Jan Kratochvil dd2c5ed
+  return EXT_LANG_BT_NO_FILTERS;
Jan Kratochvil dd2c5ed
+
Jan Kratochvil dd2c5ed
   /* Exit and abandon backtrace on error, printing the exception that
Jan Kratochvil dd2c5ed
      is set.  */
Jan Kratochvil dd2c5ed
  error: