From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MErIDcwvT2LFdQAAWB0awg (envelope-from ) for ; Thu, 07 Apr 2022 14:39:08 -0400 Received: by simark.ca (Postfix, from userid 112) id 361E81F344; Thu, 7 Apr 2022 14:39:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7CAA71ED17 for ; Thu, 7 Apr 2022 14:39:07 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B0B933857805 for ; Thu, 7 Apr 2022 18:39:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0B933857805 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649356746; bh=+mGOc74/VLvUz4vf6FvZhazHFd5U6sUtcqRievsUdXQ=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=EYSP6X/XZmzV5TxcgbU4M2pwacxbgaEG3dmhKsSbzzqYiFK1f3LAHfOUp9OcoN8oN IERFT17J4L5nw/6jvcwnzOd/oUUxkINNo5eRkTyEkO1aVo3zeeAhZAPKtotNbK8GGi fgG2AZt6KA1g3SB9TYiqF70fVSpAhjqqnmtrewcY= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id BFC623858427 for ; Thu, 7 Apr 2022 18:38:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BFC623858427 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 237IccZV016862 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 7 Apr 2022 14:38:43 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 237IccZV016862 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CEAC01ED17; Thu, 7 Apr 2022 14:38:38 -0400 (EDT) Message-ID: Date: Thu, 7 Apr 2022 14:38:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH][gdb/testsuite] Make gdb.base/annota1.exp more robust Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20220405134732.GA32701@delia> In-Reply-To: <20220405134732.GA32701@delia> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 7 Apr 2022 18:38:39 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-04-05 09:47, Tom de Vries via Gdb-patches wrote: > Hi, > > On openSUSE Tumbleweed I run into: > ... > FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) > ... > > The problem is that the libthread_db message occurs at a location where it's > not expected: > ... > Starting program: outputs/gdb.base/annota1/annota1 ^M > ^M > ^Z^Zstarting^M > ^M > ^Z^Zframes-invalid^M > [Thread debugging using libthread_db enabled]^M > Using host libthread_db library "/lib64/libthread_db.so.1".^M > ^M > ^Z^Zbreakpoints-invalid^M > ^M > ... > > Fix this by making the matching more robust: > - rewrite the regexp such that each annotation is on a single line, > starting with \r\n\032\032 and ending with \r\n > - add a regexp variable optional_re, that matches all possible optional > output, and use it as a separator in the first part of the regexp > > Tested on x86_64-linux. > > Any comments? > > Thanks, > - Tom Hi Tom, This introduces a failure on Ubuntu 20.04 and on Arch Linux. PASS: gdb.base/annota1.exp: breakpoint info run^M ^M ^Z^Zpost-prompt^M Starting program: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/annota1/annota1 ^M ^M ^Z^Zbreakpoints-invalid^M ^M ^Z^Zstarting^M ^M ^Z^Zframes-invalid^M ^M ^Z^Zbreakpoints-invalid^M ^M ^Z^Zbreakpoint 1^M ^M Breakpoint 1, ^M ^Z^Zframe-begin 0 0x555555555183^M ^M ^Z^Zframe-function-name^M main^M ^Z^Zframe-args^M ()^M ^Z^Zframe-source-begin^M at ^M ^Z^Zframe-source-file^M /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/annota1.c^M ^Z^Zframe-source-file-end^M :^M ^Z^Zframe-source-line^M 15^M ^Z^Zframe-source-end^M ^M ^M ^Z^Zsource /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/annota1.c:15:103:beg:0x555555555183^M ^M ^Z^Zframe-end^M ^M ^Z^Zstopped^M ^M ^Z^Zpre-prompt^M (gdb) ^M ^Z^Zprompt^M FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) The issue is the now hardcoded order of "breakpoints-invalid" and "frames-invalid" order in the test regexp, where the output happens in the other order. Before your change, we had: "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \ Meaning we didn't care about the order of those, and we didn't care if we saw them or not. The change below moves those lines in optional_re, and fixes things on my side. >From ce3aa014dc9739f2ccaccc6348b795ce1d86366a Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 7 Apr 2022 14:36:27 -0400 Subject: [PATCH] fix Change-Id: I9ea90dd0d162764b5b6d395c033d73e4d096cf51 --- gdb/testsuite/gdb.base/annota1.exp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 40a13e7cf190..f7e108758b18 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -23,8 +23,6 @@ if ![target_can_use_run_cmd] { return 0 } -set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n" - # # test running programs # @@ -140,6 +138,8 @@ set libthread_db_re \ [multi_line \ "\\\[Thread debugging using libthread_db enabled\\\]" \ "Using host libthread_db library \[^\r\n\]+\r\n"] +set breakpoints_invalid_re "\r\n\032\032breakpoints-invalid\r\n" +set frames_invalid_re "\r\n\032\032frames-invalid\r\n" set optional_re \ [list \ @@ -151,6 +151,10 @@ set optional_re \ "\($libthread_db_re\)" \ "|" \ "\(\r\n$warning_gdb_index_re\)?" \ + "|" \ + "\($breakpoints_invalid_re\)" \ + "|" \ + "\($frames_invalid_re\)" \ "\)*"] set optional_re [join $optional_re ""] @@ -161,10 +165,6 @@ set run_re \ $optional_re \ "\r\n\032\032starting\r\n" \ $optional_re \ - "\r\n\032\032frames-invalid\r\n" \ - $optional_re \ - "\r\n\032\032breakpoints-invalid\r\n" \ - $optional_re \ "\r\n\032\032breakpoint 1\r\n" \ "\r\n" \ "Breakpoint 1, " \ @@ -267,7 +267,7 @@ gdb_test_multiple "break printf" "break printf" { # # get to printf # -set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid}\r\n\032\032frames-invalid\r\n" +set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n${breakpoints_invalid_re}\r\n\032\032frames-invalid\r\n" set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n" set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" @@ -336,19 +336,19 @@ if [target_info exists gdb,nosignals] { # delete all the breakpoints # gdb_test_multiple "delete 1" "delete bp 1" { - -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" { + -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid_re}$gdb_prompt$" { pass $gdb_test_name } } gdb_test_multiple "delete 2" "delete bp 2" { - -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" { + -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid_re}$gdb_prompt$" { pass $gdb_test_name } } gdb_test_multiple "delete 3" "delete bp 3" { - -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid}$gdb_prompt$" { + -re "\r\n\032\032post-prompt\r\n${breakpoints_invalid_re}$gdb_prompt$" { pass $gdb_test_name } } base-commit: 4f7df13ee75be36ae5c6046b6d6f60e04498b719 -- 2.35.1