From patchwork Fri Mar 31 20:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 67161 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 0C6C43854153 for ; Fri, 31 Mar 2023 20:21:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C6C43854153 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680294091; bh=fB6FX65MCw1gE9d+pANE15RE+D2Jw5QI8r6BUXoDCfM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xEt1HSkUBpPLWyTaGmz8yzWjJNzRHKk84sshuGNCAbx7XgnxigD9f1qCia04+s+xR N5tT51dMjv9S1RRXmyeGcVO+9259xt3Me7zt8/UAN0rqwa9EZGtb6Mx8RMHH7Tpd5X rvKOwqvn3wpafvSDvV6lz/y4mep7drAfH4TgNPvo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E3AF6385843A for ; Fri, 31 Mar 2023 20:21:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3AF6385843A Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-12-MgiY0nraNoqqI4Rv72oRug-1; Fri, 31 Mar 2023 16:21:04 -0400 X-MC-Unique: MgiY0nraNoqqI4Rv72oRug-1 Received: by mail-wm1-f70.google.com with SMTP id i4-20020a05600c354400b003ef649aa8c7so10207351wmq.6 for ; Fri, 31 Mar 2023 13:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294063; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fB6FX65MCw1gE9d+pANE15RE+D2Jw5QI8r6BUXoDCfM=; b=zhD4P6EzuW2uUXXYCcLV9pvgOoinYsC/W6JYZtWsGX16vezo3mW/CNji2MLSGttZbJ i9BYxzSOKVE+2WgKPJeA7Gp3VfOINu4vSrUR4DpBANQoxbA+bE+Vf5tkZk/7E+3C57cy 37fqHz54kvnt/vC5GKr7zIuI5pSGGJ5gaKqIXQolPXacYuJHE+Ba6xI4jQYgRmHBzvv1 BH2ypwdCjCSSAEa1AMYJMQT+zHIPdJzhddxjHZGzKWFm6kRGqPIbBW/FnHWJKRITp/Yw htsufTaD3lWnMGm8c3MejCwD0bvu4nMtq50L4sd6/qKEJCHtwRhUaUvwEweQiogzFoZS NHMg== X-Gm-Message-State: AAQBX9cpPvD2rrECzoGAfp7szdu2nYLMvGPlyMtGFmwdCYefpG8zrzld Ct+fiSfCtm6v4IbcgS5+nCCKWV1+pC/zhavI6x7Y1AKSqOUBrUHZxVX6HagXp8utGTrUd76An+R kM8gvl4/8Jb3QUKqxj/2YpIruMxNpDfRoqYt8k1m2HKhHKt2Bxx/Fw9YjiGIzRtVd/VqTxPkE/N yEGHjRSg== X-Received: by 2002:adf:d842:0:b0:2ce:a890:7371 with SMTP id k2-20020adfd842000000b002cea8907371mr21322585wrl.12.1680294062865; Fri, 31 Mar 2023 13:21:02 -0700 (PDT) X-Google-Smtp-Source: AKy350aC27TBUJ6l9hO80/404Q5C0NKMaFpWh2v65AjfnfBT47067GPfvdhbVcl9SVi2FwXRjK6SWg== X-Received: by 2002:adf:d842:0:b0:2ce:a890:7371 with SMTP id k2-20020adfd842000000b002cea8907371mr21322573wrl.12.1680294062468; Fri, 31 Mar 2023 13:21:02 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id h14-20020adffd4e000000b002c71a32394dsm2988116wrs.64.2023.03.31.13.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:02 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/5] gdb/testsuite: fix occasional failure in gdb.base/clear_non_user_bp.exp Date: Fri, 31 Mar 2023 21:20:54 +0100 Message-Id: <62e7b6208a24dea949d901aa1945a87e8683478e.1680293848.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I noticed that the gdb.base/clear_non_user_bp.exp test would sometime fail when run from a particular directory. The test tries to find the number of the first internal breakpoint using this proc: proc get_first_maint_bp_num { } { gdb_test_multiple "maint info break" "find first internal bp num" { -re -wrap "(-\[0-9\]).*" { return $expect_out(1,string) } } return "" } The problem is, at the time we issue 'maint info break' there are both internal breakpoint and non-internal (user created) breakpoints in place. The user created breakpoints include the path to the source file. Sometimes, I'll be working from a directory that includes a number, like '/tmp/blah-1/gdb/etc', in which case the pattern above actually matches the '-1' from 'blah-1'. In this case there's no significant problem as it turns out that -1 is the number of the first internal breakpoint. Sometimes my directory name might be '/tmp/blah-4/gdb/etc', in which case the above pattern patches '-4' from 'blah-4'. It turns out this is also not a problem -- the test doesn't actually need the first internal breakpoint number, it just needs the number of any internal breakpoint. But sometimes my directory name might be '/tmp/blah-0/gdb/etc', in which case the pattern above matches '-0' from 'blah-0', and in this case the test fails - there is no internal breakpoint '-0'. Fix this by spotting that the internal breakpoint numbers always occur after a '\r\n', and that they never start with a 0. Our pattern becomes: -re -wrap "\r\n(-\[1-9\]\[0-9\]*).*" { return $expect_out(1,string) } After this I'm no longer seeing any failures. --- gdb/testsuite/gdb.base/clear_non_user_bp.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/clear_non_user_bp.exp b/gdb/testsuite/gdb.base/clear_non_user_bp.exp index 10e6efddc14..dc1557695bd 100644 --- a/gdb/testsuite/gdb.base/clear_non_user_bp.exp +++ b/gdb/testsuite/gdb.base/clear_non_user_bp.exp @@ -30,7 +30,7 @@ # proc get_first_maint_bp_num { } { gdb_test_multiple "maint info break" "find first internal bp num" { - -re -wrap "(-\[0-9\]).*" { + -re -wrap "\r\n(-\[1-9\]\[0-9\]*).*" { return $expect_out(1,string) } } From patchwork Fri Mar 31 20:20:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 67163 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 EFAF0385E004 for ; Fri, 31 Mar 2023 20:22:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFAF0385E004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680294123; bh=hEBeEpnkTekLZx8VA5n2Ipezf0mceywacuDV6up3HvE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=rI/ppjXBhfp6ITUrZB4Vo+09WaPSRnc8qmi9yc9kYYiyN8UkU8ItgWnMp73U9jAez O/+YB3hI3if3GZGoBXMbc7AaAOvneCnfDG8brjJQQBX1DSpGzT3x/ZxvLfwN7JlnCe YZbpl+FQJ54SrhqVareHMU4OF/PCeiqULORmCy3g= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 13BA63858288 for ; Fri, 31 Mar 2023 20:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13BA63858288 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-3YXjkXWCOUKfiAt7RHVRaw-1; Fri, 31 Mar 2023 16:21:06 -0400 X-MC-Unique: 3YXjkXWCOUKfiAt7RHVRaw-1 Received: by mail-wm1-f69.google.com with SMTP id e5-20020a05600c4e4500b003edc5824521so12582640wmq.0 for ; Fri, 31 Mar 2023 13:21:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hEBeEpnkTekLZx8VA5n2Ipezf0mceywacuDV6up3HvE=; b=GRNb/X9cAdNmw8KnaGnxaKxvFFLHWVHROxU3XT93s8YXKOBzFnak8WQkI37om8qCoU 4m3OA7zjbmw64vp3hYBtOiKZHH+DT2u+3Mu5BXNmWyG+anCRyURLcY2nhIJgnnQy6aWC qvn6zHjUF7JyGHeA4QG5A3B+WN7wUpaPOTITrXg3Vw5ZCGXgls6nkkqtVsMHtKpiRTA7 5IJy+Xsl2JZx6hiWz8acdBh9auVcIq3j9pHPUdw/92R2Vw4vSuD1Tw1pPYte2V59veqx GqtOXTHrl0iY7cibTY+7tRnzpHahc3KgSRLXqKIXXoA/b8Y02/hmzF8pYBB0ePAmkmU/ Fgig== X-Gm-Message-State: AO0yUKV5jRTvO4w/fZx4MSk36GyZmLx3zYjKyAsDilC4pToD/ZYSaShN 0M2C+LKrKmi426M1F6BnGHBsj5sB2lyPB6B2Ethw9UKMTqAw0rZG//caKVWBYrgcugKo7k055ry 7mZHxWznTBBySb3FzSgP55S2LCIy5ESYFS2AqcZh+ergzQwpbqgQJZ6eWTWA/oUzUWkuhl4syt5 afeTIhfw== X-Received: by 2002:a1c:7510:0:b0:3ee:1239:1ba7 with SMTP id o16-20020a1c7510000000b003ee12391ba7mr21273075wmc.27.1680294064159; Fri, 31 Mar 2023 13:21:04 -0700 (PDT) X-Google-Smtp-Source: AK7set+j5+dx9xOgLgAgyP+5mTwKx7I0GEIhVmcxuFQTp8qisIb5Bdc1qrZ/RjVfVZ0Vggbl+n1UTQ== X-Received: by 2002:a1c:7510:0:b0:3ee:1239:1ba7 with SMTP id o16-20020a1c7510000000b003ee12391ba7mr21273063wmc.27.1680294063782; Fri, 31 Mar 2023 13:21:03 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id z7-20020a7bc7c7000000b003ed1f111fdesm3733295wmk.20.2023.03.31.13.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:03 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/5] gdb: remove some trailing newlines from warning messages Date: Fri, 31 Mar 2023 21:20:55 +0100 Message-Id: <665671fabbb2fe3ce05578c0ce26ce7fe3d7f513.1680293848.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" While working on a later patch in this series, which tightens up some of our pattern matching when using gdb_test, I ran into some failures caused by some warnings having a trailing newline character. The warning function already adds a trailing newline, and it is my understanding that we should not be adding a second by including a newline at the end of any warning message. The problem cases I found were in language.c and remote.c, in this patch I fix these cases, and also audited all the warning() calls in these two files and fixed any additional problems I found. In remote.c the warning actually had a newline character in the middle of the warning message (in addition to the trailing newline), which I've removed. I don't think it's helpful to forcibly split a warning as was done here -- in the middle of a sentence. Additionally, the message isn't even that long (71 characters), so I think removing this newline is an improvement. None of the expected test result need updating with this commit, currently the patterns in gdb_test will match one or more newline sequences, so the tests are as happy with one newline (after this commit) as they are with two newlines (before this commit). A later commit will change gdb_test so that it is not so forgiving, and these warnings would have caused some failures. --- gdb/language.c | 8 ++++---- gdb/remote.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gdb/language.c b/gdb/language.c index 50a53c647f5..b7beb112702 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -229,7 +229,7 @@ show_range_command (struct ui_file *file, int from_tty, || ((range_check == range_check_on) != current_language->range_checking_on_by_default ())) warning (_("the current range check setting " - "does not match the language.\n")); + "does not match the language.")); } /* Set command. Change the setting for range checking. */ @@ -266,7 +266,7 @@ set_range_command (const char *ignore, || ((range_check == range_check_on) != current_language->range_checking_on_by_default ())) warning (_("the current range check setting " - "does not match the language.\n")); + "does not match the language.")); } /* Show command. Display a warning if the case sensitivity setting does @@ -303,7 +303,7 @@ show_case_command (struct ui_file *file, int from_tty, if (case_sensitivity != current_language->case_sensitivity ()) warning (_("the current case sensitivity setting does not match " - "the language.\n")); + "the language.")); } /* Set command. Change the setting for case sensitivity. */ @@ -335,7 +335,7 @@ set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c) if (case_sensitivity != current_language->case_sensitivity ()) warning (_("the current case sensitivity setting does not match " - "the language.\n")); + "the language.")); } /* Set the status of range and type checking and case sensitivity based on diff --git a/gdb/remote.c b/gdb/remote.c index 526df313ea7..f436b8714cf 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11250,8 +11250,8 @@ compare_sections_command (const char *args, int from_tty) } } if (mismatched > 0) - warning (_("One or more sections of the target image does not match\n\ -the loaded file\n")); + warning (_("One or more sections of the target image does " + "not match the loaded file")); if (args && !matched) gdb_printf (_("No loaded section named '%s'.\n"), args); } From patchwork Fri Mar 31 20:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 67162 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 BACB6385480B for ; Fri, 31 Mar 2023 20:21:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BACB6385480B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680294099; bh=tBJWbfQmfSEpztAybzNh5OB3uGQzS3PrNsgkcAGu9M8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=sPCjS5PFjv+XDAgx7oyT/7lVhfyTegLuWqTQaFwYPOXjErU0/qb4uzYIuHxxqiAPR AOEo2aSikBPZb3T8nzUYskrLSD6kLLKFrRTeCmboAIRcnc8W1d1VdfDluNOgMutTkG kCR5cXYH40NP7v7wUdv2AROK2j23piejHD97l8gM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B8FE6385800A for ; Fri, 31 Mar 2023 20:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8FE6385800A Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-F1DsVDoTPXevlYGKvWEhSw-1; Fri, 31 Mar 2023 16:21:07 -0400 X-MC-Unique: F1DsVDoTPXevlYGKvWEhSw-1 Received: by mail-wm1-f71.google.com with SMTP id r11-20020a05600c458b00b003eea8d25f06so11818327wmo.1 for ; Fri, 31 Mar 2023 13:21:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tBJWbfQmfSEpztAybzNh5OB3uGQzS3PrNsgkcAGu9M8=; b=lcasXfL5GJC01udxXn2bkki7+TCDrOgn4Fciw/iy2MKOyqoO/etFkqENX5eFSSQAFX L5VoRlWaRSgzx6iPZJQSHxRzzwMpTx8atLN3uYNhsOTCLBWEH1QkKnj5tNQU2eQ1TQ/P e2grJunlBpQ04De+FsLUWWXztUpcBUK9brzHUQiFuEIG+djdd+ssmUQYJ5hf21VLCPq+ fHxo+Qmtcmj1MMKRPYLgpfxXLvBev+ASGaMPM64kgE1Qlt8lbnkMBiEDvkwr0SLN1mCk 14yQNY0VP5CjAeGN+pTAvR9upLAHWT8BN0SH0QWeOEWPXCpYb18+kI8kl25UHf5lh+PW Sbxg== X-Gm-Message-State: AO0yUKU14jigSI6QcCziasL1gbV1ckf3WploCArEQQ57rAxnbO8AV7ww iztqA/51w1CjVlN75C+4gPWTbKwRC8m9Tsv/EGpwuGrVMgeFYfzRukYs2vPvLiPRt2+oechsBFI UodTuNdruDeKGmajWF3YjOfXfYrh4mkJziLc0im/w0vqm4J4wDhOGInR58dGMvcC5U2IyC6HiFW mzbmvPng== X-Received: by 2002:a1c:7c19:0:b0:3ed:a583:192a with SMTP id x25-20020a1c7c19000000b003eda583192amr20858845wmc.9.1680294065618; Fri, 31 Mar 2023 13:21:05 -0700 (PDT) X-Google-Smtp-Source: AK7set+SaOmPphu9ITLGkQrZL6K1lS21EmnUFqnsjz/cvym6iFQ1iAm8iNysWRIuY/gEU0V5QAH4Aw== X-Received: by 2002:a1c:7c19:0:b0:3ed:a583:192a with SMTP id x25-20020a1c7c19000000b003eda583192amr20858831wmc.9.1680294065219; Fri, 31 Mar 2023 13:21:05 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id iw13-20020a05600c54cd00b003ef6988e54csm10618994wmb.15.2023.03.31.13.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:04 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 3/5] gdb/testsuite: use 'return' in gdb_test_no_output Date: Fri, 31 Mar 2023 21:20:56 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" A TCL proc will return the return value of the last command executed within the proc's body if there is no explicit return call, so gdb_test_no_output is already returning the return value of gdb_test_multiple. However, I'm not a fan of this implicit return value behaviour, so in this commit I have extended the comment on gdb_test_no_output to document the possible return values (just as gdb_test does), and explicitly call return. This should make no different to our testing, but I think it's clearer now what the gdb_test_no_output proc is expected to do. The two tests gdb.base/auxv.exp and gdb.base/list.exp both rely on the return value of gdb_test_no_output, and continue to pass after this change. I also spotted that gdb.base/watchpoint.exp could be updated to make use of gdb_test_no_output, so I did that. --- gdb/testsuite/gdb.base/watchpoint.exp | 17 ++++++++++------- gdb/testsuite/lib/gdb.exp | 9 +++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 513964ebf86..7f821ee8a11 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -80,7 +80,7 @@ proc initialize {} { # to use it. This allows the test program to run at full speed until # we get to the first marker function. - if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { + if [gdb_test_no_output "disable 3" "disable watchpoint" ] { return 0 } @@ -99,7 +99,8 @@ proc test_simple_watchpoint {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint in test_simple_watchpoint" ] { return 0 } @@ -120,7 +121,7 @@ proc test_simple_watchpoint {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { + if [gdb_test_no_output "enable 3" "enable watchpoint" ] { return } @@ -187,7 +188,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count # Disable the watchpoint so we run at full speed until we exit. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { + if [gdb_test_no_output "disable 3" "watchpoint disabled" ] { return } @@ -212,7 +213,8 @@ proc test_disabling_watchpoints {} { # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint in test_disabling_watchpoints" ] { return 0 } @@ -234,7 +236,7 @@ proc test_disabling_watchpoints {} { # After reaching the marker function, enable the watchpoint. - if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { + if [gdb_test_no_output "enable 3" "watchpoint enabled" ] { return } @@ -249,7 +251,8 @@ proc test_disabling_watchpoints {} { # Disable the watchpoint but leave breakpoints - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] { + if [gdb_test_no_output "disable 3" \ + "disable watchpoint #2 in test_disabling_watchpoints" ] { return 0 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8b85618abcd..626841a4f0a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1520,6 +1520,11 @@ if { [tcl_version_at_least 8 5] == 0 } { # # See gdb_test for a description of the -prompt, -no-prompt-anchor, -nopass, # COMMAND, and MESSAGE parameters. +# +# Returns: +# 1 if the test failed, +# 0 if the test passes, +# -1 if there was an internal error. proc gdb_test_no_output { args } { global gdb_prompt @@ -1535,13 +1540,13 @@ proc gdb_test_no_output { args } { set prompt [fill_in_default_prompt $prompt [expr !${no-prompt-anchor}]] set command_regex [string_to_regexp $command] - gdb_test_multiple $command $message -prompt $prompt { + return [gdb_test_multiple $command $message -prompt $prompt { -re "^$command_regex\r\n$prompt" { if {!$nopass} { pass $gdb_test_name } } - } + }] } # Send a command and then wait for a sequence of outputs. From patchwork Fri Mar 31 20:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 67165 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 99CE83858404 for ; Fri, 31 Mar 2023 20:22:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99CE83858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680294156; bh=Q/bavMa1ao5WCwIjwPmez2DO9nrWyBoqCGEMulppQO4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=j1aU/yJ0mGMfTzl2qVgcIuMJKFxqSP7YPHu1djXVIHWbKOiw693WNn/rgVeMQ2xUo s7tHo1zlROHQwj5AFBP6+cg5/Xjwn5UaAx39YclW8UBvMwlOMd7iMWFtGenucaQzRu JlBEeVIz0mQss48JqNFUgRNnrbZc8scDski2bLTk= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 37CB23858298 for ; Fri, 31 Mar 2023 20:21:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37CB23858298 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-9Ybi2w2PMcStLblrvwKi2A-1; Fri, 31 Mar 2023 16:21:10 -0400 X-MC-Unique: 9Ybi2w2PMcStLblrvwKi2A-1 Received: by mail-wm1-f70.google.com with SMTP id o28-20020a05600c511c00b003ef69894934so8626875wms.6 for ; Fri, 31 Mar 2023 13:21:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q/bavMa1ao5WCwIjwPmez2DO9nrWyBoqCGEMulppQO4=; b=iD3lBUdBeHW59MdCqRJhbiuVl6P55M4OaIileUy4ds/LLtJje5Xh7jNY1fR7Dsg9gk o9j5PTAWy/llJoFgHgsNiBSxPriObiUTExKI8CgqqRcfGOZbwsw1Sr43Qn/lnrkY1r0h RmTI+38TXxI9L88KSYno4fP9AIOj1qxnIabs3U/tqydC5M0sCoSeULzocKIpUMZz9Czz FDXrz9jIZOoQ37zM7hHxIuz66z17Y/vUb3f2npsHLEUbEuzL7MLnNfoAwQYVLyOBct9m Xz76KaR3ZjgVDYQzMgl6vrfp11ZodjgwtEz54hdPcC0BojzhbrDz+gHDyzr83vwi7WW6 5S0Q== X-Gm-Message-State: AO0yUKWKxYbO3CGzmlqA/Sx/kXdgYxgK6vqZE8usx9tMBy6besYmdStr 0jUqafWAHGgIzwBwqCU05cUIVzRKgsuGeHwCzQa+Ea3TDn35w9jHFc5D4+h+9RC5phC74JVxn3V w1ugU+Yciljicp1pkd1pToE7qd3EmYKgb9qgPE1/d4Lt2V+B4qG/mTAEji0islJLUGQMmNjMh0i GPBy+xFw== X-Received: by 2002:a1c:4c0d:0:b0:3ef:4138:9eef with SMTP id z13-20020a1c4c0d000000b003ef41389eefmr23310796wmf.36.1680294068136; Fri, 31 Mar 2023 13:21:08 -0700 (PDT) X-Google-Smtp-Source: AK7set8JcTzfDUGRhjDijigpBG/ij9Hq+hjcKF6RbR34emiiNPJjHF8RHonbNylc4vWQCFf2tPKIqA== X-Received: by 2002:a1c:4c0d:0:b0:3ef:4138:9eef with SMTP id z13-20020a1c4c0d000000b003ef41389eefmr23310757wmf.36.1680294066926; Fri, 31 Mar 2023 13:21:06 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id c1-20020a05600c0a4100b003ee5fa61f45sm11484578wmq.3.2023.03.31.13.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:06 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 4/5] gdb/testsuite: change newline patterns used in gdb_test Date: Fri, 31 Mar 2023 21:20:57 +0100 Message-Id: <464e64e3a3483c228f0a73c778bcaf79e4595abd.1680293848.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This commit makes two changes to how we match newline characters in the gdb_test proc. First, for the newline pattern between the command output and the prompt, I propose changing from '[\r\n]+' to an explicit '\r\n'. The old pattern would spot multiple newlines, and so there are a few places where, as part of this commit, I've needed to add an extra trailing '\r\n' to the pattern in the main test file, where GDB's output actually includes a blank line. But I think this is a good thing. If a command produces a blank line then we should be checking for it, the current test doesn't. Additionally, the existing pattern will happily match a partial newline. There are a strangely large number of tests that end with a random '.' character. Not matching a literal period, but matching any single character, this is then matching half of the trailing newline sequence, while the \[\r\n\]+ in gdb_test is matching the other half of the sequence. I can think of no reason why this would be intentional. All of these are cleaned up after this commit. The basic rule of gdb_test after this is that the expected pattern needs to match everything up to, but not including the newline sequence immediately before the GDB prompt. Second, while I was cleaning up newline matching in gdb_test, I've also removed the '[\r\n]*' that was added to the start of the pattern passed to gdb_test_multiple. The addition of this pattern adds no value. If the user pattern matches at the start of a line then this would match against the newline sequence. But, due to the '*', if the user pattern doesn't match at the start of a line then this group doesn't care, it'll happily match nothing. As such, there's no value to it, it just adds more complexity for no gain, so I'm removing it. No tests will need updating as a consequence of this part of the patch. Reviewed-by: Tom de Vries --- gdb/testsuite/gdb.ada/varsize_limit.exp | 2 +- gdb/testsuite/gdb.base/call-rt-st.exp | 2 +- gdb/testsuite/gdb.base/charset.exp | 4 +- gdb/testsuite/gdb.base/default.exp | 4 +- gdb/testsuite/gdb.base/display.exp | 10 +- gdb/testsuite/gdb.base/foll-fork.exp | 2 +- gdb/testsuite/gdb.base/info-macros.exp | 12 +- gdb/testsuite/gdb.base/pc-fp.exp | 2 +- gdb/testsuite/gdb.base/pending.exp | 2 +- gdb/testsuite/gdb.base/rtld-step.exp | 4 +- gdb/testsuite/gdb.base/setshow.exp | 4 +- gdb/testsuite/gdb.base/until.exp | 2 +- gdb/testsuite/gdb.base/watch-bitfields.exp | 4 +- .../gdb.base/wrong_frame_bt_full.exp | 4 +- gdb/testsuite/gdb.btrace/buffer-size.exp | 4 +- .../gdb.btrace/function_call_history.exp | 2 +- .../gdb.btrace/instruction_history.exp | 10 +- gdb/testsuite/gdb.btrace/record_goto.exp | 8 +- .../gdb.cp/incomplete-type-overload.exp | 2 +- gdb/testsuite/gdb.cp/maint.exp | 8 +- gdb/testsuite/gdb.cp/ovldbreak.exp | 14 +-- gdb/testsuite/gdb.cp/userdef.exp | 20 ++-- gdb/testsuite/gdb.cp/virtfunc.exp | 23 +++- gdb/testsuite/gdb.guile/scm-breakpoint.exp | 2 +- gdb/testsuite/gdb.guile/scm-cmd.exp | 2 +- gdb/testsuite/gdb.opt/inline-break.exp | 6 +- gdb/testsuite/gdb.python/py-breakpoint.exp | 6 +- .../gdb.reverse/machinestate-precsave.exp | 60 +++++----- gdb/testsuite/gdb.reverse/machinestate.exp | 60 +++++----- gdb/testsuite/gdb.stabs/exclfwd.exp | 4 +- .../gdb.threads/foll-fork-other-thread.exp | 2 +- gdb/testsuite/gdb.threads/gcore-thread.exp | 4 +- gdb/testsuite/gdb.trace/actions.exp | 109 +++++++++--------- gdb/testsuite/gdb.trace/deltrace.exp | 73 ++++++------ gdb/testsuite/gdb.trace/infotrace.exp | 6 +- gdb/testsuite/gdb.trace/passcount.exp | 8 +- gdb/testsuite/gdb.trace/tracecmd.exp | 8 +- gdb/testsuite/gdb.trace/while-stepping.exp | 2 +- gdb/testsuite/lib/gdb.exp | 4 +- 39 files changed, 264 insertions(+), 241 deletions(-) diff --git a/gdb/testsuite/gdb.ada/varsize_limit.exp b/gdb/testsuite/gdb.ada/varsize_limit.exp index ceb0c8594a7..64f2e3fa289 100644 --- a/gdb/testsuite/gdb.ada/varsize_limit.exp +++ b/gdb/testsuite/gdb.ada/varsize_limit.exp @@ -31,7 +31,7 @@ if {![runto "vsizelim.adb:$bp_location"]} { } gdb_test "set varsize-limit 16" \ - "Warning: command 'set varsize-limit' is deprecated.\r\nUse 'set max-value-size'." + "Warning: command 'set varsize-limit' is deprecated.\r\nUse 'set max-value-size'\\.\r\n" gdb_test "print small" " = \"1234567890\"" diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 63db4c56d57..d9c9abe604f 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -56,7 +56,7 @@ gdb_test "break loop_count" \ "breakpoint loop_count" gdb_test "continue" \ - "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:$stop_line\[ \t\r\n\]+$stop_line\[\t \]+for \\(index=0; index.4; index..\\);.*\[\r\n \]+" \ + "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:$stop_line\[ \t\r\n\]+$stop_line\[\t \]+for \\(index=0; index.4; index..\\);.*" \ "continue to loop_count" gdb_test_multiple "finish" "finish out from loop count" { diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp index 1387e171882..34b4c7134b9 100644 --- a/gdb/testsuite/gdb.base/charset.exp +++ b/gdb/testsuite/gdb.base/charset.exp @@ -496,8 +496,8 @@ gdb_test_no_output "set target-charset UTF-8" gdb_test "print \"\\242\"" " = \"\\\\242\"" \ "non-representable target character" -gdb_test "print '\\x'" "\\\\x escape without a following hex digit." -gdb_test "print '\\u'" "\\\\u escape without a following hex digit." +gdb_test "print '\\x'" "\\\\x escape without a following hex digit" +gdb_test "print '\\u'" "\\\\u escape without a following hex digit" gdb_test "print '\\9'" " = \[0-9\]+ '9'" # An octal escape can only be 3 digits. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 7e73db0576a..3c5e8b7598d 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -386,8 +386,8 @@ gdb_test "overlay list" "No sections are mapped." gdb_test "overlay map" "Overlay debugging not enabled.*" "overlay map #1" gdb_test "overlay unmap" "Overlay debugging not enabled.*" "overlay unmap #1" gdb_test_no_output "overlay manual" "overlay manual #2" -gdb_test "overlay map" "Argument required: name of an overlay section." "overlay map #2" -gdb_test "overlay unmap" "Argument required: name of an overlay section." "overlay unmap #2" +gdb_test "overlay map" "Argument required: name of an overlay section" "overlay map #2" +gdb_test "overlay unmap" "Argument required: name of an overlay section" "overlay unmap #2" #test print "p" abbreviation gdb_test "p" "The history is empty." "print \"p\" abbreviation" diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp index 79ef4d894e8..6978aedff43 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -191,11 +191,11 @@ gdb_test "printf \"%p\\n\", 1" "0x1" # play with "print", too # gdb_test "print/k j" ".*Undefined output format.*" -gdb_test "print/d j" " = 0\[\\r\\n\]+" "debug test output 1" -gdb_test "print/r j" " = 0\[\\r\\n\]+" "debug test output 1a" -gdb_test "print/x j" " = 0x0\[\\r\\n\]+" "debug test output 2" -gdb_test "print/r j" " = 0x0\[\\r\\n\]+" "debug test output 2a" -gdb_test "print j" " = 0\[\\r\\n\]+" "debug test output 3" +gdb_test "print/d j" " = 0" "debug test output 1" +gdb_test "print/r j" " = 0" "debug test output 1a" +gdb_test "print/x j" " = 0x0" "debug test output 2" +gdb_test "print/r j" " = 0x0" "debug test output 2a" +gdb_test "print j" " = 0" "debug test output 3" # x/0 j doesn't produce any output and terminates PA64 process when testing gdb_test_no_output "x/0 j" diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp index df5dab056c2..b0ba156e3db 100644 --- a/gdb/testsuite/gdb.base/foll-fork.exp +++ b/gdb/testsuite/gdb.base/foll-fork.exp @@ -234,7 +234,7 @@ proc_with_prefix catch_fork_child_follow {second_inferior} { # Verify that the catchpoint is mentioned in an "info breakpoints", # and further that the catchpoint mentions no process id. gdb_test "info breakpoints" \ - ".*catchpoint.*keep y.*fork\[\r\n\]+" \ + ".*catchpoint.*keep y.*fork" \ "info breakpoints before fork" gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp index 38eb35f1df8..fd4a99c9794 100644 --- a/gdb/testsuite/gdb.base/info-macros.exp +++ b/gdb/testsuite/gdb.base/info-macros.exp @@ -33,22 +33,22 @@ gdb_test "info macro -- -all" \ "The symbol `-all' has no definition .*\r\nat .*$srcfile:\[0-9\]+" gdb_test "info macro -all --" \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" gdb_test "info macro -all --" \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" gdb_test "info macro -all --" \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" gdb_test "info macro --" \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" gdb_test "info macro -- " \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" \ + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" \ "info macro -- " gdb_test "info macro -- " \ - "You must follow.*with the name.*you want to see.*\[^\r\n\]*\[\r\n\]" \ + "You must follow.*with the name.*you want to see.*\[^\r\n\]*" \ "info macro -- " gdb_test "info macro -invalid-option" \ diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp index e7ebd3804cb..466a6d62395 100644 --- a/gdb/testsuite/gdb.base/pc-fp.exp +++ b/gdb/testsuite/gdb.base/pc-fp.exp @@ -53,4 +53,4 @@ gdb_test "info register \$fp" "${valueof_fp}.*" # Regression test for # http://sourceware.org/bugzilla/show_bug.cgi?id=12659 gdb_test "info register pc fp" \ - "pc +${valueof_pc}\[ \t\]+${valueof_pc} <.*>\[\r\n\]+fp +${valueof_fp}\[ \t\]+${valueof_fp}\[\r\n\]+" + "pc +${valueof_pc}\[ \t\]+${valueof_pc} <.*>\[\r\n\]+fp +${valueof_fp}\[ \t\]+${valueof_fp}" diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp index be54fb1ce08..d7d3735000a 100644 --- a/gdb/testsuite/gdb.base/pending.exp +++ b/gdb/testsuite/gdb.base/pending.exp @@ -225,7 +225,7 @@ gdb_test "continue" \ gdb_test "continue" \ ".*Breakpoint.*pendfunc1.*at.*pendshr.c:$bp2_loc.* -\[$\]1 = 1." \ +\\\$1 = 1" \ "continue to resolved breakpoint 1" # diff --git a/gdb/testsuite/gdb.base/rtld-step.exp b/gdb/testsuite/gdb.base/rtld-step.exp index f2cf0b14996..9a6c76d191a 100644 --- a/gdb/testsuite/gdb.base/rtld-step.exp +++ b/gdb/testsuite/gdb.base/rtld-step.exp @@ -140,7 +140,7 @@ gdb_test "step" {baz \(.*?\);} "step into foo 1" gdb_test "finish" {Run till exit.*bar \(\).*baz.*} "finish out of foo 1" gdb_test "next" {foo \(2\);} "next over baz in bar" gdb_test "step" {baz \(.*?\);} "step into foo 2" -gdb_test "next" "\}\[\r\n\]+" "next over baz in foo" -gdb_test "step" "bar \\(\\).*}\[\r\n\]+.*" "step out of foo back into bar" +gdb_test "next" "\}" "next over baz in foo" +gdb_test "step" "bar \\(\\).*}" "step out of foo back into bar" gdb_continue_to_end diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 86821ca1db0..8c160aa560e 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -297,10 +297,10 @@ proc_with_prefix test_setshow_history {} { "The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \ "show history filename (~/foobar.baz)" gdb_test "p \$_gdb_setting(\"history filename\")" \ - " = \"[string_to_regexp $HOME]/foobar.baz\"..*" \ + " = \"[string_to_regexp $HOME]/foobar.baz\"" \ "_gdb_setting history filename" gdb_test "p \$_gdb_setting_str(\"history filename\")" \ - " = \"[string_to_regexp $HOME]/foobar.baz\"..*" \ + " = \"[string_to_regexp $HOME]/foobar.baz\"" \ "_gdb_setting_str history filename" #get current working directory diff --git a/gdb/testsuite/gdb.base/until.exp b/gdb/testsuite/gdb.base/until.exp index e1a1765ec2e..4a1a07dae7a 100644 --- a/gdb/testsuite/gdb.base/until.exp +++ b/gdb/testsuite/gdb.base/until.exp @@ -39,7 +39,7 @@ gdb_test "until $bp_location1" \ # Verify that a malformed "advance" is gracefully caught. # gdb_test "until 80 then stop" \ - "malformed linespec error: unexpected string, \"then stop\"." \ + "malformed linespec error: unexpected string, \"then stop\"" \ "malformed until" # Rerun up to factorial, outer invocation diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp index ce2aee2ac18..95573caa7dd 100644 --- a/gdb/testsuite/gdb.base/watch-bitfields.exp +++ b/gdb/testsuite/gdb.base/watch-bitfields.exp @@ -44,9 +44,9 @@ proc watch { expr } { proc expect_watchpoint { expr old new } { with_test_prefix "$expr: $old->$new" { set expr_re [string_to_regexp $expr] - gdb_test "print $expr" "\\$\\d+ = $old\\s" "print expression before" + gdb_test "print $expr" "\\$\\d+ = $old" "print expression before" gdb_test "continue" "$expr_re\\s.*Old value = $old\\s+New value = $new\\s.*" - gdb_test "print $expr" "\\$\\d+ = $new\\s" "print expression after" + gdb_test "print $expr" "\\$\\d+ = $new" "print expression after" } } diff --git a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp index 2ab0133cfe6..5321cdcbac6 100644 --- a/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp +++ b/gdb/testsuite/gdb.base/wrong_frame_bt_full.exp @@ -51,6 +51,4 @@ if ![runto opaque_routine] { # correctly when frame #0 (the frame which does not have any debugging # info) is the selected frame. -gdb_test "bt full" \ - ".*\[\r\n\]+ *my_table = \\{0, 1, 2\\}\[\r\n\]+.*" - +gdb_test "bt full" ".*\[\r\n\]+ *my_table = \\{0, 1, 2\\}" diff --git a/gdb/testsuite/gdb.btrace/buffer-size.exp b/gdb/testsuite/gdb.btrace/buffer-size.exp index e632ba56cf9..616c7f170e5 100644 --- a/gdb/testsuite/gdb.btrace/buffer-size.exp +++ b/gdb/testsuite/gdb.btrace/buffer-size.exp @@ -30,8 +30,8 @@ if ![runto_main] { gdb_test_no_output "set record btrace bts buffer-size 1" gdb_test_no_output "set record btrace pt buffer-size 1" -gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is 1\.\r" -gdb_test "show record btrace pt buffer-size" "The record/replay pt buffer size is 1\.\r" +gdb_test "show record btrace bts buffer-size" "The record/replay bts buffer size is 1\." +gdb_test "show record btrace pt buffer-size" "The record/replay pt buffer size is 1\." gdb_test_no_output "record btrace" gdb_test "info record" [multi_line \ diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp index e71e48fc0ca..de4cdf9783d 100644 --- a/gdb/testsuite/gdb.btrace/function_call_history.exp +++ b/gdb/testsuite/gdb.btrace/function_call_history.exp @@ -187,7 +187,7 @@ set expected_range [multi_line \ gdb_test "record function-call-history 4,10" $expected_range gdb_test "record function-call-history 4,+7" $expected_range gdb_test "record function-call-history 10,-7" $expected_range -gdb_test "record function-call-history 4,4" "4\tinc\r" +gdb_test "record function-call-history 4,4" "4\tinc" # set bp after fib recursion and continue set bp_location [gdb_get_line_number "bp.2" $testfile.c] diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp index 35b43d68434..f6c1fae720f 100644 --- a/gdb/testsuite/gdb.btrace/instruction_history.exp +++ b/gdb/testsuite/gdb.btrace/instruction_history.exp @@ -69,7 +69,7 @@ gdb_test "record instruction-history 3,7" [multi_line \ "4\t 0x\[0-9a-f\]+ :\tdec %eax" \ "5\t 0x\[0-9a-f\]+ :\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ :\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" \ + "7\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ " \ ] gdb_test "record instruction-history /f 3,+5" [multi_line \ @@ -77,7 +77,7 @@ gdb_test "record instruction-history /f 3,+5" [multi_line \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ \r" \ + "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ " \ ] gdb_test "record instruction-history /p 7,-5" [multi_line \ @@ -85,7 +85,7 @@ gdb_test "record instruction-history /p 7,-5" [multi_line \ "4\t 0x\[0-9a-f\]+ :\tdec %eax" \ "5\t 0x\[0-9a-f\]+ :\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ :\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" \ + "7\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ " \ ] gdb_test "record instruction-history /pf 3,7" [multi_line \ @@ -93,10 +93,10 @@ gdb_test "record instruction-history /pf 3,7" [multi_line \ "4\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec %eax" \ "5\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp 0x\[0-9a-f\]+ " \ "6\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp \\\$0x0,%eax" \ - "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ \r" \ + "7\t 0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje 0x\[0-9a-f\]+ " \ ] -gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ \r" +gdb_test "record instruction-history 3,3" "3\t 0x\[0-9a-f\]+ :\tje 0x\[0-9a-f\]+ " # the following tests are checking the iterators # to avoid lots of regexps, we just check the number of lines that diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index 240e18f67d6..1817ac07f51 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -149,7 +149,7 @@ gdb_test "record goto 2" ".*fun4 \\(\\) at record_goto.c:40.*" gdb_test "record function-call-history /ci -" [multi_line \ "1\tmain\tinst 1,1" \ "2\t fun4\tinst 2,4" \ - "3\t fun1\tinst 5,8\r" \ + "3\t fun1\tinst 5,8" \ ] "function-call-history from 2 backwards" # check that we're filling up the context correctly @@ -173,7 +173,7 @@ gdb_test "record function-call-history /ci" [multi_line \ gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ - "40.*\r" \ + "40.*" \ ] "instruction-history from end forwards" # we should get the exact same history from the second to last instruction @@ -183,12 +183,12 @@ gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*" gdb_test "record function-call-history /ci" [multi_line \ "14\t fun2\tinst 35,36" \ "15\t fun3\tinst 37,38" \ - "16\t fun4\tinst 39,40\r" \ + "16\t fun4\tinst 39,40" \ ] "function-call-history from 39 forwards" # check that we're filling up the context correctly gdb_test "record instruction-history" [multi_line \ "38.*" \ "39.*" \ - "40.*\r" \ + "40.*" \ ] "instruction-history from 39 forwards" diff --git a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp index 050bd98cf56..01201ecd396 100644 --- a/gdb/testsuite/gdb.cp/incomplete-type-overload.exp +++ b/gdb/testsuite/gdb.cp/incomplete-type-overload.exp @@ -172,5 +172,5 @@ gdb_test "print foo(inc)"\ "The type. 'incomplete .' isn't fully known to GDB.*"\ "unsuccessful because declaration" gdb_test "print foo(ip)"\ - "Cannot resolve function foo to any overloaded instance."\ + "Cannot resolve function foo to any overloaded instance"\ "unsuccessful because incorrect" diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp index 59dccfbb3bd..36a48e5637d 100644 --- a/gdb/testsuite/gdb.cp/maint.exp +++ b/gdb/testsuite/gdb.cp/maint.exp @@ -21,8 +21,8 @@ # Test the help messages. proc test_help {} { - set first_component_help "Print the first class/namespace component of NAME" - set namespace_help "Deprecated placeholder for removed functionality." + set first_component_help "Print the first class/namespace component of NAME\\." + set namespace_help "Deprecated placeholder for removed functionality\\." test_prefix_command_help {"maintenance cplus"} { "C\\+\\+ maintenance commands\.\[\r\n\]+" @@ -36,8 +36,8 @@ proc test_help {} { gdb_test "maint cp" $multiple_help_body - gdb_test "help maint cp first_component" "${first_component_help}." - gdb_test "help maint cp namespace" "${namespace_help}." + gdb_test "help maint cp first_component" "${first_component_help}" + gdb_test "help maint cp namespace" "${namespace_help}" } # This is used when NAME should contain only a single component. Be diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index 62e45f50d0e..fd8268a5791 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -241,11 +241,11 @@ for {set idx 0} {$idx < [llength $overloads]} {incr idx} { } # Verify the breakpoints. -set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+" -append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+" -append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+." +set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What\\s*\r\n" +append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r\n" +append bptable "\[\t \]+breakpoint already hit 1 time" foreach ovld $overloads { - append bptable [format "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \ + append bptable [format "\r\n\[0-9\]+\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d" $ovld \ $line($type_map("$ovld"))] } gdb_test "info break" $bptable "breakpoint info (after setting one-by-one)" @@ -366,12 +366,12 @@ gdb_expect { } # Create the breakpoint table for "info breakpoint". -set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What.*\[\r\n]+" -append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+.*\[\r\n\]+" +set bptable "Num\[\t \]+Type\[\t \]+Disp Enb Address\[\t \]+What\\s*\r\n" +append bptable "\[0-9\]+\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+\\s*" foreach ovld {void char signed_char unsigned_char short_int \ unsigned_short_int int unsigned_int long_int \ unsigned_long_int float double} { - append bptable [format "\[0-9\]+.\[0-9\]+\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" \ + append bptable [format "\r\n\[0-9\]+.\[0-9\]+\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d" \ $types($ovld) $line($ovld)] } diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index f04a441c54d..ac453179da2 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -67,9 +67,9 @@ gdb_test "print one / two" "\\\$\[0-9\]* = {x = 0, y = 0}" gdb_test "print one % two" "\\\$\[0-9\]* = {x = 2, y = 3}" -gdb_test "print one && two" "\\\$\[0-9\]* = 1\[\r\n\]" +gdb_test "print one && two" "\\\$\[0-9\]* = 1" -gdb_test "print one || two" "\\\$\[0-9\]* = 1\[\r\n\]" +gdb_test "print one || two" "\\\$\[0-9\]* = 1" gdb_test "print one & two" "\\\$\[0-9\]* = {x = 0, y = 1}" @@ -77,18 +77,18 @@ gdb_test "print one | two" "\\\$\[0-9\]* = {x = 6, y = 7}" gdb_test "print one ^ two" "\\\$\[0-9\]* = {x = 6, y = 6}" -gdb_test "print one < two" "\\\$\[0-9\]* = 1\[\r\n\]" +gdb_test "print one < two" "\\\$\[0-9\]* = 1" -gdb_test "print one <= two" "\\\$\[0-9\]* = 1\[\r\n\]" +gdb_test "print one <= two" "\\\$\[0-9\]* = 1" -gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]" +gdb_test "print one > two" "\\\$\[0-9\]* = 0" -gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]" +gdb_test "print one >= two" "\\\$\[0-9\]* = 0" -gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]" -gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0\[\r\n\]" +gdb_test "print one == two" "\\\$\[0-9\]* = 0" +gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0" -gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]" +gdb_test "print one != two" "\\\$\[0-9\]* = 1" # Can't really check the output of this one without knowing # target integer width. Make sure we don't try to call @@ -98,7 +98,7 @@ gdb_test "print one << 31" "\\\$\[0-9\]* = {x = -?\[0-9\]*, y = -?\[0-9\]*}" # Should be fine even on < 32-bit targets. gdb_test "print one >> 31" "\\\$\[0-9\]* = {x = 0, y = 0}" -gdb_test "print !one" "\\\$\[0-9\]* = 0\[\r\n\]" +gdb_test "print !one" "\\\$\[0-9\]* = 0" # Assumes 2's complement. So does everything... gdb_test "print +one" "\\\$\[0-9\]* = {x = 2, y = 3}" diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index 445befddf28..908c969741b 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -228,7 +228,7 @@ proc test_virtual_calls {} { proc make_one_vtable_result {name args} { global hex - set nls "\[\r\n\]+" + set nls "\r\n" set result "vtable for '${name}' @ $hex .subobject @ $hex.:$nls" set count 0 @@ -237,9 +237,20 @@ proc make_one_vtable_result {name args} { incr count } + # Remove the last instance of $nls. + if {$count > 0} { + set result [string range $result 0 end-[string length $nls]] + } + + verbose -log "APB: result: '$result'" + return $result } +proc vtable_seq { args } { + return [join "\r\n\r\n" $args] +} + # Test "info vtbl". proc test_info_vtbl {} { @@ -255,12 +266,12 @@ proc test_info_vtbl {} { set vt_D2 [make_one_vtable_result D "non-virtual thunk to E::vg" D::vd] set vt_E [make_one_vtable_result E E::f E::vg E::vv] - gdb_test "info vtbl a" "${vt_A}${vt_V}" - gdb_test "info vtbl b" "${vt_B}${vt_V}" + gdb_test "info vtbl a" [vtable_seq ${vt_A} ${vt_V}] + gdb_test "info vtbl b" [vtable_seq ${vt_B} ${vt_V}] gdb_test "info vtbl c" "${vt_V}" - gdb_test "info vtbl d" "${vt_D}${vt_V}" - gdb_test "info vtbl e" "${vt_E}${vt_D2}${vt_V2}" - gdb_test "info vtbl pEe" "${vt_E}${vt_D2}${vt_V2}" + gdb_test "info vtbl d" [vtable_seq ${vt_D} ${vt_V}] + gdb_test "info vtbl e" [vtable_seq ${vt_E} ${vt_D2} ${vt_V2}] + gdb_test "info vtbl pEe" [vtable_seq ${vt_E} ${vt_D2} ${vt_V2}] gdb_test "info vtbl" "Argument required.*" gdb_test "info vtbl va" \ diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp index a9e656ddfc0..baa80b4c37c 100644 --- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp +++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp @@ -179,7 +179,7 @@ proc_with_prefix test_bkpt_cond_and_cmds { } { gdb_scm_test_silent_cmd "guile (define blist (breakpoints))" \ "get breakpoint list 6" gdb_test "guile (print (breakpoint-commands (list-ref blist (- (length blist) 1))))" \ - "print \"Command for breakpoint has been executed.\".*print result" + "print \"Command for breakpoint has been executed.\".*print result\r\n" } proc_with_prefix test_bkpt_invisible { } { diff --git a/gdb/testsuite/gdb.guile/scm-cmd.exp b/gdb/testsuite/gdb.guile/scm-cmd.exp index 25a9780a4d5..afcb17c2096 100644 --- a/gdb/testsuite/gdb.guile/scm-cmd.exp +++ b/gdb/testsuite/gdb.guile/scm-cmd.exp @@ -93,7 +93,7 @@ gdb_test_multiline "input command to throw error" \ " (throw-user-error \"you lose! ~a\" arg))))" "" \ "end" "" -gdb_test "test-error-cmd ugh" "ERROR: you lose! ugh" "call error command" +gdb_test "test-error-cmd ugh" "ERROR: you lose! ugh\r\n" "call error command" # Test string->argv. diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp index 4c1fb052b5c..9446ef5b6b4 100644 --- a/gdb/testsuite/gdb.opt/inline-break.exp +++ b/gdb/testsuite/gdb.opt/inline-break.exp @@ -74,7 +74,11 @@ proc break_info_1 {num args} { } # Add function/source file info. - append result "in $func at .*$source${end}" + append result "in $func at .*$source" + + if {$i < $locs} { + append result ${end} + } } return $result diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp index ab81b7ade85..76094c95d10 100644 --- a/gdb/testsuite/gdb.python/py-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp @@ -57,7 +57,7 @@ proc_with_prefix test_bkpt_basic { } { gdb_test "python print (blist\[0\])" \ "" "Check obj exists @main" gdb_test "python print (blist\[0\].location)" \ - "main." "Check breakpoint location @main" + "main" "Check breakpoint location @main" gdb_test "python print (blist\[0\].pending)" "False" \ "Check pending status of main breakpoint" @@ -75,7 +75,7 @@ proc_with_prefix test_bkpt_basic { } { gdb_test "python print (blist\[0\])" \ "" "Check obj exists @main 2" gdb_test "python print (blist\[0\].location)" \ - "main." "Check breakpoint location @main 2" + "main" "Check breakpoint location @main 2" gdb_test "python print (blist\[1\])" \ "" "Check obj exists @mult_line" @@ -206,7 +206,7 @@ proc_with_prefix test_bkpt_cond_and_cmds { } { gdb_py_test_silent_cmd "python last_bp = blist\[len(blist)-1\]" \ "Find last breakpoint" 0 gdb_test "python print (last_bp.commands)" \ - "print \"Command for breakpoint has been executed.\".*print result" + "print \"Command for breakpoint has been executed.\".*print result\r\n" gdb_test_no_output "python last_bp.commands = 'echo hi\\necho there'" \ "set commands" diff --git a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp index fd53806e467..5c953807584 100644 --- a/gdb/testsuite/gdb.reverse/machinestate-precsave.exp +++ b/gdb/testsuite/gdb.reverse/machinestate-precsave.exp @@ -105,11 +105,11 @@ with_test_prefix "module global variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint" + gdb_test "print aglobal" " = 0" "module global reverse-breakpoint" gdb_test "step" " module global post-change .*" - gdb_test "print aglobal" " = 1$newline" "module global forward past bp" + gdb_test "print aglobal" " = 1" "module global forward past bp" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp" + gdb_test "print aglobal" " = 0" "module global reverse-step to bp" } # Module static variable, reverse @@ -120,11 +120,11 @@ with_test_prefix "module static variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint" + gdb_test "print astatic" " = 0" "module static reverse-breakpoint" gdb_test "step" " module static post-change .*" - gdb_test "print astatic" " = 1$newline" "module static forward" + gdb_test "print astatic" " = 1" "module static forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print astatic" " = 0$newline" "module static reverse-step" + gdb_test "print astatic" " = 0" "module static reverse-step" } # Function static variable, reverse @@ -135,11 +135,11 @@ with_test_prefix "function static variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "function static reverse-breakpoint" + gdb_test "print a" " = 0" "function static reverse-breakpoint" gdb_test "step" " function static post-change .*" - gdb_test "print a" " = 1$newline" "function static forward" + gdb_test "print a" " = 1" "function static forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" "function static reverse-step" + gdb_test "print a" " = 0" "function static reverse-step" } # Auto variable, reverse @@ -150,11 +150,11 @@ with_test_prefix "auto variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint" + gdb_test "print a" " = 0" "auto var reverse-breakpoint" gdb_test "step" " auto post-change .*" - gdb_test "print a" " = 1$newline" "auto var forward" + gdb_test "print a" " = 1" "auto var forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" "auto var reverse-step" + gdb_test "print a" " = 0" "auto var reverse-step" } # Register variable, reverse @@ -165,12 +165,12 @@ with_test_prefix "register variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "register var reverse-breakpoint" + gdb_test "print a" " = 0" "register var reverse-breakpoint" gdb_test "step" " register post-change .*" - gdb_test "print a" " = 1$newline" \ + gdb_test "print a" " = 1" \ "register var step post-change, first time" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" "register var reverse step-to" + gdb_test "print a" " = 0" "register var reverse step-to" } # Proceed to beginning of main @@ -189,12 +189,12 @@ with_test_prefix "register variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "register var forward-breakpoint" + gdb_test "print a" " = 0" "register var forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "register var forward step-to" + gdb_test "print a" " = 0" "register var forward step-to" gdb_test "step" " register post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" \ + gdb_test "print a" " = 1" \ "register var step post-change, second time" } @@ -206,12 +206,12 @@ with_test_prefix "auto variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "auto var forward-breakpoint" + gdb_test "print a" " = 0" "auto var forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "auto var forward step-to" + gdb_test "print a" " = 0" "auto var forward step-to" gdb_test "step" " auto post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" "auto var step post-change" + gdb_test "print a" " = 1" "auto var step post-change" } # Function static variable, forward @@ -222,12 +222,12 @@ with_test_prefix "function static variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "function static forward-breakpoint" + gdb_test "print a" " = 0" "function static forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "function static forward step-to" + gdb_test "print a" " = 0" "function static forward step-to" gdb_test "step" " function static post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" "function static step post-change" + gdb_test "print a" " = 1" "function static step post-change" } # Module static variable, forward @@ -238,12 +238,12 @@ with_test_prefix "module static variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint" + gdb_test "print astatic" " = 0" "module static forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print astatic" " = 0$newline" "module static forward step-to" + gdb_test "print astatic" " = 0" "module static forward step-to" gdb_test "step" " module static post-change .*" "step, 2" - gdb_test "print astatic" " = 1$newline" "module static step post-change" + gdb_test "print astatic" " = 1" "module static step post-change" } # Module global variable, forward @@ -254,11 +254,11 @@ with_test_prefix "module global variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint" + gdb_test "print aglobal" " = 0" "module global forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print aglobal" " = 0$newline" "module global forward step-to" + gdb_test "print aglobal" " = 0" "module global forward step-to" gdb_test "step" " module global post-change .*" "step, 2" - gdb_test "print aglobal" " = 1$newline" "module global step post-change" + gdb_test "print aglobal" " = 1" "module global step post-change" } diff --git a/gdb/testsuite/gdb.reverse/machinestate.exp b/gdb/testsuite/gdb.reverse/machinestate.exp index 68412b47d3b..60d8f33a022 100644 --- a/gdb/testsuite/gdb.reverse/machinestate.exp +++ b/gdb/testsuite/gdb.reverse/machinestate.exp @@ -80,11 +80,11 @@ with_test_prefix "module global variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print aglobal" " = 0$newline" "module global reverse-breakpoint" + gdb_test "print aglobal" " = 0" "module global reverse-breakpoint" gdb_test "step" " module global post-change .*" - gdb_test "print aglobal" " = 1$newline" "module global forward past bp" + gdb_test "print aglobal" " = 1" "module global forward past bp" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print aglobal" " = 0$newline" "module global reverse-step to bp" + gdb_test "print aglobal" " = 0" "module global reverse-step to bp" } # Module static variable, reverse @@ -95,11 +95,11 @@ with_test_prefix "module static variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print astatic" " = 0$newline" "module static reverse-breakpoint" + gdb_test "print astatic" " = 0" "module static reverse-breakpoint" gdb_test "step" " module static post-change .*" - gdb_test "print astatic" " = 1$newline" "module static forward" + gdb_test "print astatic" " = 1" "module static forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print astatic" " = 0$newline" "module static reverse-step" + gdb_test "print astatic" " = 0" "module static reverse-step" } # Function static variable, reverse @@ -110,11 +110,11 @@ with_test_prefix "function static variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "function static reverse-breakpoint" + gdb_test "print a" " = 0" "function static reverse-breakpoint" gdb_test "step" " function static post-change .*" - gdb_test "print a" " = 1$newline" "function static forward" + gdb_test "print a" " = 1" "function static forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" "function static reverse-step" + gdb_test "print a" " = 0" "function static reverse-step" } # Auto variable, reverse @@ -125,11 +125,11 @@ with_test_prefix "auto variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "auto var reverse-breakpoint" + gdb_test "print a" " = 0" "auto var reverse-breakpoint" gdb_test "step" " auto post-change .*" - gdb_test "print a" " = 1$newline" "auto var forward" + gdb_test "print a" " = 1" "auto var forward" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" "auto var reverse-step" + gdb_test "print a" " = 0" "auto var reverse-step" } # Register variable, reverse @@ -140,11 +140,11 @@ with_test_prefix "register variable, reverse" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "reverse-continue" "$srcfile:$breakloc.*" "reverse to $breakloc" - gdb_test "print a" " = 0$newline" "register var reverse-breakpoint" + gdb_test "print a" " = 0" "register var reverse-breakpoint" gdb_test "step" " register post-change .*" - gdb_test "print a" " = 1$newline" "register var step post-change" + gdb_test "print a" " = 1" "register var step post-change" gdb_test "reverse-step" "$newline$breakloc.*" - gdb_test "print a" " = 0$newline" \ + gdb_test "print a" " = 0" \ "register var reverse step-to, first time" } @@ -164,12 +164,12 @@ with_test_prefix "register variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "register var forward-breakpoint" + gdb_test "print a" " = 0" "register var forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "register var forward step-to" + gdb_test "print a" " = 0" "register var forward step-to" gdb_test "step" " register post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" \ + gdb_test "print a" " = 1" \ "register var step post-change, second time" } @@ -181,12 +181,12 @@ with_test_prefix "auto variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "auto var forward-breakpoint" + gdb_test "print a" " = 0" "auto var forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "auto var forward step-to" + gdb_test "print a" " = 0" "auto var forward step-to" gdb_test "step" " auto post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" "auto var step post-change" + gdb_test "print a" " = 1" "auto var step post-change" } # Function static variable, forward @@ -197,12 +197,12 @@ with_test_prefix "function static variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print a" " = 0$newline" "function static forward-breakpoint" + gdb_test "print a" " = 0" "function static forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print a" " = 0$newline" "function static forward step-to" + gdb_test "print a" " = 0" "function static forward step-to" gdb_test "step" " function static post-change .*" "step, 2" - gdb_test "print a" " = 1$newline" "function static step post-change" + gdb_test "print a" " = 1" "function static step post-change" } # Module static variable, forward @@ -213,12 +213,12 @@ with_test_prefix "module static variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print astatic" " = 0$newline" "module static forward-breakpoint" + gdb_test "print astatic" " = 0" "module static forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print astatic" " = 0$newline" "module static forward step-to" + gdb_test "print astatic" " = 0" "module static forward step-to" gdb_test "step" " module static post-change .*" "step, 2" - gdb_test "print astatic" " = 1$newline" "module static step post-change" + gdb_test "print astatic" " = 1" "module static step post-change" } # Module global variable, forward @@ -229,10 +229,10 @@ with_test_prefix "module global variable, forward" { gdb_test "tbreak $breakloc" "$srcfile, line $breakloc.*" gdb_test "continue" "$srcfile:$breakloc.*" "forward to $breakloc" - gdb_test "print aglobal" " = 0$newline" "module global forward-breakpoint" + gdb_test "print aglobal" " = 0" "module global forward-breakpoint" gdb_test "reverse-step" "hide.*" gdb_test "step" "$newline$breakloc.*" "step, 1" - gdb_test "print aglobal" " = 0$newline" "module global forward step-to" + gdb_test "print aglobal" " = 0" "module global forward step-to" gdb_test "step" " module global post-change .*" "step, 2" - gdb_test "print aglobal" " = 1$newline" "module global step post-change" + gdb_test "print aglobal" " = 1" "module global step post-change" } diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp index e7ee9385919..a6e6ff86046 100644 --- a/gdb/testsuite/gdb.stabs/exclfwd.exp +++ b/gdb/testsuite/gdb.stabs/exclfwd.exp @@ -40,14 +40,14 @@ set eol "\[ \t\]*\[\n\r\]+" gdb_test "ptype v1" "type = struct a {$eol int x;$eol int y;$eol -}$eol" +}" if {[test_debug_format "stabs"]} { setup_kfail "gdb/1602" *-*-* } gdb_test "ptype v2" "type = struct a {$eol const char .c;$eol -}$eol" +}" if {[test_debug_format "stabs"]} { setup_kfail "gdb/1603" *-*-* diff --git a/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp b/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp index 0186a38fed9..73bea594e15 100644 --- a/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp +++ b/gdb/testsuite/gdb.threads/foll-fork-other-thread.exp @@ -60,7 +60,7 @@ proc do_test { fork_func follow target-non-stop non-stop displaced-stepping } { # Verify that the catchpoint is mentioned in an "info breakpoints", # and further that the catchpoint mentions no process id. gdb_test "info breakpoints" \ - ".*catchpoint.*keep y.*fork\[\r\n\]+" \ + ".*catchpoint.*keep y.*fork" \ "info breakpoints before fork" gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 97d67b7a217..d606e19deb1 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -51,7 +51,7 @@ clean_restart ${testfile} set horiz "\[^\n\r\]*" # regexp for newline -set nl "\[\r\n\]+" +set nl "\r\n" set timeout 30 @@ -138,7 +138,7 @@ proc load_core { filename } { # The thread2 thread should be marked as the current thread. - gdb_test "info threads" "\\* ${horiz} thread2 .*${nl}" \ + gdb_test "info threads" "\\* ${horiz} thread2 .*" \ "thread2 is current thread in corefile" } diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index ffc3250577f..2a2158886d8 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -71,48 +71,51 @@ gdb_trace_setactions "5.1b: set actions for first tracepoint" \ "collect gdb_char_test" "^$" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_char_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "5.1c: verify actions set for first tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_char_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "5.1c: verify actions set for first tracepoint" gdb_trace_setactions "5.1d: set actions for second tracepoint" \ "$trcpt2" \ "collect gdb_short_test" "^$" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_char_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_short_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "5.1e: verify actions set for second tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_char_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_short_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "5.1e: verify actions set for second tracepoint" gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \ "" \ "collect gdb_long_test" "^$" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_char_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_short_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test. -\[\t \]+not installed on target." \ - "5.2b: verify actions set for second tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_char_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_short_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_long_test" \ + "\[\t \]+not installed on target"] \ + "5.2b: verify actions set for second tracepoint" # 5.3 replace actions set earlier @@ -121,17 +124,18 @@ gdb_trace_setactions "5.3a: reset actions for first tracepoint" \ "collect gdb_struct1_test" "^$" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_struct1_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_short_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test. -\[\t \]+not installed on target." \ - "5.3b: verify actions set for first tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_struct1_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_short_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_long_test" \ + "\[\t \]+not installed on target"] \ + "5.3b: verify actions set for first tracepoint" # # test end command (all by itself) @@ -217,17 +221,18 @@ gdb_trace_setactions "5.10a: set teval action for second tracepoint" \ "teval \$tsv += 1" "^$" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+teval gdb_char_test. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+teval \\\$tsv \\\+= 1. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+collect gdb_long_test. -\[\t \]+not installed on target." \ - "5.10a: verify teval actions set for two tracepoints" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+teval gdb_char_test" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+teval \\\$tsv \\\+= 1" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+collect gdb_long_test" \ + "\[\t \]+not installed on target"] \ + "5.10a: verify teval actions set for two tracepoints" # Load the binary to the target too. gdb_load $binfile diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp index a849d96f432..2142dc99f50 100644 --- a/gdb/testsuite/gdb.trace/deltrace.exp +++ b/gdb/testsuite/gdb.trace/deltrace.exp @@ -50,14 +50,15 @@ gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2" gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3" gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "3.1a: set three tracepoints" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "3.1a: set three tracepoints" gdb_test "delete tracepoints" \ "" \ @@ -77,14 +78,15 @@ if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} { } gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "3.2a: set three tracepoints" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "3.2a: set three tracepoints" #gdb_test_no_output "delete tracepoint $trcpt1" "" gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" { @@ -100,12 +102,13 @@ gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" { } gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "3.2c: verify delete first tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "3.2c: verify delete first tracepoint" #gdb_test_no_output "delete tracepoint $trcpt2" "" gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" { @@ -121,10 +124,11 @@ gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" { } gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "3.2e: verify delete second tracepoint" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "3.2e: verify delete second tracepoint" #gdb_test_no_output "delete tracepoint $trcpt3" "" gdb_test_multiple "delete tracepoint $trcpt3" "3.2f: delete third tracepoint" { @@ -155,14 +159,15 @@ if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} { } gdb_test "info tracepoints" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target. -\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ - "3.3a: set three tracepoints" + [multi_line \ + "Num Type\[ \]+Disp Enb Address\[ \]+What\\s*" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target" \ + "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ + "\[\t \]+not installed on target"] \ + "3.3a: set three tracepoints" #gdb_test_no_output "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \ diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp index 83660bed7a5..97ef66b8df2 100644 --- a/gdb/testsuite/gdb.trace/infotrace.exp +++ b/gdb/testsuite/gdb.trace/infotrace.exp @@ -49,20 +49,20 @@ gdb_test "info tracepoints" \ \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. \[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "2.1: info tracepoints (all)" # 2.2 info tracepoint (specific) gdb_test "info tracepoint $c_test_num" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "2.2a: info tracepoint $c_test_num (gdb_c_test)" gdb_test "info tracepoint $asm_test_num" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "2.2b: info tracepoint $asm_test_num (gdb_asm_test)" # 2.3 info tracepoint (invalid tracepoint number) diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp index f2b70c3f3ad..e09849303f3 100644 --- a/gdb/testsuite/gdb.trace/passcount.exp +++ b/gdb/testsuite/gdb.trace/passcount.exp @@ -60,7 +60,7 @@ gdb_test "info tracepoints" \ \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "4.1a: set three tracepoints, passcounts all zero" gdb_test "passcount 2 $trcpt1" \ @@ -75,7 +75,7 @@ gdb_test "info tracepoints" \ \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. \[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "4.1c: verify 1st tracepoint's passcount set to two" gdb_test "passcount 4 $trcpt2" \ @@ -91,7 +91,7 @@ gdb_test "info tracepoints" \ \[\t \]+pass count 4 . \[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "4.1c: verify 2nd tracepoint's passcount set to four" # 4.2 passcount of last (default) tracepoint @@ -191,7 +191,7 @@ gdb_test "info tracepoints" \ \[\t \]+not installed on target. \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. \[\t \]+pass count 4 . -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "4.6: verify passcount to zero" # 4.7 (test a very large passcount) diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp index 3fed8dad2ec..9d0310188f2 100644 --- a/gdb/testsuite/gdb.trace/tracecmd.exp +++ b/gdb/testsuite/gdb.trace/tracecmd.exp @@ -58,7 +58,7 @@ gdb_test "trace $srcfile:$testline2" \ "Tracepoint $decimal at $hex: file.*$srcfile, line $testline2." \ "1.1a: set tracepoint at sourceline" gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "1.1b: trace sourcefile:line" # 1.2 trace invalid source line @@ -82,7 +82,7 @@ gdb_test "trace gdb_recursion_test" \ "Tracepoint $decimal at $hex: file.*$srcfile, line $testline1." \ "1.4a: trace function by name" gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "1.4b: trace function by name" # 1.5 trace non-existant function @@ -120,7 +120,7 @@ gdb_test "trace \*gdb_recursion_test" \ "Tracepoint $decimal at .*$c_test_addr.*" \ "1.7a: trace at function label (before prologue)" gdb_test "info trace" "$c_test_addr.*in gdb_recursion_test.*:$baseline. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "1.7b: verify trace at specific address" # 1.8 trace at invalid address @@ -139,7 +139,7 @@ gdb_test "trace gdb_recursion_test if q1 > 0" \ "1.11a: conditional tracepoint" gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline1. \[\t \]+trace only if q1 > 0. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "1.11b: verify conditional tracepoint" # 1.12 set tracepoint in prologue diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index 995b5a083a4..21cc2ee8298 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -44,7 +44,7 @@ if {$trcpt1 <= 0} { gdb_test "info tracepoints" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. -\[\t \]+not installed on target." \ +\[\t \]+not installed on target" \ "5.12: set a tracepoint, stepcount is zero" set stepcount 12 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 626841a4f0a..d3245ec3b43 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1453,13 +1453,13 @@ proc gdb_test { args } { } set prompt [fill_in_default_prompt $prompt [expr !${no-prompt-anchor}]] - set nl [expr ${nonl} ? {""} : {"\[\r\n\]+"}] + set nl [expr ${nonl} ? {""} : {"\r\n"}] set saw_question 0 set user_code {} lappend user_code { - -re "\[\r\n\]*(?:$pattern)$nl$prompt" { + -re "(?:$pattern)$nl$prompt" { if { $question != "" & !$saw_question} { fail $message } elseif {!$nopass} { From patchwork Fri Mar 31 20:20:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 67164 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 3C79A385782B for ; Fri, 31 Mar 2023 20:22:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C79A385782B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680294133; bh=Dd7ucqFbggyb0juxKB19zp1VnZfvFAwPU2+eqxIuDlU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xCeNrcf3aglarvWyG/CO06OzDE3MSk4qzKagbbQ0epAIQuL4AhMU8mI3iXOPQBrZC 11E27IcoJUxzYM1XPfmBXEXHoCR0PfNXHRSlZWvuX1QcqUuOMQETxD6IGJc2GDna6s XNCXldQlprgKICaIazhmHsrnHb8h7g64TkWo13Zk= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E164D38582BC for ; Fri, 31 Mar 2023 20:21:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E164D38582BC Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-CL3u7QDsOvGid5ePCzUgQQ-1; Fri, 31 Mar 2023 16:21:10 -0400 X-MC-Unique: CL3u7QDsOvGid5ePCzUgQQ-1 Received: by mail-wm1-f69.google.com with SMTP id o28-20020a05600c511c00b003ef69894934so8626874wms.6 for ; Fri, 31 Mar 2023 13:21:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680294069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dd7ucqFbggyb0juxKB19zp1VnZfvFAwPU2+eqxIuDlU=; b=cYABygoVdvMQdfadOAgXNdinqwimvyHRaztV6R+/kG7YMRlIcjdcLsVylYV/D99Mqt xF5dGEsIFAKi8air4Y2YTOaAVuYn8JZlzz2qImNNDwy09YNqGO11+JOcuzMhrGtdSAwU VcvptfNqqSbGyqcYRzg4216stu3QN+nhd7a3HO++G6ZBtuQYkVYzUV9+PCESwKlKt8NW YkEmomIkHJ46kPgfFWKugV01r7SBTLEA4uJ/K6RlM9GgpCsiVSJaJMn2dap3EmBVu3+Y 00uSk3tt3lOvwOM5R8JXw2iTcffMGug6xg7ft5O5xp5vsxQ5UTWOlLSvzZkz8ERBafPZ 22fA== X-Gm-Message-State: AAQBX9dpKBowIRlLHwlplVwK46G6CsdHMnQud9eKpzTy4GU1TAWS9wKL JbGRupA3HFvsQ3v403UvOMcLmvYxMrzZFouSoBWnaX4mB2Rxig0zOQPDiueLsOhBMXHLWP2dM+y kSSts6gH91k0hoY1E7KVSbdXC3vX2UHJ4llCwFqiVMjTXO7dMA+Ew3DxccgI7twG4tHWPCjmF+D g5E7UfWQ== X-Received: by 2002:adf:e94c:0:b0:2cf:e688:51bd with SMTP id m12-20020adfe94c000000b002cfe68851bdmr20353676wrn.31.1680294068750; Fri, 31 Mar 2023 13:21:08 -0700 (PDT) X-Google-Smtp-Source: AKy350a9VFd0fY+Yo7RD69OiVKjsGOMFmKS9OexLleRcECLzRwCT6kEfT5T7u46KfkJwhmTHFNjSlA== X-Received: by 2002:adf:e94c:0:b0:2cf:e688:51bd with SMTP id m12-20020adfe94c000000b002cfe68851bdmr20353661wrn.31.1680294068212; Fri, 31 Mar 2023 13:21:08 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id c17-20020a5d63d1000000b002d1daafea30sm3035726wrw.34.2023.03.31.13.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 13:21:07 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 5/5] gdb/testsuite: special case '^' in gdb_test pattern Date: Fri, 31 Mar 2023 21:20:58 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In this commit I propose that we add special handling for the '^' when used at the start of a gdb_test pattern. Consider this usage: gdb_test "some_command" "^command output pattern" I think the intention here is pretty clear - run 'some_command', and the output from the command should be exactly 'command output pattern'. After the previous commit which tightened up how gdb_test matches the final newline and prompt we know that the only thing after the output pattern will be a single newline and prompt, and the leading '^' ensures that there's no output before 'command output pattern', so this will do what I want, right? ... except it doesn't. The command itself will also be available and needs to be matched, so I should really write: gdb_test "some_command" "^some_command\r\ncommand output pattern" which will do what I want, right? Well, that's fine until I change the command and include some regexp character, then I have to write: gdb_test "some_command" \ "^[string_to_regexp some_command]\r\ncommand output pattern" which, honestly, is horrid. So in most cases I simply don't bother anchoring the output with a '^', and a quick scan of the testsuite would indicate that most other folk don't both either. What I propose is this: the *only* thing that can appear immediately after the '^' is the command converted into a regexp, so lets do that automatically, moving the work into gdb_test. Thus, when I write: gdb_test "some_command" "^command output pattern" Inside gdb_test we will spot the leading '^' in the pattern, and inject the regexp version of the command after the '^', followed by a '\r\n'. My hope is that given this new ability, folk will be more inclined to anchor their output patterns when this makes sense to do so. This should increase our ability to catch any excess warnings or unexpected junk that might get printed by GDB. There is one problem case we need to consider, sometime people do this: # ... something that sends a command to GDB ... gdb_test "" "^expected output pattern" In this case my proposed new feature injects the command regexp, which is the empty string (as the command itself is empty), but still injects the '\r\n' after the command regexp, thus we end up with this pattern: ^\r\nexpected output pattern This extra '\r\n' is not what we expected here. This gets a special case inside gdb_test -- if the command is empty then don't add anything after the '^' character. There are a bunch of tests that do already use '^' followed by the command, and these can all be simplified in this commit. --- gdb/testsuite/gdb.arch/amd64-entry-value.exp | 59 ++++++++++++++----- .../gdb.arch/amd64-invalid-stack-middle.exp | 4 +- .../gdb.arch/amd64-invalid-stack-top.exp | 4 +- gdb/testsuite/gdb.base/compare-sections.exp | 2 +- gdb/testsuite/gdb.base/fullpath-expand.exp | 4 +- .../gdb.base/multi-line-starts-subshell.exp | 2 +- gdb/testsuite/gdb.base/new-ui-echo.exp | 4 +- gdb/testsuite/gdb.base/new-ui.exp | 6 +- gdb/testsuite/gdb.base/settings.exp | 9 ++- gdb/testsuite/gdb.base/signals.exp | 2 +- gdb/testsuite/gdb.base/with.exp | 15 +++-- gdb/testsuite/gdb.linespec/break-ask.exp | 4 +- .../gdb.mi/user-selected-context-sync.exp | 2 +- gdb/testsuite/gdb.python/py-framefilter.exp | 2 +- gdb/testsuite/gdb.python/python.exp | 2 +- gdb/testsuite/lib/gdb.exp | 22 +++++-- 16 files changed, 97 insertions(+), 46 deletions(-) diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index a700e9a691b..3c666acc117 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -48,8 +48,11 @@ gdb_breakpoint "breakhere_reference" gdb_continue_to_breakpoint "entry: breakhere" -gdb_test "bt" "^bt\r\n#0 +d *\\(i=31, i@entry=30, j=31\\.5, j@entry=30\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ - "entry: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +d *\\(i=31, i@entry=30, j=31\\.5, j@entry=30\\.5\\) \[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in main .*"] \ + "entry: bt" gdb_test "p i" " = 31" "entry: p i" gdb_test "p i@entry" " = 30" "entry: p i@entry" gdb_test "p j" { = 31\.5} "entry: p j" @@ -61,21 +64,30 @@ gdb_test "p j@entry" { = 30\.5} "entry: p j@entry" gdb_continue_to_breakpoint "entry_locexpr: breakhere_locexpr" gdb_test "p i" " = 30" "entry_locexpr: p i" gdb_test_no_output "set variable i = 0" "entry_locexpr: set variable i = 0" -gdb_test "bt" "^bt\r\n#0 +locexpr *\\(i=0, i@entry=30\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ - "entry_locexpr: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +locexpr *\\(i=0, i@entry=30\\) \[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in main .*"] \ + "entry_locexpr: bt" # Test @entry values for stack passed parameters. gdb_continue_to_breakpoint "entry_stack: stacktest" -gdb_test "bt" "^bt\r\n#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=s1@entry=11, s2=s2@entry=12, \[^\r\n\]+, d9=d9@entry=11\\.5, da=da@entry=12\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ - "entry_stack: bt at entry" +gdb_test "bt" \ + [multi_line \ + "^#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=s1@entry=11, s2=s2@entry=12, \[^\r\n\]+, d9=d9@entry=11\\.5, da=da@entry=12\\.5\\) \[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in main .*"] \ + "entry_stack: bt at entry" gdb_continue_to_breakpoint "entry_stack: breakhere_stacktest" -gdb_test "bt" "^bt\r\n#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=3, s1@entry=11, s2=4, s2@entry=12, \[^\r\n\]+, d9=3\\.5, d9@entry=11\\.5, da=4\\.5, da@entry=12\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ - "entry_stack: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=3, s1@entry=11, s2=4, s2@entry=12, \[^\r\n\]+, d9=3\\.5, d9@entry=11\\.5, da=4\\.5, da@entry=12\\.5\\) \[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in main .*"] \ + "entry_stack: bt" gdb_test "p s1" " = 3" "entry_stack: p s1" gdb_test "p s1@entry" " = 11" "entry_stack: p s1@entry" @@ -202,8 +214,13 @@ gdb_test "p nodataparam@entry" "Cannot resolve DW_AT_call_data_value" "entry_ref gdb_continue_to_breakpoint "tailcall: breakhere" -gdb_test "bt" "^bt\r\n#0 +d *\\(i=71, i@entry=70, j=73\\.5, j@entry=72\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in c \\(i=i@entry=7, j=j@entry=7\\.25\\) \[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in b \\(i=i@entry=5, j=j@entry=5\\.25\\) \[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in main \[^\r\n\]*" \ - "tailcall: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +d *\\(i=71, i@entry=70, j=73\\.5, j@entry=72\\.5\\) \[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in c \\(i=i@entry=7, j=j@entry=7\\.25\\) \[^\r\n\]*" \ + "#2 +0x\[0-9a-f\]+ in b \\(i=i@entry=5, j=j@entry=5\\.25\\) \[^\r\n\]*" \ + "#3 +0x\[0-9a-f\]+ in main \[^\r\n\]*"] \ + "tailcall: bt" gdb_test "p i" " = 71" "tailcall: p i" gdb_test "p i@entry" " = 70" "tailcall: p i@entry" gdb_test "p j" " = 73\\.5" "tailcall: p j" @@ -243,8 +260,16 @@ gdb_test_multiple $test $test { gdb_continue_to_breakpoint "ambiguous: breakhere" -gdb_test "bt" "^bt\r\n#0 +d \\(i=, j=\\)\[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in amb_z \\(i=\\)\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in amb_y \\(i=\\)\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in amb_x \\(i=\\)\[^\r\n\]*\r\n#4 +0x\[0-9a-f\]+ in amb_b \\(i=i@entry=101\\)\[^\r\n\]*\r\n#5 +0x\[0-9a-f\]+ in amb_a \\(i=i@entry=100\\)\[^\r\n\]*\r\n#6 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*" \ - "ambiguous: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +d \\(i=, j=\\)\[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in amb_z \\(i=\\)\[^\r\n\]*" \ + "#2 +0x\[0-9a-f\]+ in amb_y \\(i=\\)\[^\r\n\]*" \ + "#3 +0x\[0-9a-f\]+ in amb_x \\(i=\\)\[^\r\n\]*" \ + "#4 +0x\[0-9a-f\]+ in amb_b \\(i=i@entry=101\\)\[^\r\n\]*" \ + "#5 +0x\[0-9a-f\]+ in amb_a \\(i=i@entry=100\\)\[^\r\n\]*" \ + "#6 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*"] \ + "ambiguous: bt" # Test self tail calls verification. @@ -252,8 +277,14 @@ gdb_test "bt" "^bt\r\n#0 +d \\(i=, j=\\)\[^\r\n\]* gdb_continue_to_breakpoint "self: breakhere" -gdb_test "bt" "^bt\r\n#0 +d \\(i=, j=\\)\[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in self \\(i=\\)\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in self2 \\(i=\\)\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in self \\(i=\\)\[^\r\n\]*\r\n#4 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*" \ - "self: bt" +gdb_test "bt" \ + [multi_line \ + "^#0 +d \\(i=, j=\\)\[^\r\n\]*" \ + "#1 +0x\[0-9a-f\]+ in self \\(i=\\)\[^\r\n\]*" \ + "#2 +0x\[0-9a-f\]+ in self2 \\(i=\\)\[^\r\n\]*" \ + "#3 +0x\[0-9a-f\]+ in self \\(i=\\)\[^\r\n\]*" \ + "#4 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*"] \ + "self: bt" gdb_test_no_output "set debug entry-values 1" gdb_test "bt" "DW_OP_entry_value resolving has found function \"self\\(int\\)\" at 0x\[0-9a-f\]+ can call itself via tail calls\r\n.*" \ diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp index 156300be1d9..c90b92cbf3f 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp @@ -39,10 +39,10 @@ if ![runto breakpt] { return -1 } -gdb_test "bt" "^bt\r\n#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in func4\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in func3\[^\r\n\]*\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ +gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in func4\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in func3\[^\r\n\]*\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ "first backtrace, with error message" -gdb_test "bt" "^bt\r\n#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in func4\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in func3\[^\r\n\]*\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ +gdb_test "bt" "^#0 +breakpt *\\(\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in func5\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in func4\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in func3\[^\r\n\]*\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ "second backtrace, with error message" clean_restart ${binfile} diff --git a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp index b6a25f8525f..03edcef7fcc 100644 --- a/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp +++ b/gdb/testsuite/gdb.arch/amd64-invalid-stack-top.exp @@ -43,10 +43,10 @@ if ![runto breakpt] { # Use 'bt no-filters' here as the python filters will raise their own # error during initialisation, the no-filters case is simpler. -gdb_test "bt no-filters" "^bt no-filters\r\n#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ +gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ "first backtrace, with error message" -gdb_test "bt no-filters" "^bt no-filters\r\n#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ +gdb_test "bt no-filters" "^#0 +$hex in func2 \\(\\)\r\nBacktrace stopped: Cannot access memory at address 0x\[0-9a-f\]+" \ "second backtrace, with error message" clean_restart ${binfile} diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp index f24ff16f868..7fa89391b4d 100644 --- a/gdb/testsuite/gdb.base/compare-sections.exp +++ b/gdb/testsuite/gdb.base/compare-sections.exp @@ -38,7 +38,7 @@ proc compare_sections { {options ""} } { -re "MIS-MATCHED.*$gdb_prompt $" { fail $test } - -re "warning.*One or more sections.*does not match.*loaded file.*$gdb_prompt $" { + -re "warning: One or more sections.*does not match.*loaded file.*$gdb_prompt $" { fail $test } -re "Section.*matched.*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/fullpath-expand.exp b/gdb/testsuite/gdb.base/fullpath-expand.exp index 285d0be08ec..82d3b24fe2a 100644 --- a/gdb/testsuite/gdb.base/fullpath-expand.exp +++ b/gdb/testsuite/gdb.base/fullpath-expand.exp @@ -41,8 +41,8 @@ if { $result != 0 || $realsrcfile2 == "" } { clean_restart ${testfile} -gdb_test "rbreak $realsrcfile2:func" "^rbreak \[^\r\n\]*:func\r\nBreakpoint 1 at 0x\[0-9a-f\]+: file [string_to_regexp ${subdir}/${srcfile2}], line \[0-9\]+\\.\r\nvoid func\\(void\\);" "rbreak XXX/fullpath-expand-func.c:func" +gdb_test "rbreak $realsrcfile2:func" "^Breakpoint 1 at 0x\[0-9a-f\]+: file [string_to_regexp ${subdir}/${srcfile2}], line \[0-9\]+\\.\r\nvoid func\\(void\\);" "rbreak XXX/fullpath-expand-func.c:func" # Verify the compilation pathnames are as expected: gdb_test "list func" "\tfunc \\(void\\)\r\n.*" -gdb_test "info source" "^info source\r\nCurrent source file is [string_to_regexp ${subdir}/${srcfile2}]\r\nCompilation directory is /.*" +gdb_test "info source" "^Current source file is [string_to_regexp ${subdir}/${srcfile2}]\r\nCompilation directory is /.*" diff --git a/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp b/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp index 640c3be064c..ee58691fd3f 100644 --- a/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp +++ b/gdb/testsuite/gdb.base/multi-line-starts-subshell.exp @@ -52,4 +52,4 @@ gdb_test_multiple "if 1\nshell ${shell_cmd}\nend\nPS1=\"$shell_prompt\"" $test { } # Check that we restore input in GDB correctly. -gdb_test "print 1" "^print 1\r\n.. = 1" "gdb input still works" +gdb_test "print 1" "^\\\$$decimal = 1" "gdb input still works" diff --git a/gdb/testsuite/gdb.base/new-ui-echo.exp b/gdb/testsuite/gdb.base/new-ui-echo.exp index efcc711e666..96181483752 100644 --- a/gdb/testsuite/gdb.base/new-ui-echo.exp +++ b/gdb/testsuite/gdb.base/new-ui-echo.exp @@ -103,10 +103,10 @@ proc echo_test {driver} { # Ensure echo remains enabled in both consoles. with_spawn_id $con1_spawn_id { - gdb_test "print 1" "^print 1\r\n\\\$1 = 1" "print on $con1_name echoes" + gdb_test "print 1" "\\\$1 = 1" "print on $con1_name echoes" } with_spawn_id $con2_spawn_id { - gdb_test "print 2" "^print 2\r\n\\\$2 = 2" "print on $con2_name echoes" + gdb_test "print 2" "\\\$2 = 2" "print on $con2_name echoes" } } diff --git a/gdb/testsuite/gdb.base/new-ui.exp b/gdb/testsuite/gdb.base/new-ui.exp index 2056d80f6cc..a6a38fa94d4 100644 --- a/gdb/testsuite/gdb.base/new-ui.exp +++ b/gdb/testsuite/gdb.base/new-ui.exp @@ -28,7 +28,7 @@ proc ensure_no_output {message} { # Run a command and use an anchor to make sure no output appears # before the command's expected output. - gdb_test "print 999" "^print 999\r\n\\\$$decimal = 999" $message + gdb_test "print 999" "^\\\$$decimal = 999" $message } # Run a few execution-related commands on CON1, and ensure the proper @@ -121,10 +121,10 @@ proc_with_prefix do_test {} { # Ensure non-execution commands in one console don't cause output # in the other consoles. with_spawn_id $gdb_main_spawn_id { - gdb_test "print 1" "^print 1\r\n\\\$1 = 1" "print on main console" + gdb_test "print 1" "^\\\$1 = 1" "print on main console" } with_spawn_id $extra_spawn_id { - gdb_test "print 2" "^print 2\r\n\\\$2 = 2" "print on extra console" + gdb_test "print 2" "^\\\$2 = 2" "print on extra console" } # Verify that we get proper queries on the main UI, but that they are diff --git a/gdb/testsuite/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp index e54203924ec..eb127d246d2 100644 --- a/gdb/testsuite/gdb.base/settings.exp +++ b/gdb/testsuite/gdb.base/settings.exp @@ -540,7 +540,9 @@ proc test-string {variant} { # Checks that gdb doesn't crash if we haven't set the string yet. if {$variant != "filename"} { - gdb_test "$show_cmd" "^$show_cmd\r\n" "$show_cmd: show default" + # This odd expected output here is because we expect GDB to + # emit a single blank line as a result of this command. + gdb_test "$show_cmd" "^" "$show_cmd: show default" } else { gdb_test "$show_cmd" "/foo/bar" "$show_cmd: show default" } @@ -570,8 +572,9 @@ proc test-string {variant} { show_setting "$show_cmd" "\"hello world\"" } else { gdb_test_no_output "$set_cmd" - gdb_test "$show_cmd" \ - "^$show_cmd\r\n" "$show_cmd: empty second time" + # This odd expected output here is because we expect GDB to + # emit a single blank line as a result of this command. + gdb_test "$show_cmd" "^" "$show_cmd: empty second time" } } diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 338cf4b298c..de613a25f49 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -88,7 +88,7 @@ if {[runto_main]} { # ...call the function - gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \ + gdb_test "p func1 ()" "^\\\$$decimal = void" \ "p func1 () #1" # ...veryfiy that the cout was updated diff --git a/gdb/testsuite/gdb.base/with.exp b/gdb/testsuite/gdb.base/with.exp index 233dc30d509..ebe84c05992 100644 --- a/gdb/testsuite/gdb.base/with.exp +++ b/gdb/testsuite/gdb.base/with.exp @@ -54,14 +54,17 @@ proc test_with_error {setting tmp_val expected_re} { global gdb_prompt with_test_prefix "$setting, $tmp_val" { - set test "save org value" set org_val "" - gdb_test_multiple "maint show test-settings $setting" $test { - -re "(.*)\r\n$gdb_prompt $" { - set org_val $expect_out(1,string) - pass $test + gdb_test_multiple "maint show test-settings $setting" \ + "save org value" { + -re "^maint show test-settings $setting\r\n" { + exp_continue + } + -re "^(.*)\r\n$gdb_prompt $" { + set org_val $expect_out(1,string) + pass $gdb_test_name + } } - } gdb_test \ "maint with test-settings $setting $tmp_val -- p 1" \ diff --git a/gdb/testsuite/gdb.linespec/break-ask.exp b/gdb/testsuite/gdb.linespec/break-ask.exp index 8de8a958022..251f7dd76ba 100644 --- a/gdb/testsuite/gdb.linespec/break-ask.exp +++ b/gdb/testsuite/gdb.linespec/break-ask.exp @@ -68,7 +68,7 @@ gdb_test_multiple $cmd $test { pass $test } } -gdb_test "2" "^2\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." +gdb_test "2" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." gdb_breakpoint "body_elsewhere" @@ -88,7 +88,7 @@ gdb_test_multiple $cmd $test { pass $test } } -gdb_test "3" "^3\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." +gdb_test "3" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\." gdb_breakpoint "body_elsewhere" diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp index 9bcc90f06b4..4889c31aff3 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp @@ -500,7 +500,7 @@ proc ensure_no_output { test } { if { $gdb_spawn_id == $gdb_main_spawn_id } { # CLI gdb_test "print 666" \ - "^print 666\r\n\\\$$decimal = 666" \ + "^\\\$$decimal = 666" \ "$test, ensure no output CLI" } elseif { $gdb_spawn_id == $mi_spawn_id } { # MI diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp index 6897518a20e..f02fc861225 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.exp +++ b/gdb/testsuite/gdb.python/py-framefilter.exp @@ -97,7 +97,7 @@ foreach bttype [list "bt" "bt full"] { pass $test } } - gdb_test "q" "^q\r\nQuit" "pagination quit - $bttype - q" + gdb_test "q" "^Quit" "pagination quit - $bttype - q" } gdb_test_no_output "set height unlimited" "pagination quit - set height unlimited" diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 8fe119fead1..7e9ddaa6fcd 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -69,7 +69,7 @@ with_test_prefix "python interactive help" { # The "quit" must be seen on the output. A buggy GDB # would not display it. - gdb_test "quit" "^quit.*leaving help.*" "quit help" + gdb_test "quit" "^\r\nYou are now leaving help.*" "quit help" } } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index d3245ec3b43..b4746651c15 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1400,10 +1400,12 @@ proc gdb_test_multiline { name args } { # # COMMAND is the command to execute, send to GDB with send_gdb. If # this is the null string no command is sent. -# PATTERN is the pattern to match for a PASS, and must NOT include -# the \r\n sequence immediately before the gdb prompt. This argument -# may be omitted to just match the prompt, ignoring whatever output -# precedes it. +# PATTERN is the pattern to match for a PASS, and must NOT include the +# \r\n sequence immediately before the gdb prompt (see -nonl below). +# This argument may be omitted to just match the prompt, ignoring +# whatever output precedes it. If PATTERN starts with '^' then +# PATTERN will be anchored such that it should match all output from +# COMMAND. # MESSAGE is an optional message to be printed. If this is # omitted, then the pass/fail messages use the command string as the # message. (If this is the empty string, then sometimes we don't @@ -1457,6 +1459,18 @@ proc gdb_test { args } { set saw_question 0 + # If the pattern starts with a '^' then we want to match all the + # output from COMMAND. To support this, here we inject an + # additional pattern that matches the command immediately after + # the '^'. + if {[string range $pattern 0 0] eq "^"} { + set command_regex [string_to_regexp $command] + set pattern [string range $pattern 1 end] + if {$command_regex ne ""} { + set pattern "^${command_regex}\r\n$pattern" + } + } + set user_code {} lappend user_code { -re "(?:$pattern)$nl$prompt" {