public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: 2008-02-26  Phil Muldoon  <pmuldoon@redhat.com>
@ 2008-02-26 16:43 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2008-02-26 16:43 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  491d4ec7ba3a8e3878cca1c9f916ca7069d79469 (commit)
      from  1f00d0320e752d60da44436f1a0612a64123702a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 491d4ec7ba3a8e3878cca1c9f916ca7069d79469
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Tue Feb 26 16:43:44 2008 +0000

    2008-02-26  Phil Muldoon  <pmuldoon@redhat.com>
    
            * LinuxPtraceTask.java: Rename watchpoint variables.
            * WatchpointAddresses.java: Update Comments.
            (addBreakpoint): Rename addWatchpoint.
            (removeBreakpoint): Rename removeWatchpoint.
            (getCodeObservers): Rename getWatchObservers.
            (getBreakpoint): Rename getWatchpoint.
            (removeAllCodeObservers): Rename removeAllWatchObservers.
            * Watchpoint.java: Rename installed.
            (install, create, remove, isInstalled):
            Rename breakpoint -> watchpoint

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/proc/live/ChangeLog               |   14 ++++
 frysk-core/frysk/proc/live/LinuxPtraceTask.java    |   37 ++++++-----
 frysk-core/frysk/proc/live/Watchpoint.java         |   28 ++++----
 .../frysk/proc/live/WatchpointAddresses.java       |   65 +++++++++----------
 4 files changed, 79 insertions(+), 65 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 4beec52..7e2001b 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,17 @@
