aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r--gdb/testsuite/gdb.python/py-unwind.exp19
-rw-r--r--gdb/testsuite/gdb.python/py-unwind.py7
2 files changed, 26 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index 337e5dc..3e214ee 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -142,3 +142,22 @@ gdb_test "python obj = simple_unwinder(True)" \
[multi_line \
"TypeError: incorrect type for name: <class 'bool'>" \
"Error while executing Python code\\."]
+
+# Now register the simple_unwinder with a valid name, and use the
+# unwinder to capture a PendingFrame object.
+gdb_test_no_output "python obj = simple_unwinder(\"simple\")"
+gdb_test_no_output "python gdb.unwinder.register_unwinder(None, obj)"
+check_for_broken_backtrace "backtrace to capture a PendingFrame object"
+
+# Call methods on the captured gdb.PendingFrame and check we see the
+# expected error.
+gdb_test_no_output "python pf = captured_pending_frame"
+foreach cmd {"pf.read_register(\"pc\")" \
+ "pf.create_unwind_info(None)" \
+ "pf.architecture()" \
+ "pf.level()"} {
+ gdb_test "python $cmd" \
+ [multi_line \
+ "ValueError: gdb\\.PendingFrame is invalid\\." \
+ "Error while executing Python code\\."]
+}
diff --git a/gdb/testsuite/gdb.python/py-unwind.py b/gdb/testsuite/gdb.python/py-unwind.py
index edd2e30..b30e843 100644
--- a/gdb/testsuite/gdb.python/py-unwind.py
+++ b/gdb/testsuite/gdb.python/py-unwind.py
@@ -133,12 +133,19 @@ class TestUnwinder(Unwinder):
global_test_unwinder = TestUnwinder()
gdb.unwinder.register_unwinder(None, global_test_unwinder, True)
+# This is filled in by the simple_unwinder class.
+captured_pending_frame = None
+
class simple_unwinder(Unwinder):
def __init__(self, name):
super().__init__(name)
def __call__(self, pending_frame):
+ global captured_pending_frame
+
+ if captured_pending_frame is None:
+ captured_pending_frame = pending_frame
return None