From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 158CC3858416 for ; Tue, 6 Jun 2023 07:18:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 158CC3858416 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686035935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7xFJatZq6EoFBZMGgTfN5uXIpTZukSZARlcJ/riEMPw=; b=PIyWBLgX9oDxBucnr9IoTdabgOFCZoQnym8rYZF9lDkPjjp0OB1rDGKQEqWeLPq+kJjlw0 sfwKJQmsfe6+GVGVfkU8egbOYhYvqcGyjbHAsftzedTdj1NWcOiTYuHnEd1oKBbN+QePcH 2zM0+Nv1SWpBP7rm72BSGRg6pCAsB3Q= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-445-Ouoy8xpoP6SvhJH9ZByeLw-1; Tue, 06 Jun 2023 03:18:54 -0400 X-MC-Unique: Ouoy8xpoP6SvhJH9ZByeLw-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-3f6c5963db7so52706001cf.2 for ; Tue, 06 Jun 2023 00:18:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686035934; x=1688627934; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7xFJatZq6EoFBZMGgTfN5uXIpTZukSZARlcJ/riEMPw=; b=NBfLPIL4NecmT0bcKwy+A7sf0/e8NymAbsDyEctY6jJwr3tH6J1dl+3f73uUR1BTIv x/1R7BTnLshjpGOyN+rtShm8WR+4sHsyS7GDxtjs62tmxzKKFVPjp03u6NY1yInXid3K w7tBAlvO4i+1/p5TLfIa1E2Wk101Sl2CIWT7XVg062D52NjYtjJnPxVRC6sLnEWTTZTw 5orOx/U9MUaZYe3+4d+up/WmF1049vhEgbTLi8kaKgzPMLq+bU4yjtpUvr/w5NC0A3h5 IID4UaeAfLpSMXl17u2D+NvAgPhpt83y/L9Qzc6DHAXcjUYZz6ikZpIkVnoPDOCy35U1 jg1A== X-Gm-Message-State: AC+VfDwg/2nX4x0vIVeKoIaaMk4KmPyW6ktagC3F/nUNgI2b5XrxVMCB wogeDXieQd6VJFkhbWE3AEgwYFOfLGQYmdh/itOmBNwA1kNXceDxd0PRC2yPqdFHGCLHG/6716Q o3iG36wH4kt9Y4xWIHUqfNQ== X-Received: by 2002:a05:622a:10a:b0:3f3:9204:f9e0 with SMTP id u10-20020a05622a010a00b003f39204f9e0mr1071513qtw.16.1686035934011; Tue, 06 Jun 2023 00:18:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43MyR5BzAbgn+F8aj/NJoD7/qBp8G0QO9ZD7FFT+L6MGxzdSd5e6uSU4CMo7sncm/cKavisw== X-Received: by 2002:a05:622a:10a:b0:3f3:9204:f9e0 with SMTP id u10-20020a05622a010a00b003f39204f9e0mr1071503qtw.16.1686035933759; Tue, 06 Jun 2023 00:18:53 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id bp17-20020a05622a1b9100b003e4f1b3ce43sm5407999qtb.50.2023.06.06.00.18.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jun 2023 00:18:53 -0700 (PDT) Message-ID: <058d9207-1cd2-faa7-0820-7bb787547a11@redhat.com> Date: Tue, 6 Jun 2023 09:18:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2] gdb/testsuite: Avoid infinite loop in gdb.reverse/step-reverse.exp To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org, Andrew Burgess , Tom de Vries References: <20230601214239.209822-1-thiago.bauermann@linaro.org> <45ff5e98-9e03-79fa-d73c-746b0f2d980e@redhat.com> <873535mqj3.fsf@linaro.org> From: Bruno Larsen In-Reply-To: <873535mqj3.fsf@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 06/06/2023 01:35, Thiago Jung Bauermann wrote: > Bruno Larsen writes: > >> On 01/06/2023 23:42, Thiago Jung Bauermann wrote: >>> @@ -257,11 +258,18 @@ gdb_test_multiple "next" "reverse next over recursion" { >>> } >>> } >>> if { "$step_out" == 1 } { >>> + set iterations 0 >>> gdb_test_multiple "next" "stepping out of recursion" { >>> -re -wrap "NEXT OVER THIS RECURSION.*" { >>> set step_out 0 >>> } >>> - -re -wrap ".*" { >>> + -re -wrap "^main .*" { >>> + incr iterations >>> + if { $iterations == $max_iterations } { >>> + fail "$gdb_test_name (reached $max_iterations iterations)" >>> + return >>> + } >>> + >> I'm fine with the idea of a maximum iteration count (even if I find it unnecessary), but >> your use of it here is incorrect. What your code is doing is doing is _only_ exiting once >> you see GDB returning to the main function $max_iterations times. >> >>  if { "$step_out" == 1 } { >>      gdb_test_multiple "next" "stepping out of recursion" { >>         -re -wrap "NEXT OVER THIS RECURSION.*" { >>             set step_out 0 >> +           pass "$gdb_test_name" >>         } >> -       -re -wrap ".*" { >> +       -re -wrap "^main.*" { >> +           pass "$gdb_test_name" >> +       } >> +       -re -wrap "^\[0-9\].*" { >> +           incr iterations >> +           if { $iterations == $max_iterations } { >> +               fail "$gdb_test_name (reached $max_iterations iterations)" >> +               return >> +           } >>             send_gdb "next\n" >>             exp_continue >>         } >>      } >>  } > Ouch, sorry about that. The "$step_out == 1" case doesn't trigger for > me, so I'm not testing that part of the patch and I didn't notice the > problem. > > I sent a v3 with a slightly different change from what you posted above. > I put the "^main.*" part in the beginning of the "NEXT OVER THIS > RECURSION.*" regex. I thought that it makes sense because both strings > should appear in the same command output according to the excerpt you > pasted in the thread discussing v1 of this patch. Please let me know if > you would prefer me to use the alternative above. oops, my bad! I forgot the fact that "NEXT OVER THIS RECURSION" comes at the same time, and didn't think to check that. Since both of those outputs are together, there is no point in having 2 cases. You can choose to keep either one, and given my blunder here I would suggest keeping the "^main.*" regexp, but that is up to you. Sorry for the run-around with this one. -- Cheers, Bruno > >> And I wonder if we'd like to add a pass if step_out was never set to 1, so we don't get >> fewer passes when everything works? Not sure, I'd defer to Andrew or Tom on this one. > IMHO it's not necessary for the number of PASS to be the same if the > testcase passes or fails, but I'll wait for their input. >