+2008-02-26  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* LinuxPtraceTask.java: Rename watchpoint variables.
+	* WatchpointAddresses.java: Update Comments.
+	(addBreakpoint): Rename addWatchpoint.
+	(removeBreakpoint): Rename removeWatchpoint.
+	(getCodeObservers): Rename getWatchObservers.
+	(getBreakpoint): Rename getWatchpoint.
+	(removeAllCodeObservers): Rename removeAllWatchObservers.
+	* Watchpoint.java: Rename installed.
+	(install, create, remove, isInstalled): 
+	Rename breakpoint -> watchpoint
+	
+
 2008-02-20  Andrew Cagney  <cagney@redhat.com>
 
 	* LinuxPtraceProcState.java: Get the task from the
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
index 40e14b5..10e8a25 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
@@ -887,9 +887,9 @@ public class LinuxPtraceTask extends LiveTask {
 
 	private final Task task;
 
-	private final long address;
+	private final long watchAddress;
 	
-	private final int length;
+	private final int watchLength;
 
 	private final boolean addition;
 
@@ -897,24 +897,24 @@ public class LinuxPtraceTask extends LiveTask {
 			 boolean addition) {
 	    this.watch = watch;
 	    this.task = task;
-	    this.address = address;
+	    this.watchAddress = address;
+	    this.watchLength = length;
 	    this.addition = addition;
-	    this.length = length;
 	}
 
 	public void run() {
 	    if (addition) {
-		boolean mustInstall = watchpoints.addBreakpoint(watch, address, length);
-		if (mustInstall) {
+		boolean shouldInstall = watchpoints.addWatchpoint(watch, watchAddress, watchLength);
+		if (shouldInstall) {
 		    Watchpoint watchpoint;
-		    watchpoint = Watchpoint.create(address, length, LinuxPtraceTask.this);
+		    watchpoint = Watchpoint.create(watchAddress, watchLength, LinuxPtraceTask.this);
 		    watchpoint.install(task);
 		}
 	    } else {
-		boolean mustRemove = watchpoints.removeBreakpoint(watch, address, length);
+		boolean mustRemove = watchpoints.removeWatchpoint(watch, watchAddress, watchLength);
 		if (mustRemove) {
 		    Watchpoint watchpoint;
-		    watchpoint = Watchpoint.create(address, length, LinuxPtraceTask.this);
+		    watchpoint = Watchpoint.create(watchAddress, watchLength, LinuxPtraceTask.this);
 		    watchpoint.remove(task);
 		}
 	    }
@@ -933,15 +933,17 @@ public class LinuxPtraceTask extends LiveTask {
 				TaskObserver.Watch observer,
 				final long address,
 				final int length) {
+
 	WatchpointAction watchAction = new WatchpointAction(observer, task, address, length, true);
 	TaskObservation to;
+
 	to = new TaskObservation((LinuxPtraceTask) task, observable, observer,
 				 watchAction, true) {
 		public void execute() {
 		    handleAddObservation(this);
 		}
 		public boolean needsSuspendedAction() {
-		    return watchpoints.getCodeObservers(address, length) == null;
+		    return watchpoints.getWatchObservers(address, length) == null;
 		}
 	    };
 	Manager.eventLoop.add(to);
@@ -949,26 +951,27 @@ public class LinuxPtraceTask extends LiveTask {
 
     /**
      * (Internal) Tell the process to delete the specified Watchpoint
-     * observation, detaching from the process if necessary.
+     * observation, detaching if  necessary.
      */
     void requestDeleteWatchObserver(Task task, TaskObservable observable,
 				   TaskObserver.Watch observer,
 				   final long address,
 				   final int length)    {
 	WatchpointAction watchAction = new WatchpointAction(observer, task, address, length, false);
-	TaskObservation to;
-	to = new TaskObservation((LinuxPtraceTask)task, observable, observer, 
-				 watchAction, false) {
+	TaskObservation observation;
+
+	observation = new TaskObservation((LinuxPtraceTask)task, observable, observer, 
+					  watchAction, false) {
 		public void execute() {
 		    newState = oldState().handleDeleteObservation(LinuxPtraceTask.this, this);
 		}
-
+		
 		public boolean needsSuspendedAction() {
-		    return watchpoints.getCodeObservers(address, length).size() == 1;
+		    return watchpoints.getWatchObservers(address, length).size() == 1;
 		}
 	    };
 
-	Manager.eventLoop.add(to);
+	Manager.eventLoop.add(observation);
     }
 
     
diff --git a/frysk-core/frysk/proc/live/Watchpoint.java b/frysk-core/frysk/proc/live/Watchpoint.java
index 59c25a4..7915d84 100644
--- a/frysk-core/frysk/proc/live/Watchpoint.java
+++ b/frysk-core/frysk/proc/live/Watchpoint.java
@@ -58,8 +58,8 @@ public class Watchpoint implements Comparable
   private final Task task;
 
 
-  // Static cache of installed break points.
-  private static HashMap installed = new HashMap();
+  // Static cache of installed watchpoints.
+  private static HashMap installedWatchpoints = new HashMap();
 
 
 
@@ -88,16 +88,16 @@ public class Watchpoint implements Comparable
    */
   public static Watchpoint create(long address, int length, Task task)
   {
-    Watchpoint breakpoint = new Watchpoint(address, length, task);
+    Watchpoint watchpoint = new Watchpoint(address, length, task);
 
     // If possible return an existing installed breakpoint.
-    synchronized (installed)
+    synchronized (installedWatchpoints)
       {
-	Watchpoint existing = (Watchpoint) installed.get(breakpoint);
+	Watchpoint existing = (Watchpoint) installedWatchpoints.get(watchpoint);
 	if (existing != null)
 	  return existing;
       }
-    return breakpoint;
+    return watchpoint;
   }
 
   public long getAddress()
@@ -113,13 +113,13 @@ public class Watchpoint implements Comparable
    */
   public void install(Task task)
   {
-    synchronized (installed)
+    synchronized (installedWatchpoints)
       {
-	Watchpoint existing = (Watchpoint) installed.get(this);
+	Watchpoint existing = (Watchpoint) installedWatchpoints.get(this);
 	if (existing != null)
-	  throw new IllegalStateException("Already installed: " + this);
+	  throw new IllegalStateException("Watchpoint Already installed: " + this);
 
-	installed.put(this, this);
+	installedWatchpoints.put(this, this);
     
 	set(task);
       }
@@ -148,9 +148,9 @@ public class Watchpoint implements Comparable
    */
   public void remove(Task task)
   {
-    synchronized (installed)
+    synchronized (installedWatchpoints)
       {
-	if (! this.equals(installed.remove(this)))
+	if (! this.equals(installedWatchpoints.remove(this)))
 	  throw new IllegalStateException("Not installed: " + this);
 
 	reset(task);
@@ -190,9 +190,9 @@ public class Watchpoint implements Comparable
    */
   public boolean isInstalled()
   {
-    synchronized(installed)
+    synchronized(installedWatchpoints)
       {
-	return this.equals(installed.get(this));
+	return this.equals(installedWatchpoints.get(this));
       }
   }
 
diff --git a/frysk-core/frysk/proc/live/WatchpointAddresses.java b/frysk-core/frysk/proc/live/WatchpointAddresses.java
index aba7d16..61f020c 100644
--- a/frysk-core/frysk/proc/live/WatchpointAddresses.java
+++ b/frysk-core/frysk/proc/live/WatchpointAddresses.java
@@ -49,36 +49,33 @@ import frysk.proc.Task;
 import frysk.proc.TaskObserver;
 
 /**
- * Keeps track of address breakpoints for a Proc (all Tasks of a Proc
- * share the same breakpoints).  Address breakpoints are absolute
- * addresses in the Proc text area.  This class is used to construct
- * higher level breakpoint observers.  The class keeps track of the
- * number of observers interested in an address for the Proc. It adds
- * or deletes the actual breakpoint depending on the number of active
- * observers.  But it does not handle mapping to and from the language
- * model to the actual addresses.  It also doesn't handle tracking of
- * future breakpoints and code module loading.
- * <p>
- * This datastructure isn't multithread safe, it should only be called
- * from the eventloop in response to requests pending for the Proc.
+ * Keeps track of address watchppoints for a Proc (all Tasks of a Proc
+ * share the same breakpoints).  Watchpoints absolute
+ * addresses with a length Proc text/data area.  
+ * 
+ * This class is used to construct
+ * higher level watchpoint observers.  The class keeps track of the
+ * number of observers interested in an address/length for the Proc. It adds
+ * or deletes the actual watchpoints depending on the number of active
+ * observers.  
  */
 public class WatchpointAddresses
 {
   /**
-   * Proc used to set breakpoints and which sents us notifications
-   * when breakpoints are hit.
+   * Proc used to set watchpoints and which sents us notifications
+   * when watchpoints are hit.
    */
   private final Task task;
 
   /**
-   * Maps breakpoint addresses to a list of observers.  We assume the
+   * Maps watchpoints addresses/length to a list of observers.  We assume the
    * number of observers for each address is small, so an ArrayList
    * will do.
    */
   private final HashMap map;
 
   /**
-   * A sorted set (on address) of Breakpoints, used for getBreakpoints().
+   * A sorted set (on address) of Watchpoints, used for getWatchpoints().
    */
   private final TreeSet watchpoints;
 
@@ -93,22 +90,22 @@ public class WatchpointAddresses
   }
 
   /**
-   * Adds a breakpoint observer to an address. If there is not yet a
-   * breakpoint at the given address the given Task is asked to add
+   * Adds a watchpoint observer to an address. If there is not yet a
+   * watchpoint at the given address the given Task is asked to add
    * one (the method will return true). Otherwise the observer is
-   * added to the list of objects to notify when the breakpoint is
+   * added to the list of objects to notify when the watchpoint is
    * hit (and the method returns false).
    */
-  public boolean addBreakpoint(TaskObserver.Watch observer, long address, int length)
+  public boolean addWatchpoint(TaskObserver.Watch observer, long address, int length)
   {
-    Watchpoint breakpoint = Watchpoint.create(address, length, task);
+    Watchpoint watchpoint = Watchpoint.create(address, length, task);
 
-    ArrayList list = (ArrayList) map.get(breakpoint);
+    ArrayList list = (ArrayList) map.get(watchpoint);
     if (list == null)
       {
-	watchpoints.add(breakpoint);
+	  watchpoints.add(watchpoint);
 	list = new ArrayList();
-	map.put(breakpoint, list);
+	map.put(watchpoint, list);
 	list.add(observer);
 	return true;
       }
@@ -120,16 +117,16 @@ public class WatchpointAddresses
   }
 
   /**
-   * Removes an observer from a breakpoint. If this is the last
+   * Removes an observer from a watchpoint. If this is the last
    * observer interested in this particular address then the
-   * breakpoint is really removed by requestion the given task to do
+   * watchpoint is really removed by requestion the given task to do
    * so (the method will return true). Otherwise just this observer
-   * will be removed from the list of observers for the breakpoint
+   * will be removed from the list of observers for the watchpoint
    * address (and the method will return false).
    *
    * @throws IllegalArgumentException if the observer was never added.
    */
-  public boolean removeBreakpoint(TaskObserver.Watch observer, long address, int length)
+  public boolean removeWatchpoint(TaskObserver.Watch observer, long address, int length)
   {
     Watchpoint watchpoint = Watchpoint.create(address, length, task);
     ArrayList list = (ArrayList) map.get(watchpoint);
@@ -148,11 +145,11 @@ public class WatchpointAddresses
   }
 
     /**
-     * Called by the Proc when it has trapped a breakpoint.  Returns a
-     * Collection of TaskObserver.Code observers interested in the given
-     * address or null when no Code observer was installed on this address.
+     * Called by the Proc when it has trapped a watchpoint.  Returns a
+     * Collection of TaskObserver.Watch observers interested in the given
+     * address or null when no Watch observer was installed on this address.
      */
-    public Collection getCodeObservers(long address, int length) {
+    public Collection getWatchObservers(long address, int length) {
 	ArrayList observers;
 	Watchpoint watchpoint = Watchpoint.create(address, length, task);
 	ArrayList list = (ArrayList) map.get(watchpoint);
@@ -165,7 +162,7 @@ public class WatchpointAddresses
 	return observers;
     }
 
-  public Watchpoint getBreakpoint(long address, int length)
+  public Watchpoint getWatchpoint(long address, int length)
   {
     Watchpoint breakpoint = Watchpoint.create(address, length, task);
     Object observer = map.get(breakpoint);
@@ -181,7 +178,7 @@ public class WatchpointAddresses
    *
    * XXX: Should not be public.
    */
-  public void removeAllCodeObservers()
+  public void removeAllWatchObservers()
   {
     map.clear();
     watchpoints.clear();


hooks/post-receive
--
frysk system monitor/debugger


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

only message in thread, other threads:[~2008-02-26 16:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 16:43 [SCM] master: 2008-02-26 Phil Muldoon <pmuldoon@redhat.com> 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).