From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30562 invoked by alias); 1 Apr 2008 20:58:31 -0000 Received: (qmail 30552 invoked by uid 22791); 1 Apr 2008 20:58:30 -0000 X-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 01 Apr 2008 20:58:13 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m31KwBOE032224 for ; Tue, 1 Apr 2008 16:58:11 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m31KwBKO015685 for ; Tue, 1 Apr 2008 16:58:11 -0400 Received: from localhost.localdomain (vpn-15-72.rdu.redhat.com [10.11.15.72]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m31Kw9n6004466 for ; Tue, 1 Apr 2008 16:58:10 -0400 Message-ID: <47F2A1E1.1070404@redhat.com> Date: Tue, 01 Apr 2008 20:58:00 -0000 From: Phil Muldoon User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: frysk@sourceware.org Subject: Re: [SCM] master: Implement hasWatchpointTriggered in abstract, and sub-classes. References: <20080401204912.27374.qmail@sourceware.org> In-Reply-To: <20080401204912.27374.qmail@sourceware.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00001.txt.bz2 pmuldoon@sourceware.org wrote: This implements a function that checks the debug status register on whether a hardware debug data breakpoint (watchpoint) has been triggered. Normally this function is called after a SIGTRAP is issued from ptrace. On x8664 and IA32 the first four bits represent the four hardware breakpoint registers. If bit 0 = 1 then the debug hardware data breakpoint (D0) has triggered, bit 1 for D1 and so on. I believe the software is responsible for clearing the bit if set, and I have not done this here. I'm torn whether to reset the bit if: debugStatus & (1L << index)) != 0; where debug status is the debug status register, and index is the watchpoint to check. Should the bit be reset in hasWatchpointTriggered? Or in a separate function function called as a separate API? Regards Phil > The branch, master has been updated > via a0fc4305e0afa24959ac5cd073f65c6bb50eb8b0 (commit) > from b927d6c13dcc27d155895895fcb958b4c32fb595 (commit) > > Those revisions listed above that are new to this repository have > not appeared on any other notification email. > > - Log ----------------------------------------------------------------- > commit a0fc4305e0afa24959ac5cd073f65c6bb50eb8b0 > Author: Phil Muldoon > Date: Tue Apr 1 21:48:19 2008 +0100 > > Implement hasWatchpointTriggered in abstract, and sub-classes. > > 2008-04-01 Phil Muldoon > > * Watchpoint.java (hasWatchpointTriggered): Define. > * IA32Watchpoint.java (hasWatchpointTriggered): Implement. > * X8664Watchpoint.java (hasWatchpointTriggered): Ditto. > > ----------------------------------------------------------------------- > > Summary of changes: > frysk-core/frysk/isa/watchpoints/ChangeLog | 6 ++++++ > .../frysk/isa/watchpoints/IA32Watchpoint.java | 13 ++++++++++++- > frysk-core/frysk/isa/watchpoints/Watchpoint.java | 10 ++++++++++ > .../frysk/isa/watchpoints/X8664Watchpoint.java | 12 ++++++++++++ > 4 files changed, 40 insertions(+), 1 deletions(-) > > First 500 lines of diff: > diff --git a/frysk-core/frysk/isa/watchpoints/ChangeLog b/frysk-core/frysk/isa/watchpoints/ChangeLog > index 0e4f56f..f53652b 100644 > --- a/frysk-core/frysk/isa/watchpoints/ChangeLog > +++ b/frysk-core/frysk/isa/watchpoints/ChangeLog > @@ -1,3 +1,9 @@ > +2008-04-01 Phil Muldoon > + > + * Watchpoint.java (hasWatchpointTriggered): Define. > + * IA32Watchpoint.java (hasWatchpointTriggered): Implement. > + * X8664Watchpoint.java (hasWatchpointTriggered): Ditto. > + > 2008-03-28 Phil Muldoon > > * Watchpoint.java: New. Initial Implementation. > diff --git a/frysk-core/frysk/isa/watchpoints/IA32Watchpoint.java b/frysk-core/frysk/isa/watchpoints/IA32Watchpoint.java > index 3627d03..5f97636 100644 > --- a/frysk-core/frysk/isa/watchpoints/IA32Watchpoint.java > +++ b/frysk-core/frysk/isa/watchpoints/IA32Watchpoint.java > @@ -197,7 +197,18 @@ class IA32Watchpoint extends Watchpoint { > task.setRegister(IA32Registers.DEBUG_CONTROL, debugControl); > } > > - > + /** > + * Reads the Debug Status Register and checks if > + * the breakpoint specified has fired. > + * > + * @param task - task to read the debug control > + * register from. > + */ > + public boolean hasWatchpointTriggered(Task task, int index) { > + long debugStatus = task.getRegister(IA32Registers.DEBUG_STATUS); > + return (debugStatus & (1L << index)) != 0; > + } > + > > /** > * Reads the Debug control register. > diff --git a/frysk-core/frysk/isa/watchpoints/Watchpoint.java b/frysk-core/frysk/isa/watchpoints/Watchpoint.java > index fc8c234..a0ef202 100644 > --- a/frysk-core/frysk/isa/watchpoints/Watchpoint.java > +++ b/frysk-core/frysk/isa/watchpoints/Watchpoint.java > @@ -94,6 +94,16 @@ public abstract class Watchpoint { > */ > public abstract long readControlRegister(Task task); > > + > + /** > + * Reads the Debug Status Register and checks if > + * the breakpoint specified has fired. > + * > + * @param task - task to read the debug control > + * register from. > + */ > + public abstract boolean hasWatchpointTriggered(Task task, int index); > + > /** > * Returns number of watchpoints for this architecture > * > diff --git a/frysk-core/frysk/isa/watchpoints/X8664Watchpoint.java b/frysk-core/frysk/isa/watchpoints/X8664Watchpoint.java > index c581f92..1df98a5 100644 > --- a/frysk-core/frysk/isa/watchpoints/X8664Watchpoint.java > +++ b/frysk-core/frysk/isa/watchpoints/X8664Watchpoint.java > @@ -205,5 +205,17 @@ class X8664Watchpoint extends Watchpoint { > return task.getRegister(X8664Registers.DEBUG_CONTROL); > } > > + /** > + * Reads the Debug Status Register and checks if > + * the breakpoint specified has fired. > + * > + * @param task - task to read the debug control > + * register from. > + */ > + public boolean hasWatchpointTriggered(Task task, int index) { > + long debugStatus = task.getRegister(X8664Registers.DEBUG_STATUS); > + return (debugStatus & (1L << index)) != 0; > + } > + > > } > > > hooks/post-receive > -- > frysk system monitor/debugger >