From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by sourceware.org (Postfix) with ESMTPS id DF6A83857B8A for ; Mon, 10 Oct 2022 13:49:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF6A83857B8A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f49.google.com with SMTP id a3so17197400wrt.0 for ; Mon, 10 Oct 2022 06:49:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XAMhwaPPMJ0ENmqLYTGLiJPX2P0CHsUy3J1/nXHK86o=; b=fHWPEQ8g88zkDA32EcOz619qz4w6dqt9ryjn3JrAcFg2Du0iZnYreN0mzr02Fi7ZK8 zSDOotewRNvaUheNTqsPNDtxbewB0FAOoQ17j9YAPsGF+dzmwf556M/V1pNtEr/+kk4A 9FQYWJj3ksTvi3tI573LgMbz+qTJXPwZl2fHFMwJt1oOZKdbpIWFF/1D1k00Kj6qnUoo vXkT8SRNNuN9RrOlrMzVd2DBlUEdIm2Pj9WQSzA7rcSSIM4Ad6tOL8EeOWJNJnpzfDvK HuNlbGoWh9rj4Izc0EFZYSlYirTCY8kpsEyvgRLiJFqR5g/LzMJRuMbao1P5+NKQiet+ HktA== X-Gm-Message-State: ACrzQf1g07ayL/E51uG4Xe2isHzbkxzJRL1MuwehuqEEOyeDRW/CeMKq QwkIB6v747PI9Okf6oGcPRYo3ZBEEzDPGw== X-Google-Smtp-Source: AMsMyM4mqjnON/p0LGbSVq8rxDCsW7fijbXRBv6jjp7svoq20JaKB5HJmly5baIUqPYa4FWJYZszXA== X-Received: by 2002:a5d:47c5:0:b0:22e:655e:f258 with SMTP id o5-20020a5d47c5000000b0022e655ef258mr11032078wrc.569.1665409761393; Mon, 10 Oct 2022 06:49:21 -0700 (PDT) Received: from ?IPv6:2001:8a0:f93a:3b00:e038:5cdc:b8bf:4653? ([2001:8a0:f93a:3b00:e038:5cdc:b8bf:4653]) by smtp.gmail.com with ESMTPSA id b5-20020a056000054500b00228692033dcsm8798623wrf.91.2022.10.10.06.49.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Oct 2022 06:49:20 -0700 (PDT) Subject: Re: [RFC][gdb/cli] Add convenience vars _wp_old_val and _wp_val To: Tom Tromey Cc: Tom de Vries , gdb-patches@sourceware.org References: <20220930091614.GA30107@delia.home> <0fd34b60-1eba-c7cf-3792-13cc2c2b1d9b@palves.net> <87o7uns9oa.fsf@tromey.com> From: Pedro Alves Message-ID: <5cb844c2-55a6-0c76-7c60-57c3e72f9166@palves.net> Date: Mon, 10 Oct 2022 14:49:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87o7uns9oa.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: Mon, 10 Oct 2022 13:49:25 -0000 Hi, On 2022-10-07 8:41 p.m., 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_*, ... Hmm, indeed. Good point. > > 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. Also true. I withdraw my suggestion then. I guess one way to address this would be to make it so that the values were put in the value history, with their own unique history numbers. Like, e.g.: Hardware watchpoint 2: v Old value ($123) = 3 New value ($124) = 2 Not sure about that. Maybe we can think up something better. For some other time. Pedro Alves