From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eL0TOSM2gGAPOgAAWB0awg (envelope-from ) for ; Wed, 21 Apr 2021 10:26:43 -0400 Received: by simark.ca (Postfix, from userid 112) id E7A1F1F104; Wed, 21 Apr 2021 10:26:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,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 0B6A71E783 for ; Wed, 21 Apr 2021 10:26:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8CAEC3838013; Wed, 21 Apr 2021 14:26:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CAEC3838013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619015202; bh=d4WayB8dM0ePYkxaJqAIram7hwPHO9a2EgUO0twDoSE=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=fEA93BXwTDtE6htvJfHDJV4syUM4jaexPpUGwwMWBfsSmoU0FVZXzvGKT09ocLm0P /JOW6iq4bt58ybC4iQeBbDbz8ZWWQ7TlSls24XuULDOj4CokfoFgmupP2br2c5jAho 4HqkNG1JDSVIMKFXlsJWrL6NQpdzM9NVsym01HvE= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5C9473860C32 for ; Wed, 21 Apr 2021 14:26:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C9473860C32 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 13LEQUWl027700 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Apr 2021 10:26:35 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 13LEQUWl027700 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 3BEBA1E783; Wed, 21 Apr 2021 10:26:30 -0400 (EDT) Subject: Re: [PATCH v3 4/4] gdb/mi: add a '--force-condition' flag to the '-break-insert' cmd To: "Aktemur, Tankut Baris" , "gdb-patches@sourceware.org" References: Message-ID: Date: Wed, 21 Apr 2021 10:26:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 21 Apr 2021 14:26:30 +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@sourceware.org Sender: "Gdb-patches" On 2021-04-21 9:49 a.m., Aktemur, Tankut Baris wrote:> On Wednesday, April 21, 2021 3:37 PM, Simon Marchi wrote: >>> diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp >>> index e46a6cc0ec6..5f1c6810389 100644 >>> --- a/gdb/testsuite/gdb.mi/mi-break.exp >>> +++ b/gdb/testsuite/gdb.mi/mi-break.exp >>> @@ -408,6 +408,30 @@ proc_with_prefix test_explicit_breakpoints {} { >>> ".*Source filename requires function, label, or line offset.*" >>> } >>> >>> +# Test forcing an invalid condition. >>> + >>> +proc_with_prefix test_forced_conditions {} { >>> + set warning ".*warning: failed to validate condition .* disabling.*" >>> + >>> + # Define a plain breakpoint first, and a condition later. >>> + mi_create_breakpoint "callme" "define a bp" "" >>> + mi_gdb_test "-break-condition --force \$bpnum bad" \ >>> + "${warning}\\^done" \ >>> + "invalid condition is forced" >> >> This literally sends >> >> -break-condition --force $bpnum bad >> >> But I don't understand what $bpnum refers to, can you explain? I'm a bit lost. > > It's GDB's internal variable that refers to the last-defined breakpoint's number. > It was my attempt to avoid hard-coding the breakpoint number. Ah! Good idea. I just didn't remember $bpnum (and will probably forget it promptly again). >>> + mi_gdb_test "-dprintf-insert -c bad --force-condition callme 123" \ >>> + "${warning}\\^done,$bp" \ >>> + "dprintf with forced condition" >> >> It's really just a nit because it doesn't affect the test, but a dprintf >> would normally take a format string, so I guess you meant: >> >> -dprintf-insert -c bad --force-condition callme "%d" 123 >> >> Or something like that. > > I meant "123" as a dummy format string that takes no parameters. > I'll convert it to `"%d" 123` to avoid confusion. Ah, makes sense. Well, what you had is ok. I'd put it between quotes just to be clear, or use "Hello" or something. Not a big deal in any case. Simon