From: Phil Muldoon Date: Tue, 23 Nov 2010 13:33:23 +0000 (+0000) Subject: 2010-11-23 Phil Muldoon X-Git-Tag: cgen-snapshot-20101201~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea976c60e229b7d4ccfbf4a735a09c407f104a20;p=platform%2Fupstream%2Fbinutils.git 2010-11-23 Phil Muldoon PR python/12212 * python/py-inferior.c (find_thread_object): Check if PIDGET returns 0. 2010-11-23 Phil Muldoon PR python/12212 * gdb.python/python.exp: Check that selected_thread raises an error when no inferior is loaded. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6e3aa7d..2593e0a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,11 @@ -2010-11-22 Joel Brobecker +2010-11-23 Phil Muldoon + + PR python/12212 + + * python/py-inferior.c (find_thread_object): Check if PIDGET + returns 0. + +010-11-22 Joel Brobecker * ada-lang.c (ada_template_to_fixed_record_type_1): Delete bit_incr. diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index b1ddb168..6382dab 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -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) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f8c282b..f6c6b43 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-11-23 Phil Muldoon + + PR python/12212 + + * gdb.python/python.exp: Check that selected_thread raises an + error when no inferior is loaded. + 2010-11-20 Jan Kratochvil * gdb.dwarf2/dw2-stack-boundary.exp: New file. diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index dd9175a..e6080d1 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -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}