2017-12-10 22:00:49 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-btrobust.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Continue backtrace even if a frame filter throws an exception (Phil Muldoon).
|
|
|
|
;;=push
|
|
|
|
|
2014-06-27 15:47:58 +00:00
|
|
|
This should fix the error with glib. An error message will still be
|
|
|
|
printed, but a default backtrace will occur in this case.
|
|
|
|
|
|
|
|
--
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
|
|
|
--- a/gdb/python/py-framefilter.c
|
|
|
|
+++ b/gdb/python/py-framefilter.c
|
2019-10-19 18:30:13 +00:00
|
|
|
@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
2017-02-27 21:30:32 +00:00
|
|
|
htab_eq_pointer,
|
|
|
|
NULL));
|
2014-06-27 15:47:58 +00:00
|
|
|
|
2017-02-27 21:30:32 +00:00
|
|
|
+ int count_printed = 0;
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
|
2019-10-19 18:30:13 +00:00
|
|
|
@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
2018-05-31 18:47:56 +00:00
|
|
|
{
|
2017-02-27 21:30:32 +00:00
|
|
|
if (PyErr_Occurred ())
|
|
|
|
{
|
2019-01-21 17:16:00 +00:00
|
|
|
- gdbpy_print_stack_or_quit ();
|
2017-02-27 21:30:32 +00:00
|
|
|
- return EXT_LANG_BT_ERROR;
|
2018-05-31 18:47:56 +00:00
|
|
|
+ gdbpy_print_stack ();
|
2017-02-27 21:30:32 +00:00
|
|
|
+ return count_printed > 0 ? EXT_LANG_BT_ERROR : EXT_LANG_BT_NO_FILTERS;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-10-19 18:30:13 +00:00
|
|
|
@@ -1245,7 +1246,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
2018-05-31 18:47:56 +00:00
|
|
|
/* Do not exit on error printing a single frame. Print the
|
2015-02-14 18:33:09 +00:00
|
|
|
error and continue with other frames. */
|
|
|
|
if (success == EXT_LANG_BT_ERROR)
|
2019-01-21 17:16:00 +00:00
|
|
|
- gdbpy_print_stack_or_quit ();
|
2018-05-31 18:47:56 +00:00
|
|
|
+ gdbpy_print_stack ();
|
2014-06-27 15:47:58 +00:00
|
|
|
+ count_printed++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
2021-03-26 18:40:18 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
|
|
|
|
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
|
|
|
|
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
|
|
|
|
@@ -277,9 +277,20 @@ gdb_test_multiple "bt 1" $test {
|
|
|
|
# Now verify that we can see a quit.
|
|
|
|
gdb_test_no_output "python name_error = KeyboardInterrupt" \
|
|
|
|
"Change ErrorFilter to throw KeyboardInterrupt"
|
|
|
|
-gdb_test "bt 1" "Quit" "bt 1 with KeyboardInterrupt"
|
|
|
|
-
|
|
|
|
-
|
|
|
|
+set re1 [multi_line \
|
|
|
|
+ "Python Exception <class 'KeyboardInterrupt'> whoops: " \
|
|
|
|
+ "\\(More stack frames follow\.\.\.\\)"]
|
|
|
|
+set re2 [multi_line \
|
|
|
|
+ "Python Exception <type 'exceptions.KeyboardInterrupt'> whoops: " \
|
|
|
|
+ "\\(More stack frames follow\.\.\.\\)"]
|
|
|
|
+gdb_test_multiple "bt 1" "" {
|
|
|
|
+ -re -wrap $re1 {
|
|
|
|
+ pass $gdb_test_name
|
|
|
|
+ }
|
|
|
|
+ -re -wrap $re2 {
|
|
|
|
+ pass $gdb_test_name
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
# Test with no debuginfo
|
|
|
|
|
|
|
|
# We cannot use prepare_for_testing as we have to set the safe-patch
|