From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62842 invoked by alias); 11 Apr 2017 23:56:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 62780 invoked by uid 89); 11 Apr 2017 23:56:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Apr 2017 23:56:42 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE0977E9D1 for ; Tue, 11 Apr 2017 23:51:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BE0977E9D1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BE0977E9D1 Received: from cascais.lan (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53CB917C3C for ; Tue, 11 Apr 2017 23:51:17 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 4/8] Improve coverage of the PR threads/13217 regression test Date: Tue, 11 Apr 2017 23:56:00 -0000 Message-Id: <1491954673-29172-5-git-send-email-palves@redhat.com> In-Reply-To: <1491954673-29172-1-git-send-email-palves@redhat.com> References: <1491954673-29172-1-git-send-email-palves@redhat.com> X-SW-Source: 2017-04/txt/msg00302.txt.bz2 - Make sure we end up with no thread selected after the detach. - Test both "thread apply all" and "thread apply $some_threads", for completeness. gdb/ChangeLog: yyyy-mm-dd Pedro Alves PR threads/13217 * gdb.threads/threadapply.exp (thr_apply_detach): New procedure. (top level): Call it twice, with different thread sets. --- gdb/testsuite/gdb.threads/threadapply.exp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp index 789b283..959e8b9 100644 --- a/gdb/testsuite/gdb.threads/threadapply.exp +++ b/gdb/testsuite/gdb.threads/threadapply.exp @@ -63,4 +63,33 @@ gdb_test "step" "thread_function.*" "step to the thread_function" gdb_test "up" ".*in main.*" "go up in the stack frame" gdb_test "thread apply all print 1" "Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1.*Thread ..*\\\$\[0-9]+ = 1" "run a simple print command on all threads" gdb_test "down" "#0.*thread_function.*" "go down and check selected frame" -gdb_test "thread apply all detach" "Thread .*" + +# Make sure that GDB doesn't crash when the previously selected thread +# exits due to the command run via thread apply. Regression test for +# PR threads/13217. + +proc thr_apply_detach {thread_set} { + with_test_prefix "thread apply $thread_set" { + global binfile + global break_line + + clean_restart ${binfile} + + if ![runto_main] { + fail "can't run to main" + return -1 + } + + gdb_breakpoint "$break_line" + gdb_continue_to_breakpoint "all threads started" + + gdb_test "thread apply $thread_set detach" "Thread .*" + gdb_test "thread" "No thread selected" "switched to no thread selected" + } +} + +# Test both "all" and a thread list, because those are implemented as +# different commands in GDB. +foreach thread_set {"all" "1.1 1.2 1.3"} { + thr_apply_detach $thread_set +} -- 2.5.5