Make gdb.selected_thread().inferior return a new reference
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-infthread.exp
index 0711d6994e8878c75b021c8697296d05747dffb5..69fc9709b27daaff808804df8d5f23423bd3db8f 100644 (file)
@@ -51,6 +51,15 @@ gdb_test "python print(seen_a_thread)" "True"
 
 # Test basic gdb.Inferior attributes and methods.
 
+# Make sure that InferiorThread.inferior returns a new reference (see PR 21213).
+
+gdb_py_test_silent_cmd "python gdb.selected_thread ().inferior" "test InferiorThread.inferior 1" 1
+gdb_py_test_silent_cmd "python gdb.selected_thread ().inferior" "test InferiorThread.inferior 2" 1
+gdb_test_no_output "python import gc; gc.collect()" "call Python garbage collection"
+gdb_py_test_silent_cmd "python gdb.selected_thread ().inferior" "test InferiorThread.inferior 3" 1
+gdb_py_test_silent_cmd "python gdb.selected_thread ().inferior" "test InferiorThread.inferior 4" 1
+
+
 gdb_py_test_silent_cmd "python t0 = gdb.selected_thread ()" "test gdb.selected_thread" 1
 gdb_test "python print (t0)" "\\<gdb.InferiorThread object at 0x\[\[:xdigit:\]\]+>" "verify InferiorThread object"
 gdb_test "python print ('result = %s' % t0.num)" " = 1" "test InferiorThread.num"
This page took 0.024645 seconds and 4 git commands to generate.