From: Guinevere Larsen Date: Mon, 11 Mar 2024 09:57:31 +0000 (+0100) Subject: gdb/testsuite: Use _inferior_thread_count in gdb.threads/threadcrash.exp X-Git-Tag: gdb-15-branchpoint~755 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b95b92ec093cea8014e33fdca2f800c4e5ce91be;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite: Use _inferior_thread_count in gdb.threads/threadcrash.exp A linaro PR [1] reports that the gdb.threads/threadcrash.exp test-case fails to cout the number of threads in the inferior: ... FAIL: gdb.threads/threadcrash.exp: test_gcore: $thread_count == 7 FAIL: gdb.threads/threadcrash.exp: test_gcore: $thread_count == [llength $test_list] ... Fix this by getting the convenience variable _inferior_thread_count as opposed to calculating it based on the output of "info threads". Tested on arm-linux and x86_64-linux. Reviewed-By: Lancelot Six Approved-By: Tom de Vries [1] https://linaro.atlassian.net/browse/GNU-1120 --- diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp index 592098b9c38..966708acd96 100644 --- a/gdb/testsuite/gdb.threads/threadcrash.exp +++ b/gdb/testsuite/gdb.threads/threadcrash.exp @@ -20,26 +20,6 @@ # a gcore. -# Check that the inferior has 7 threads, and return the number of threads (7). -# We return the thread count so that, even if there is some error in the test, -# the final log doesn't get flooded with failures. - -proc test_thread_count {} { - set thread_count 0 - - gdb_test_multiple "info threads" "getting thread count" -lbl { - -re "Thread" { - incr thread_count - exp_continue - } - -re "$::gdb_prompt " { - gdb_assert {$thread_count == 7} - } - } - - return $thread_count -} - # Use 'thread apply all backtrace' to check if all expected threads # are present, and stopped in the expected locations. Set the global # TEST_LIST to be the a list of regexps expected to match all the @@ -132,7 +112,8 @@ proc thread_apply_all {} { proc do_full_test {} { global test_list - set thread_count [test_thread_count] + set thread_count [get_valueof "" "\$_inferior_thread_count" 0] + gdb_assert {$thread_count == 7} thread_apply_all