From patchwork Wed Apr 30 19:18:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 769 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id F24DF360072 for ; Wed, 30 Apr 2014 12:18:41 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id AE7D1508C742; Wed, 30 Apr 2014 12:18:41 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 66A83508C755 for ; Wed, 30 Apr 2014 12:18:41 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=DfLOH 1YKpOMOxS1n0Wjr6YcMfDmVnewJjsjvYeqSMhvpvC5na8GeVtKpYhuJLdtF3Z44G chpzADrG6qT3L5FbsQYrvRxbpctKiSu+OvJjM5mdz/cDm/qbE59wJPrcpoO19MQc WDUK/fCHf+Bbt09M9/8dFr7PbVFUunnSn08qOk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=GXRLrp+PV9o MOMThDnLxjV3ZVOE=; b=Y3NtmiNP2sKtosQMh8X/oYMFSFva6mqoJHm6dMVaxyE H5efEsTFlUz/0Vip8pp7GLiLOKgp0OGHyapLBX3NKPHgLrG7zVt3B+aBWBaZu86P adsEsb6hw916GLDAGI8vJeq2QF6o/eM2v1wNYr6dUABPhiGyf5aBl+eRHJi5pxqY = Received: (qmail 7498 invoked by alias); 30 Apr 2014 19:18:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 7316 invoked by uid 89); 30 Apr 2014 19:18:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Apr 2014 19:18:19 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Wfa1E-0004yV-RO from donb@codesourcery.com for gdb-patches@sourceware.org; Wed, 30 Apr 2014 12:18:12 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 30 Apr 2014 12:18:12 -0700 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Wed, 30 Apr 2014 12:18:10 -0700 Received: by build4-lucid-cs (Postfix, from userid 1905) id 0B4D540D8C; Wed, 30 Apr 2014 12:18:10 -0700 (PDT) From: Don Breazeal To: CC: Don Breazeal Subject: [PATCH 4/4 v2][REPOST] Non-stop exec tests Date: Wed, 30 Apr 2014 12:18:02 -0700 Message-ID: <1398885482-8449-5-git-send-email-donb@codesourcery.com> In-Reply-To: <1398885482-8449-1-git-send-email-donb@codesourcery.com> References: <1398885482-8449-1-git-send-email-donb@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in From: Don Breazeal [Reposting to eliminate unexpected attachment type.] This patch extends the non-ldr-exc-*.exp tests so that they run all their cases in non-stop mode as well as all-stop mode. These tests cover handling of exec events when non-leader threads call exec. Fixed problems in the previous version of this patch to get all the tests working correctly for native gdb, contrary to what I stated in the patch 0 email of this series. The tests also report a test error when 'runto_main' fails. In non-stop mode with 'target extended-remote', runto_main always fails with something like: (gdb) run ^M Starting program: /scratch/dbreazea/gdb-nat2/mine/gdb/testsuite/gdb.threads/non-ldr-exc-4 Unexpected vCont reply in non-stop mode: T0506:10e0ffffff7f0000;07:c8deffffff7f0000;10:c1a6abaaaa2a0000;thread:p5ee.5ee;core:0; This happens in other tests as well (e.g. gdb.threads/thread_events.exp), so I copied the error handling from that test so that the non-stop tests report 'untested' for target extended-remote. I couldn't find anything related to this in the gdb bug database, but I assume it is a known problem since the other tests handle it. Thanks --Don 2014-04-03 Don Breazeal * gdb/testsuite/gdb.threads/non-ldr-exc-1.exp: Add non-stop cases, call 'untested' if 'runto_main' fails. * gdb/testsuite/gdb.threads/non-ldr-exc-2.exp: Ditto. * gdb/testsuite/gdb.threads/non-ldr-exc-3.exp: Ditto. * gdb/testsuite/gdb.threads/non-ldr-exc-4.exp: Ditto. --- gdb/testsuite/gdb.threads/non-ldr-exc-1.exp | 20 ++++++++++++--- gdb/testsuite/gdb.threads/non-ldr-exc-2.exp | 36 +++++++++++++++++++++++--- gdb/testsuite/gdb.threads/non-ldr-exc-3.exp | 36 +++++++++++++++++++++++--- gdb/testsuite/gdb.threads/non-ldr-exc-4.exp | 20 ++++++++++++--- 4 files changed, 94 insertions(+), 18 deletions(-) diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp index 8123a99..e35236a 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp @@ -28,13 +28,19 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab return -1 } -proc do_test { lock_sched } { - with_test_prefix "lock-sched$lock_sched" { +proc do_test { lock_sched mode } { + with_test_prefix "lock-sched$lock_sched,$mode" { global executable clean_restart ${executable} + if { $mode == "non-stop" } { + gdb_test_no_output "set target-async on" "set async mode" + gdb_test_no_output "set non-stop on" "set non-stop mode" + } + if ![runto_main] { + untested "could not run to main" return -1 } @@ -48,11 +54,17 @@ proc do_test { lock_sched } { gdb_test_no_output "set scheduler-locking on" } + if { $mode == "non-stop" } { + gdb_test "thread 2" "Switching.*" + } + gdb_test "continue" \ ".*is executing new program.*Breakpoint 1, main.* at .*" \ "continue over exec" } } -do_test 0 -do_test 1 +do_test 0 "all-stop" +do_test 1 "all-stop" +do_test 0 "non-stop" +do_test 1 "non-stop" diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp index 857e7bc..a0281d6 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp @@ -29,18 +29,42 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab return -1 } -proc do_test { lock_sched } { - with_test_prefix "lock-sched$lock_sched" { +# Test for breakpoint event among async thread events. +# gdb_continue_to_breakpoint requires "$gdb_prompt $", but +# here we may get a thread event message instead of EOL. +proc gdb_continue_to_breakpoint_async { name pattern } { + global gdb_prompt + + gdb_test_multiple "continue" $name { + -re ".*Breakpoint .* (at|in) ($pattern)$gdb_prompt " { + pass $name + } + } +} + +proc do_test { lock_sched mode } { + with_test_prefix "lock-sched$lock_sched,$mode" { global executable clean_restart ${executable} + if { $mode == "non-stop" } { + gdb_test_no_output "set target-async on" "set async mode" + gdb_test_no_output "set non-stop on" "set non-stop mode" + } + if ![runto_main] { + untested "could not run to main" return -1 } gdb_breakpoint [gdb_get_line_number "break-here"] - gdb_continue_to_breakpoint "break-here" ".* break-here .*" + if { $mode == "non-stop" } { + gdb_continue_to_breakpoint_async "break-here" ".* break-here .*" + gdb_test "thread 2" "Switching.*" + } else { + gdb_continue_to_breakpoint "break-here" ".* break-here .*" + } gdb_test "info threads" \ "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*" \ @@ -59,5 +83,7 @@ proc do_test { lock_sched } { } } -do_test 0 -do_test 1 +do_test 0 "all-stop" +do_test 1 "all-stop" +do_test 0 "non-stop" +do_test 1 "non-stop" diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp index 7f33d39..69c27d8 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp @@ -31,18 +31,42 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab return -1 } -proc do_test { lock_sched } { - with_test_prefix "lock-sched$lock_sched" { +# Test for breakpoint event among async thread events. +# gdb_continue_to_breakpoint requires "$gdb_prompt $", but +# here we may get a thread event message instead of EOL. +proc gdb_continue_to_breakpoint_async { name pattern } { + global gdb_prompt + + gdb_test_multiple "continue" $name { + -re ".*Breakpoint .* (at|in) ($pattern)$gdb_prompt " { + pass $name + } + } +} + +proc do_test { lock_sched mode } { + with_test_prefix "lock-sched$lock_sched,$mode" { global executable clean_restart ${executable} + if { $mode == "non-stop" } { + gdb_test_no_output "set target-async on" "set async mode" + gdb_test_no_output "set non-stop on" "set non-stop mode" + } + if ![runto_main] { + untested "could not run to main" return -1 } gdb_breakpoint [gdb_get_line_number "break-here"] - gdb_continue_to_breakpoint "break-here" ".* break-here .*" + if { $mode == "non-stop" } { + gdb_continue_to_breakpoint_async "break-here" ".* break-here .*" + gdb_test "thread 2" "Switching.*" + } else { + gdb_continue_to_breakpoint "break-here" ".* break-here .*" + } # Also test with sched-lock to make sure we can follow the # non-leader thread execing even though the main thread wasn't @@ -57,5 +81,7 @@ proc do_test { lock_sched } { } } -do_test 0 -do_test 1 +do_test 0 "all-stop" +do_test 1 "all-stop" +do_test 0 "non-stop" +do_test 1 "non-stop" diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp index a5e88bb..f83577d 100644 --- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp +++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp @@ -30,13 +30,19 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab return -1 } -proc do_test { lock_sched } { - with_test_prefix "lock-sched$lock_sched" { +proc do_test { lock_sched mode } { + with_test_prefix "lock-sched$lock_sched,$mode" { global executable clean_restart ${executable} + if { $mode == "non-stop" } { + gdb_test_no_output "set target-async on" "set async mode" + gdb_test_no_output "set non-stop on" "set non-stop mode" + } + if ![runto_main] { + untested "could not run to main" return -1 } @@ -50,11 +56,17 @@ proc do_test { lock_sched } { gdb_test_no_output "set scheduler-locking on" } + if { $mode == "non-stop" } { + gdb_test "thread 2" "Switching.*" + } + gdb_test "continue" \ ".*is executing new program.*Breakpoint 1, main.* at .*" \ "continue over exec" } } -do_test 0 -do_test 1 +do_test 0 "all-stop" +do_test 1 "all-stop" +do_test 0 "non-stop" +do_test 1 "non-stop"