From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: gdb-patches@sourceware.org References: <20220930091614.GA30107@delia.home> <0fd34b60-1eba-c7cf-3792-13cc2c2b1d9b@palves.net> <87o7uns9oa.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87o7uns9oa.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, 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-List-Received-Date: Sat, 08 Oct 2022 06:12:03 -0000 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