From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28904 invoked by alias); 5 Oct 2002 00:52:55 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 28790 invoked from network); 5 Oct 2002 00:52:54 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 5 Oct 2002 00:52:54 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g950XdX18821 for ; Fri, 4 Oct 2002 20:33:39 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g950qrf03984; Fri, 4 Oct 2002 20:52:53 -0400 Received: from localhost.localdomain (vpn50-3.rdu.redhat.com [172.16.50.3]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g950qq809000; Fri, 4 Oct 2002 20:52:52 -0400 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id g950qkx13582; Fri, 4 Oct 2002 17:52:46 -0700 Date: Fri, 04 Oct 2002 17:52:00 -0000 From: Kevin Buettner Message-Id: <1021005005246.ZM13581@localhost.localdomain> In-Reply-To: Fredrik Tolf "Re: Instruction address catching" (Oct 5, 2:21am) References: <1033774568.4573.2.camel@pc7> <1021005001104.ZM5068@localhost.localdomain> <1033777278.4573.7.camel@pc7> To: Fredrik Tolf Subject: Re: Instruction address catching Cc: gdb@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-10/txt/msg00054.txt.bz2 On Oct 5, 2:21am, Fredrik Tolf wrote: > On Sat, 2002-10-05 at 02:11, Kevin Buettner wrote: > > On Oct 5, 1:36am, Fredrik Tolf wrote: > > > > > Is it possible, with the current version of gdb, to make it detect every > > > time an address is written to, and to make it stop only if the address > > > of the instruction that wrote to that address isn't equal to a specific > > > value. > > > > Do it like this: > > > > (gdb) watch foo > > Hardware watchpoint 1: foo > > (gdb) condition 1 $pc != 0x80484c8 > > > > The address to compare $pc against should be the address of the > > instruction *after* the one that writes to ``foo''. It's probably > > easier to figure this out by simply setting a watchpoint on foo, > > running 'til it's hit, and if that's not the one you're interested > > in, add a condition so that it won't stop there again. > > > > > If it's possible, does it work in a multithreaded application? > > > > It should. If it doesn't, it's a bug. > > Are you sure? Wouldn't the pc it compares to be that of the selected > thread and not that of the thread that wrote? The thread that triggers the watchpoint becomes the selected thread for the purposes of checking the condition. (At least, I think that's the way it works.) I've just tried it with a simple (threaded) example and it seems to work as expected... Kevin