From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24182 invoked by alias); 4 Dec 2009 08:51:46 -0000 Received: (qmail 24172 invoked by uid 22791); 4 Dec 2009 08:51:45 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Dec 2009 08:51:39 +0000 Received: (qmail 7599 invoked from network); 4 Dec 2009 08:51:37 -0000 Received: from unknown (HELO macbook-2.local) (stan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 4 Dec 2009 08:51:37 -0000 Message-ID: <4B18CD92.8000302@codesourcery.com> Date: Fri, 04 Dec 2009 08:51:00 -0000 From: Stan Shebs User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Aravinda CC: gdb@sourceware.org Subject: Re: GDB library to insert and delete watchpoints References: <26eb53620911301516x68ccc0edkf64ba2951c8ce3a3@mail.gmail.com> <26eb53620911301518y13e64bc0g95c6fe3c7b18b0c@mail.gmail.com> In-Reply-To: <26eb53620911301518y13e64bc0g95c6fe3c7b18b0c@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2009-12/txt/msg00026.txt.bz2 Aravinda wrote: > Hi, > > Im working on a project that currently requires inserting and deleting > watchpoints to monitor buffer overruns. I was looking at the > gdb-internals documentation which talks about a gdb library that can > be used to do exactly this. But I couldnt find more info on this. Im > looking for a ready to use library to be used with a kernel module > that allows for modifying the debug registers. kindly point me to any > sources if it can be done. > It just so happens that CodeSourcery recently did this for a customer that was using a debugging stub that ran as one of several threads in the application. It does need its own driver to modify the debug registers, and the stub calls it once it has done the bit-twiddling on mirrors of the registers. While it works well enough to have one thread set the debug registers of a different thread in a Linux app, there is some fancy dancing to make this work in nonstop - with all the threads running at once, you can get nasty races all over the place. Unfortunately, this is all CodeSourcery proprietary code and intermingled with the customer's app to boot, so I can't send you a copy. Stan