From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4174 invoked by alias); 3 Apr 2008 21:11:48 -0000 Received: (qmail 4156 invoked by uid 22791); 3 Apr 2008 21:11:46 -0000 X-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_74,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; Thu, 03 Apr 2008 21:11:28 +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 m33LBQTm005163 for ; Thu, 3 Apr 2008 17:11:26 -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 m33LBQ1Q024502 for ; Thu, 3 Apr 2008 17:11:26 -0400 Received: from localhost.localdomain (vpn-14-103.rdu.redhat.com [10.11.14.103]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m33LBOLv025750 for ; Thu, 3 Apr 2008 17:11:24 -0400 Message-ID: <47F547FB.1040206@redhat.com> Date: Thu, 03 Apr 2008 22:29: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 readStatusRegister, use readControlRegister and reduce scope of both functions. References: <20080403210821.3351.qmail@sourceware.org> In-Reply-To: <20080403210821.3351.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/msg00022.txt.bz2 pmuldoon@sourceware.org wrote: This commit mainly deals with reducing function scope, and dealing with internal class niceties. In these classes I am now moving the reading (and soon writing) of status/control registers to be gated from a function. Also, there is never a need for high-level to manipulate these registers directly, so function scope reduction to protected was appropriate. Regards Phil > The branch, master has been updated > via ae7d5f2086a6fcd8f18e74223c6075476db0e0bb (commit) > from c7c9068679a57d65feaa31102116f95bd5d56fbe (commit) > > Those revisions listed above that are new to this repository have > not appeared on any other notification email. > > - Log ----------------------------------------------------------------- > commit ae7d5f2086a6fcd8f18e74223c6075476db0e0bb > Author: Phil Muldoon > Date: Thu Apr 3 22:07:27 2008 +0100 > > Implement readStatusRegister, use readControlRegister and reduce scope of both functions. > > 2008-04-03 Phil Muldoon > > * WatchpointFunctions.java (readStatusRegister): Declare. > (readControlRegister): Reduce scope to protected. > * IA32WatchpointFunctions.java (readStatusRegister): Implement. > (hasWatchpointTriggered): Use readStatusRegister. > (deleteWatchpoint): Use readControlRegister. > (readWatchpoint): Ditto. > (setWatchpoint): Ditto. > * X8664WatchpointFunctions.java (readStatusRegister): Ditto. > (hasWatchpointTriggered): use readStatusRegister. > (deleteWatchpoint): Use readControlRegister. > (readWatchpoint): Ditto. > (setWatchpoint): Ditto. > > ----------------------------------------------------------------------- > > Summary of changes: > frysk-core/frysk/isa/watchpoints/ChangeLog | 16 +++++++++++++ > .../isa/watchpoints/IA32WatchpointFunctions.java | 24 ++++++++++++++----- > .../frysk/isa/watchpoints/WatchpointFunctions.java | 14 ++++++++--- > .../isa/watchpoints/X8664WatchpointFunctions.java | 24 +++++++++++++------ > 4 files changed, 59 insertions(+), 19 deletions(-) > > First 500 lines of diff: > diff --git a/frysk-core/frysk/isa/watchpoints/ChangeLog b/frysk-core/frysk/isa/watchpoints/ChangeLog > index 93952e1..33613b2 100644 > --- a/frysk-core/frysk/isa/watchpoints/ChangeLog > +++ b/frysk-core/frysk/isa/watchpoints/ChangeLog > @@ -1,5 +1,21 @@ > 2008-04-03 Phil Muldoon > > + * WatchpointFunctions.java (readStatusRegister): Declare. > + (readControlRegister): Reduce scope to protected. > + * IA32WatchpointFunctions.java (readStatusRegister): Implement. > + (hasWatchpointTriggered): Use readStatusRegister. > + (deleteWatchpoint): Use readControlRegister. > + (readWatchpoint): Ditto. > + (setWatchpoint): Ditto. > + * X8664WatchpointFunctions.java (readStatusRegister): Ditto. > + (hasWatchpointTriggered): use readStatusRegister. > + (deleteWatchpoint): Use readControlRegister. > + (readWatchpoint): Ditto. > + (setWatchpoint): Ditto. > + > + > +2008-04-02 Phil Muldoon > + > * TestWatchpoint.java (Symbol.Symbol): New temporary class to resolve > Elf symbols. > (getGlobalSymbolAddress): New function. > diff --git a/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java > index e2883c7..e7cc0a8 100644 > --- a/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java > +++ b/frysk-core/frysk/isa/watchpoints/IA32WatchpointFunctions.java > @@ -61,7 +61,6 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > * 1,2 or 4 bytes. > * @param writeOnly - When true, only trigger when address is > * written. False, trigger when address is read or written to. > - * @param localOnly - set local extant only. > */ > public void setWatchpoint(Task task, int index, > long addr, int range, > @@ -76,7 +75,7 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > task.setRegister(IA32Registers.DEBUG_REGS_GROUP.getRegisters()[index], > addr); > // Get the Debug Control Register > - long debugControl = task.getRegister(IA32Registers.DEBUG_CONTROL); > + long debugControl = readControlRegister(task); > > // First eight bits of register define the global/local > // status of each of the four DR registers. Two bits per > @@ -155,8 +154,8 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > long address = task.getRegister( > IA32Registers.DEBUG_REGS_GROUP.getRegisters()[index]); > > - // Get debug status register for all other values > - long debugStatus = task.getRegister(IA32Registers.DEBUG_CONTROL); > + // Get the Debug Control Register > + long debugStatus = readControlRegister(task); > > boolean writeOnly = false; > > @@ -200,7 +199,7 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > task.setRegister(IA32Registers.DEBUG_REGS_GROUP.getRegisters()[index], > 0x0L); > // Get the Debug Control Register > - long debugControl = task.getRegister(IA32Registers.DEBUG_CONTROL); > + long debugControl = readControlRegister(task); > > // First eight bits of register define the global/local > // status of each of the four DR registers. Two bits per > @@ -232,7 +231,7 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > * register from. > */ > public boolean hasWatchpointTriggered(Task task, int index) { > - long debugStatus = task.getRegister(IA32Registers.DEBUG_STATUS); > + long debugStatus = readStatusRegister(task); > return (debugStatus & (1L << index)) != 0; > } > > @@ -243,10 +242,21 @@ class IA32WatchpointFunctions extends WatchpointFunctions { > * @param task - task to read the debug control > * register from. > */ > - public long readControlRegister(Task task) { > + protected long readControlRegister(Task task) { > return task.getRegister(IA32Registers.DEBUG_CONTROL); > } > > + /** > + * Reads the Debug status register. > + * > + * @param task - task to read the debug status > + * register from. > + */ > + protected long readStatusRegister(Task task) { > + return task.getRegister(IA32Registers.DEBUG_STATUS); > + } > + > + > private boolean testBit(long register, int bitToTest) { > return (register & (1L << bitToTest)) != 0; > } > diff --git a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java > index a5a30a9..0eb247a 100644 > --- a/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java > +++ b/frysk-core/frysk/isa/watchpoints/WatchpointFunctions.java > @@ -42,7 +42,6 @@ package frysk.isa.watchpoints; > > import java.util.ArrayList; > import java.util.List; > - > import frysk.proc.Task; > > public abstract class WatchpointFunctions { > @@ -62,7 +61,6 @@ public abstract class WatchpointFunctions { > * 1,2 or 4 bytes. 8 on 64 bit systems. Architecture dependent. > * @param writeOnly - When true, only trigger when address is > * written. False, trigger when address is read or written to. > - * @param localOnly - set local extant only. > */ > public abstract void setWatchpoint(Task task, int index, > long addr, int range, > @@ -105,15 +103,23 @@ public abstract class WatchpointFunctions { > } > return listOfWP; > } > + > /** > * Reads the Debug control register. > * > * @param task - task to read the debug control > * register from. > */ > - public abstract long readControlRegister(Task task); > + protected abstract long readControlRegister(Task task); > + > + /** > + * Reads the Debug status register. > + * > + * @param task - task to read the debug status > + * register from. > + */ > + protected abstract long readStatusRegister(Task task); > > - > /** > * Reads the Debug Status Register and checks if > * the breakpoint specified has fired. > diff --git a/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java b/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java > index 198fa42..5b9aa03 100644 > --- a/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java > +++ b/frysk-core/frysk/isa/watchpoints/X8664WatchpointFunctions.java > @@ -61,7 +61,6 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > * 1,24, or 8 bytes. > * @param writeOnly - When true, only trigger when address is > * written. False, trigger when address is read or written to. > - * @param localOnly - set local extant only. > */ > public void setWatchpoint(Task task, int index, > long addr, int range, > @@ -75,7 +74,7 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > task.setRegister(X8664Registers.DEBUG_REGS_GROUP.getRegisters()[index], > addr); > // Get the Debug Control Register > - long debugControl = task.getRegister(X8664Registers.DEBUG_CONTROL); > + long debugControl = readControlRegister(task); > > // First eight bits of register define the global/local > // status of each of the four DR registers. Two bits per > @@ -152,8 +151,8 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > X8664Registers.DEBUG_REGS_GROUP.getRegisters()[index]); > > // Get debug status register for all other values > - long debugStatus = task.getRegister(X8664Registers.DEBUG_CONTROL); > - > + long debugStatus = readControlRegister(task); > + > boolean writeOnly = false; > > // To find write/read, or read only the bit setting is 0 + no of > @@ -197,7 +196,7 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > task.setRegister(X8664Registers.DEBUG_REGS_GROUP.getRegisters()[index], > 0x0L); > // Get the Debug Control Register > - long debugControl = task.getRegister(X8664Registers.DEBUG_CONTROL); > + long debugControl = readControlRegister(task); > > // First eight bits of register define the global/local > // status of each of the four DR registers. Two bits per > @@ -222,18 +221,27 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > } > > > - > /** > * Reads the Debug control register. > * > * @param task - task to read the debug control > * register from. > */ > - public long readControlRegister(Task task) { > + protected long readControlRegister(Task task) { > return task.getRegister(X8664Registers.DEBUG_CONTROL); > } > > /** > + * Reads the Debug cstatus register. > + * > + * @param task - task to read the debug status > + * register from. > + */ > + protected long readStatusRegister(Task task) { > + return task.getRegister(X8664Registers.DEBUG_STATUS); > + } > + > + /** > * Reads the Debug Status Register and checks if > * the breakpoint specified has fired. > * > @@ -241,7 +249,7 @@ class X8664WatchpointFunctions extends WatchpointFunctions { > * register from. > */ > public boolean hasWatchpointTriggered(Task task, int index) { > - long debugStatus = task.getRegister(X8664Registers.DEBUG_STATUS); > + long debugStatus = readStatusRegister(task); > return (debugStatus & (1L << index)) != 0; > } > > > > hooks/post-receive > -- > frysk system monitor/debugger >