From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3627 invoked by alias); 5 Oct 2002 01:09:34 -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 3614 invoked from network); 5 Oct 2002 01:09:33 -0000 Received: from unknown (HELO localhost.localdomain) (217.215.27.171) by sources.redhat.com with SMTP; 5 Oct 2002 01:09:33 -0000 Received: from [192.168.0.253] ([192.168.0.253]) by localhost.localdomain (8.11.6/8.11.2) with ESMTP id g9519Pd32199; Sat, 5 Oct 2002 03:09:25 +0200 Subject: Re: Instruction address catching From: Fredrik Tolf To: Kevin Buettner Cc: gdb@sources.redhat.com In-Reply-To: <1021005005246.ZM13581@localhost.localdomain> References: <1033774568.4573.2.camel@pc7> <1021005001104.ZM5068@localhost.localdomain> <1033777278.4573.7.camel@pc7> <1021005005246.ZM13581@localhost.localdomain> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 04 Oct 2002 18:09:00 -0000 Message-Id: <1033780168.4573.14.camel@pc7> Mime-Version: 1.0 X-SW-Source: 2002-10/txt/msg00055.txt.bz2 On Sat, 2002-10-05 at 02:52, Kevin Buettner wrote: > 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 By the way: I don't seem to be able to set hardware watchpoints... I'm running i 2.4.19 linux kernel on an AMD Thunderbird, could that have something to do with it? > > > (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... OK... if you say so... I'll try it! Thanks a thousandfold! > > Kevin >