From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14418 invoked by alias); 29 Aug 2018 15:47:45 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 14407 invoked by uid 89); 29 Aug 2018 15:47:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*tim X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Aug 2018 15:47:43 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7D0EF1161AB; Wed, 29 Aug 2018 11:47:41 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oE5O6T7UTFpC; Wed, 29 Aug 2018 11:47:41 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 4E0B7116157; Wed, 29 Aug 2018 11:47:41 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id EFC868587B; Wed, 29 Aug 2018 17:47:39 +0200 (CEST) Date: Wed, 29 Aug 2018 15:47:00 -0000 From: Joel Brobecker To: Simon Marchi Cc: Tim Newsome , gdb Subject: Re: gdb requires watchpoints to fire after the write Message-ID: <20180829154739.GB2521@adacore.com> References: <3833782b96d47551263798eb78f448bd@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3833782b96d47551263798eb78f448bd@polymtl.ca> User-Agent: Mutt/1.9.4 (2018-02-28) X-SW-Source: 2018-08/txt/msg00049.txt.bz2 > I don't have experience with many different architectures, but as far as I > know, the expectation of the GDB is that the watchpoint is reported after > the write. Otherwise it wouldn't need to save the value of the watched > expression. That's also how software watchpoints seem to work. > > The easiest way to deal with this would be to match GDB's expectation. But > if you really prefer the behavior of reporting the watchpoint before the > event, I suppose it's always possible to teach GDB about this, but it's a > less trivial task. Especially that when you GDB evaluates whether the watch > expression has changed value, it would need to consider the not-yet-written > value in memory. > > I'm also curious to know if other architectures work in this way (report the > event before the write actually take place). I seem to remember some architectures having different behaviors, and so we have a couple of entry points in GDB. For architecture-specific settings, we have gdbarch_have_nonsteppable_watchpoint. For target-specific settings, you would use target_have_steppable_watchpoint. (IIRC) -- Joel