From patchwork Tue Jan 3 19:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 62673 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3732E3858D3C for ; Tue, 3 Jan 2023 19:22:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3732E3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672773766; bh=GJP2TzLX89o+06+f70Knb99y12BXet/8qCAtWWdwfZU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=VpbYmtoM4FrZ1W5NtjYXFo9rEGlvpq2G35vMN8Jx2qYIK631kMAIAtwAm3RlNIQ5r dFoe2TY+TDFvqmrOf5ryuPNpO91Hm1VcNMf5px9qQ2psO4y2g72+R7RAC5Gqe0koVe A+4dAhlCOfiUSz5j6snHs/vG1HjN5uoXcWve555M= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 248543858D1E for ; Tue, 3 Jan 2023 19:22:23 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 303JMH9p016127 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 3 Jan 2023 14:22:22 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 303JMH9p016127 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 54B531E112; Tue, 3 Jan 2023 14:22:17 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdb: use gdb_test_multiple in gdb_breakpoint Date: Tue, 3 Jan 2023 14:22:16 -0500 Message-Id: <20230103192216.108444-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 3 Jan 2023 19:22:17 +0000 X-Spam-Status: No, score=-3189.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When running the testsuite in a non-optimized build on a slow machine, I sometimes get: UNTESTED: gdb.gdb/selftest.exp: Cannot set breakpoint at captured_main, skipping testcase. do_self_tests, in lib/selftest-support.exp, uses `with_timeout_factor 10`, to account for the fact that reading the debug info of the gdb binary (especially in a non-optimized GDB) can take time. But then it ends up calling gdb_breakpoint, which uses gdb_expect with a hard-coded timeout of 30 seconds. Fix this by making gdb_breakpoint use gdb_test_multiple, which is a desired change anyway for this kind of simple command / expected output case. Change-Id: I9b06ce991cc584810d8cc231b2b4893980b8be75 Reviewed-By: Lancelot Six --- gdb/testsuite/lib/gdb.exp | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) base-commit: a7d5fcaf8e15820f997ba7774a8eef7ab7e2f2e3 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 135ace68d5ed..5a0cd46d8998 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -641,9 +641,8 @@ proc gdb_breakpoint { linespec args } { set test_name "gdb_breakpoint: set breakpoint at $linespec" - send_gdb "$break_command $linespec\n" # The first two regexps are what we get with -g, the third is without -g. - gdb_expect 30 { + gdb_test_multiple "$break_command $linespec" "" { -re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "$break_message \[0-9\]* at .*$gdb_prompt $" {} @@ -659,35 +658,6 @@ proc gdb_breakpoint { linespec args } { send_gdb "$pending_response\n" exp_continue } - -re "A problem internal to GDB has been detected" { - if { $print_fail } { - fail "$test_name (GDB internal error)" - } - gdb_internal_error_resync - return 0 - } - -re "$gdb_prompt $" { - if { $print_fail } { - fail $test_name - } - return 0 - } - eof { - perror "GDB process no longer exists" - global gdb_spawn_id - set wait_status [wait -i $gdb_spawn_id] - verbose -log "GDB process exited with wait status $wait_status" - if { $print_fail } { - fail "$test_name (eof)" - } - return 0 - } - timeout { - if { $print_fail } { - fail "$test_name (timeout)" - } - return 0 - } } if { $print_pass } { pass $test_name