2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Tue, 23 Nov 2010 13:33:23 +0000 (13:33 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Tue, 23 Nov 2010 13:33:23 +0000 (13:33 +0000)
        PR python/12212

* python/py-inferior.c (find_thread_object): Check if PIDGET
returns 0.

2010-11-23  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12212

* gdb.python/python.exp: Check that selected_thread raises an
error when no inferior is loaded.

gdb/ChangeLog
gdb/python/py-inferior.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/python.exp

index 6e3aa7d167082ed832c749f3ceb30d1ac8e88ed0..2593e0abf8c98abd2704ebba054414985ee33dc2 100644 (file)
@@ -1,4 +1,11 @@
-2010-11-22  Joel Brobecker  <brobecker@adacore.com>
+2010-11-23  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/12212
+
+       * python/py-inferior.c (find_thread_object): Check if PIDGET
+       returns 0.
+
+010-11-22  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-lang.c (ada_template_to_fixed_record_type_1): Delete bit_incr.
 
index b1ddb16844006a25d88f8b1092140c95ae0af4c7..6382dabb1aac5c0b2ea7cf53698c189f02d17719 100644 (file)
@@ -130,6 +130,9 @@ find_thread_object (ptid_t ptid)
   PyObject *inf_obj;
 
   pid = PIDGET (ptid);
+  if (pid == 0)
+    return NULL;
+
   inf_obj = find_inferior_object (pid);
 
   if (inf_obj)
index f8c282b0f94472655dd7dd37b52f5d9789bc8436..f6c6b438bd8c2bb15cfc82ed93e9a1f630d4cdcb 100644 (file)
@@ -1,3 +1,10 @@
+2010-11-23  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/12212
+
+       * gdb.python/python.exp: Check that selected_thread raises an
+       error when no inferior is loaded.
+
 2010-11-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.dwarf2/dw2-stack-boundary.exp: New file.
index dd9175ae4c400e2fc800ccd9c8ef79fe1581ae86..e6080d108025d662b669551ace9fedfdf2b8faf3 100644 (file)
@@ -146,6 +146,11 @@ gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect hel
 
 gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"
 
+# Test PR 12212, using InfThread.selected_thread() when no inferior is
+# loaded.
+gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aquire thread with no inferior" 1
+gdb_test "python print nothread == None" "True" "Ensure that no threads are returned"
+
 # Start with a fresh gdb.
 clean_restart ${testfile}
 
This page took 0.054549 seconds and 4 git commands to generate.