public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Implement readStatusRegister, use readControlRegister and reduce scope of both functions.
@ 2008-04-03 21:08 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2008-04-03 21:08 UTC (permalink / raw)
  To: frysk-cvs

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 <pmuldoon@redhat.com>
Date:   Thu Apr 3 22:07:27 2008 +0100

    Implement readStatusRegister, use readControlRegister and reduce scope of both functions.
    
    2008-04-03  Phil Muldoon  <pmuldoon@redhat.com>
    
            * 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  <pmuldoon@redhat.com>
 
+	* 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  <pmuldoon@redhat.com>
+
 	* 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-03 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03 21:08 [SCM] master: Implement readStatusRegister, use readControlRegister and reduce scope of both functions pmuldoon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).