From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gV+UA8oUQWPQvwcAWB0awg (envelope-from ) for ; Sat, 08 Oct 2022 02:12:26 -0400 Received: by simark.ca (Postfix, from userid 112) id F1D271E112; Sat, 8 Oct 2022 02:12:25 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=GGSHSKq6; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 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.6 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 904EC1E0D5 for ; Sat, 8 Oct 2022 02:12:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A1E9384BC02 for ; Sat, 8 Oct 2022 06:12:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A1E9384BC02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665209542; bh=l4UtxsW1h2BUUK/UGZJOw64RKlcIKS9vBmwUdBhNixc=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=GGSHSKq6RKBLhfvg2AS/UZQnAoud3BQf53T57RkuHTCWG1sodKfMX+g+LgvNoXOLj tI8clS/Xzmrj3klD/C0kutxm5Qzxzfm/lfmPZusu4BO4CzedazRoUhPiAC9L2K+7Hh uXcDXMSP8enrNbv4Aj8GlwbMvH88n/FLQvX7KmA4= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id A4E7A3858CDB for ; Sat, 8 Oct 2022 06:12:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4E7A3858CDB Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A2F2621979; Sat, 8 Oct 2022 06:12:00 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5FF411331A; Sat, 8 Oct 2022 06:12:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hsIUFbAUQWM+NgAAMHmgww (envelope-from ); Sat, 08 Oct 2022 06:12:00 +0000 Message-ID: <2e3deaf2-3896-9db8-8144-c62bb669921f@suse.de> Date: Sat, 8 Oct 2022 08:11:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [RFC][gdb/cli] Add convenience vars _wp_old_val and _wp_val Content-Language: en-US To: Tom Tromey , Pedro Alves References: <20220930091614.GA30107@delia.home> <0fd34b60-1eba-c7cf-3792-13cc2c2b1d9b@palves.net> <87o7uns9oa.fsf@tromey.com> In-Reply-To: <87o7uns9oa.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 10/7/22 21:41, Tom Tromey wrote: > Pedro> It can't be safely used in regular CLI after the watchpoint hit is process, though, > Pedro> given another watchpoint may trigger meanwhile. I mean, say, in non-stop, you do: > > FWIW gdb probably already has this problem with some other convenience > variables, like $_exitcode, $_exception, $_probe_*, ... > > So, maybe adding one more isn't so bad. Or maybe now is when we want to > think of a general solution. > > I'm not sure this works though: > > Pedro> A way to make this safer would be to make it a convenience function instead, that > Pedro> takes as argument the number of the watchpoint, like: > > ... because it seems to me that the same watchpoint can be hit any > number of times. I wondered if we can side-step the issue by defining the variable only during watchpoint_check, and undefining it immediately afterwards. Thanks, - Tom