From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sAsCLiNms2eWezQAWB0awg (envelope-from ) for ; Mon, 17 Feb 2025 11:38:59 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=q/snp2eO; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=r8O51xvN; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=q/snp2eO; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=r8O51xvN; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B7AA91E105; Mon, 17 Feb 2025 11:38:59 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 078E81E05C for ; Mon, 17 Feb 2025 11:38:59 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AED4C3858406 for ; Mon, 17 Feb 2025 16:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AED4C3858406 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=q/snp2eO; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=r8O51xvN; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=q/snp2eO; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=r8O51xvN Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 26F163858C98 for ; Mon, 17 Feb 2025 16:36:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26F163858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 26F163858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739810207; cv=none; b=FUpE90NY/WyszMJLqCokfKOe6SDpsp5cVdic7r0p7unKxrtOvLaA0fsdKYOlq/DLeBprdEUVF93xMoMcrKC7Ihix8zG05KRB/u8NJCZhqNqKGVf3seOMK1ePsJehcd0pQ2eRYRXG1jNRn54WQ1aMpOc53G0aBSu++geGgyHH4vE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739810207; c=relaxed/simple; bh=+8jeQyWRk2fM3vvGaGL2oVLidsGh4WN0ISUTZls0/54=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=s6ay1zgESA6PVuYcmW5sRZpET7l0Y67LFyaDAEEs+n0EihBN3vJw6MF3xzn+D1uJHdigrsZW19Hs3PuHu2/b0Adw+FQc4rKPje/hPBiw6bbQYiqB5WR6IpJKYajUwf00J2rPyH0gj08tqkhpXIhVRbjT+BXdBt62Axg3fgVK9XI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26F163858C98 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AE2A21F45E for ; Mon, 17 Feb 2025 16:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1739810176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T4TSIcLLVHPU/EhLqIPJyMk0DzFz062ldXavkKIxcL0=; b=q/snp2eOK6vSdNoRzWWmiSA3mO5RDXN/dAU80UpRnN4+PThGj8Vh6ito+jTiA7WvthkKXT zLk5yxK6BRf2yTdI110nZ0Ekw4SvFXHeTg5sGpETK2jVAvDlmMsJcqfGXSfnoeFkLTEm6e P620ckkpn3UpteASYNUeUaI8Xka+FFI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1739810176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T4TSIcLLVHPU/EhLqIPJyMk0DzFz062ldXavkKIxcL0=; b=r8O51xvNUOw/Qg59LFbnLKsWVtf0tXjq3T1C/J3iVGN1pMI+Uny7jlpkqCUYTAcZR1DSNE 4Ptan8j1aYm0+2BA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1739810176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T4TSIcLLVHPU/EhLqIPJyMk0DzFz062ldXavkKIxcL0=; b=q/snp2eOK6vSdNoRzWWmiSA3mO5RDXN/dAU80UpRnN4+PThGj8Vh6ito+jTiA7WvthkKXT zLk5yxK6BRf2yTdI110nZ0Ekw4SvFXHeTg5sGpETK2jVAvDlmMsJcqfGXSfnoeFkLTEm6e P620ckkpn3UpteASYNUeUaI8Xka+FFI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1739810176; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T4TSIcLLVHPU/EhLqIPJyMk0DzFz062ldXavkKIxcL0=; b=r8O51xvNUOw/Qg59LFbnLKsWVtf0tXjq3T1C/J3iVGN1pMI+Uny7jlpkqCUYTAcZR1DSNE 4Ptan8j1aYm0+2BA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 98DA713AC2 for ; Mon, 17 Feb 2025 16:36:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +OkXJIBls2eBUAAAD6G6ig (envelope-from ) for ; Mon, 17 Feb 2025 16:36:16 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/3] [gdb/testsuite] Exit left-over gdb in gdb.mi/mi-break.exp Date: Mon, 17 Feb 2025 17:36:19 +0100 Message-ID: <20250217163619.8662-4-tdevries@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217163619.8662-1-tdevries@suse.de> References: <20250217163619.8662-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org After test-case gdb.mi/mi-break.exp, a gdb instance is left running. The test-case starts two instances using mi_clean_restart, one using separate-mi-tty. For each instance, gdb_exit is called once, from two different locations: - mi_clean_restart, and - gdb_finish. But this doesn't seem to be effective for the separate-mi-tty case. Fix this by calling gdb_mi_exit at the end of proc test_break. Likewise in a few more more test-case. Tested on x86_64-linux. PR testsuite/32709 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32709 --- gdb/testsuite/gdb.mi/mi-break.exp | 4 ++ gdb/testsuite/gdb.mi/mi-multi-commands.exp | 4 ++ gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp | 6 ++- .../gdb.mi/mi-thread-specific-bp.exp | 41 +++++++++++++------ gdb/testsuite/gdb.mi/mi-watch.exp | 4 ++ gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp | 6 ++- gdb/testsuite/gdb.mi/new-ui-mi-sync.exp | 26 ++++++++---- gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp | 4 ++ .../gdb.mi/user-selected-context-sync.exp | 35 ++++++++++------ 9 files changed, 92 insertions(+), 38 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp index 86e7b57260a..aa8603f4ef0 100644 --- a/gdb/testsuite/gdb.mi/mi-break.exp +++ b/gdb/testsuite/gdb.mi/mi-break.exp @@ -417,6 +417,10 @@ proc test_break {mi_mode} { test_explicit_breakpoints test_forced_conditions + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } foreach_mi_ui_mode mi-mode { diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp b/gdb/testsuite/gdb.mi/mi-multi-commands.exp index 028e187366a..ce4379c8636 100644 --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp @@ -123,6 +123,10 @@ proc run_test { args } { break } } + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } foreach_with_prefix args { "" "separate-mi-tty" } { diff --git a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp index 08c72182217..261ab7d0369 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-bp-deleted.exp @@ -36,8 +36,6 @@ if { [build_executable "failed to prepare" $testfile $srcfile \ } foreach_mi_ui_mode mode { - mi_gdb_exit - if {$mode eq "separate"} { set start_ops "separate-mi-tty" } else { @@ -279,4 +277,8 @@ foreach_mi_ui_mode mode { "set do_spin variable in inferior, inferior should now finish" mi_expect_stop "breakpoint-hit" "breakpt" ".*" ".*" "$::decimal" \ {"" "disp=\"keep\""} "stop in breakpt at the end of the test" + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } diff --git a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp index 715e0f7e804..6026e7b4727 100644 --- a/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp +++ b/gdb/testsuite/gdb.mi/mi-thread-specific-bp.exp @@ -33,17 +33,7 @@ proc make_loc {num} { return [mi_make_breakpoint_loc -thread "1" -number "$::decimal\\.$num"] } -foreach_mi_ui_mode mode { - - if {$mode == "separate"} { - set start_ops "separate-mi-tty" - } else { - set start_ops "" - } - - if {[mi_clean_restart $binfile $start_ops]} { - return -1 - } +proc do_test { mode } { # Ensure we get an error when placing a b/p for thread 1 at a point # where thread 1 doesn't exist. @@ -55,7 +45,7 @@ foreach_mi_ui_mode mode { # would succeed, and then 'info breakpoint' on the CLI would # trigger an assertion. if {$mode eq "separate"} { - with_spawn_id $gdb_main_spawn_id { + with_spawn_id $::gdb_main_spawn_id { gdb_test "info breakpoints" "No breakpoints, watchpoints, tracepoints, or catchpoints\\." \ "check CLI 'info breakpoints' when there are no breakpoints" } @@ -83,9 +73,34 @@ foreach_mi_ui_mode mode { # Check that 'info breakpoints' on the CLI succeeds. if {$mode eq "separate"} { - with_spawn_id $gdb_main_spawn_id { + with_spawn_id $::gdb_main_spawn_id { gdb_test "info breakpoints" ".*" \ "check CLI 'info breakpoints' when there are some breakpoints" } } + + return 1 +} + +foreach_mi_ui_mode mode { + + if {$mode == "separate"} { + set start_ops "separate-mi-tty" + } else { + set start_ops "" + } + + if {[mi_clean_restart $binfile $start_ops]} { + break + } + + set res [do_test $mode] + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit + + if { $res == -1 } { + break + } } diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp index a5a442eb13e..cf97d416535 100644 --- a/gdb/testsuite/gdb.mi/mi-watch.exp +++ b/gdb/testsuite/gdb.mi/mi-watch.exp @@ -173,6 +173,10 @@ proc test_watchpoint_all {mi_mode type} { #test_rwatch_creation_and_listing #test_awatch_creation_and_listing test_watchpoint_triggering + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } # Run the tests twice, once using software watchpoints, and another diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp index 938e6deec05..9e529880814 100644 --- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp +++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp @@ -45,8 +45,6 @@ proc make_bp_loc { num } { } foreach_mi_ui_mode mode { - mi_gdb_exit - if {$mode eq "separate"} { set start_ops "separate-mi-tty" } else { @@ -109,4 +107,8 @@ foreach_mi_ui_mode mode { "=breakpoint-deleted,id=\"$bpnum\"" \ "\\^done"] } + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } diff --git a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp index 28a42dcb665..bf1365e18ad 100644 --- a/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp +++ b/gdb/testsuite/gdb.mi/new-ui-mi-sync.exp @@ -40,27 +40,22 @@ proc do_test {sync_command} { global gdb_spawn_id gdb_main_spawn_id mi_spawn_id inferior_spawn_id global gdb_prompt mi_gdb_prompt - if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} { - fail "could not start gdb" - return - } - # Start a synchronous run/continue on the MI UI. set test "send synchronous execution command" if {$sync_command == "run"} { if {[mi_run_cmd] >= 0} { pass $test } else { - return + return -1 } } else { if {[mi_runto_main] < 0} { - return + return -1 } if {[mi_send_resuming_command_raw "123-exec-continue" $test] >= 0} { pass $test } else { - return + return -1 } } @@ -107,5 +102,18 @@ proc do_test {sync_command} { } foreach_with_prefix sync-command {"run" "continue"} { - do_test ${sync-command} + if {[mi_clean_restart $binfile "separate-mi-tty"] != 0} { + fail "could not start gdb" + break + } + + set res [do_test ${sync-command}] + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit + + if { $res == -1 } { + break + } } diff --git a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp index 5981bc1ad24..effc760d6a7 100644 --- a/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp +++ b/gdb/testsuite/gdb.mi/run-with-two-mi-uis.exp @@ -59,6 +59,10 @@ proc do_test { ui_to_run } { # the expected ^running record. mi_runto_main } + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit } foreach_with_prefix ui_to_run {first second} { diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index e168a5eee45..675965fec60 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -385,21 +385,10 @@ proc_with_prefix test_setup { mode } { global mi_spawn_id global decimal global binfile - global GDBFLAGS global async set any "\[^\r\n\]*" - save_vars { GDBFLAGS } { - if { $mode == "non-stop" } { - set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""] - } - - if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } { - return -1 - } - } - if { [mi_runto_main] < 0 } { return -1 } @@ -1300,7 +1289,7 @@ proc_with_prefix test_cli_in_mi_frame { mode cli_in_mi_mode } { } } -foreach_with_prefix mode { "all-stop" "non-stop" } { +proc do_test { mode } { set test "setup done" if { [test_setup $mode] == -1 } { fail $test @@ -1331,3 +1320,25 @@ foreach_with_prefix mode { "all-stop" "non-stop" } { test_cli_in_mi_frame $mode $exec_mode } } + +foreach_with_prefix mode { "all-stop" "non-stop" } { + save_vars { GDBFLAGS } { + if { $mode == "non-stop" } { + set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop 1\""] + } + + if { [mi_clean_restart $binfile "separate-mi-tty"] != 0 } { + break + } + } + + set res [do_test $mode] + + # mi_clean_restart and gdb_finish call gdb_exit, which doesn't work for + # separate-mi-tty. Use mi_gdb_exit instead. + mi_gdb_exit + + if { $res == -1 } { + break + } +} -- 2.43.0