public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM] master: Maintain a LinuxPtraceProc local set of tasks.
@ 2008-02-27 6:28 cagney
0 siblings, 0 replies; only message in thread
From: cagney @ 2008-02-27 6:28 UTC (permalink / raw)
To: frysk-cvs
The branch, master has been updated
via eea07e127e177d7620874e979e4476f3f3f62cf6 (commit)
from 7c91f509e932f930be40dd3187bca84b2a1a44ad (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit eea07e127e177d7620874e979e4476f3f3f62cf6
Author: Andrew Cagney <cagney@redhat.com>
Date: Wed Feb 27 01:27:28 2008 -0500
Maintain a LinuxPtraceProc local set of tasks.
frysk-core/frysk/proc/ChangeLog
2008-02-27 Andrew Cagney <cagney@redhat.com>
* Proc.java (remove(Task)): Make protected.
frysk-core/frysk/proc/live/ChangeLog
2008-02-27 Andrew Cagney <cagney@redhat.com>
* LinuxPtraceProc.java (tasks): New.
(removeTask(ProcessIdentifier)): New.
(addTask(ProcessIdentifier,LinuxPtraceTask)): New.
(sendRefresh()): Use tasks.
* LinuxPtraceTask.java: Use.
* LinuxPtraceTaskState.java: Use.
-----------------------------------------------------------------------
Summary of changes:
frysk-core/frysk/proc/ChangeLog | 4 ++
frysk-core/frysk/proc/Proc.java | 4 +-
frysk-core/frysk/proc/live/ChangeLog | 9 ++++
frysk-core/frysk/proc/live/LinuxPtraceProc.java | 40 ++++++++++---------
frysk-core/frysk/proc/live/LinuxPtraceTask.java | 3 +
.../frysk/proc/live/LinuxPtraceTaskState.java | 16 ++++----
6 files changed, 46 insertions(+), 30 deletions(-)
First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index 625155c..80ffe82 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-27 Andrew Cagney <cagney@redhat.com>
+
+ * Proc.java (remove(Task)): Make protected.
+
2008-02-26 Andrew Cagney <cagney@redhat.com>
* ProcId.java: Delete.
diff --git a/frysk-core/frysk/proc/Proc.java b/frysk-core/frysk/proc/Proc.java
index 5c8c081..267d90e 100644
--- a/frysk-core/frysk/proc/Proc.java
+++ b/frysk-core/frysk/proc/Proc.java
@@ -333,10 +333,8 @@ public abstract class Proc implements Comparable {
/**
* Remove Task from this Proc.
- *
- * XXX: Should not be public.
*/
- public void remove(Task task) {
+ protected void remove(Task task) {
logger.log(Level.FINEST, "{0} remove(Task) -- within this Proc\n", this);
host.observableTaskRemovedXXX.notify(task);
taskPool.remove(task.getTaskId());
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 5ed2c18..495d229 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,12 @@
+2008-02-27 Andrew Cagney <cagney@redhat.com>
+
+ * LinuxPtraceProc.java (tasks): New.
+ (removeTask(ProcessIdentifier)): New.
+ (addTask(ProcessIdentifier,LinuxPtraceTask)): New.
+ (sendRefresh()): Use tasks.
+ * LinuxPtraceTask.java: Use.
+ * LinuxPtraceTaskState.java: Use.
+
2008-02-26 Andrew Cagney <cagney@redhat.com>
* LinuxPtraceHost.java (removeProc(ProcessIdentifier)): New.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProc.java b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
index 4d2eae4..c2c2379 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProc.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
@@ -56,9 +56,7 @@ import frysk.sys.ProcessIdentifierFactory;
import frysk.sys.proc.Status;
import frysk.rsl.Log;
import frysk.sys.proc.ProcBuilder;
-import java.util.Map;
import java.util.HashMap;
-import frysk.proc.TaskId;
import java.util.Iterator;
import java.io.File;
import frysk.proc.Manager;
@@ -95,6 +93,15 @@ public class LinuxPtraceProc extends LiveProc {
this.breakpoints = new BreakpointAddresses(this);
}
+ void addTask(LinuxPtraceTask task) {
+ tasks.put(task.tid, task);
+ }
+ void removeTask(LinuxPtraceTask task) {
+ tasks.remove(task.tid);
+ remove(task);
+ }
+ private final HashMap tasks = new HashMap();
+
private Auxv[] auxv;
public Auxv[] getAuxv() {
if (auxv == null) {
@@ -242,27 +249,22 @@ public class LinuxPtraceProc extends LiveProc {
/**
* Refresh the Proc.
*/
- public void sendRefresh ()
- {
- // Compare this against the existing taskPool. ADDED
- // accumulates any tasks added to the taskPool. REMOVED,
- // starting with all known tasks has any existing tasks
- // removed, so that by the end it contains a set of removed
- // tasks.
+ public void sendRefresh() {
+ // Compare this against the existing TASKS. ADDED accumulates
+ // any tasks added to the TASKS. REMOVED, starting with all
+ // known tasks has any existing tasks removed, so that by the
+ // end it contains a set of removed tasks.
class TidBuilder extends ProcBuilder {
- Map added = new HashMap ();
- HashMap removed = (HashMap) ((HashMap)taskPool).clone ();
- TaskId searchId = new TaskId ();
+ HashMap added = new HashMap();
+ HashMap removed = (HashMap) tasks.clone();
public void build(ProcessIdentifier tid) {
- searchId.id = tid.intValue();
- if (removed.containsKey (searchId)) {
- removed.remove (searchId);
- }
- else {
+ if (removed.containsKey(tid)) {
+ removed.remove(tid);
+ } else {
// Add the process (it currently isn't attached).
Task newTask
= new LinuxPtraceTask(LinuxPtraceProc.this, tid);
- added.put (newTask.getTaskId(), newTask);
+ added.put(tid, newTask);
}
}
}
@@ -276,7 +278,7 @@ public class LinuxPtraceProc extends LiveProc {
// Manager .eventLoop .appendEvent for injecting the event
// into the event loop?
task.performRemoval ();
- remove (task);
+ removeTask(task);
}
}
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTask.java b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
index 10e8a25..2f78591 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTask.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTask.java
@@ -81,6 +81,7 @@ public class LinuxPtraceTask extends LiveTask {
public LinuxPtraceTask(Proc proc, ProcessIdentifier pid) {
super(proc, pid);
((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
+ ((LinuxPtraceProc)proc).addTask(this);
newState = LinuxPtraceTaskState.detachedState();
this.watchpoints = new WatchpointAddresses(this);
}
@@ -91,6 +92,7 @@ public class LinuxPtraceTask extends LiveTask {
// XXX: shouldn't need to grub around in the old task's state.
super(task, clone);
((LinuxPtraceHost)getProc().getHost()).putTask(tid, this);
+ ((LinuxPtraceProc)task.getProc()).addTask(this);
newState = LinuxPtraceTaskState.clonedState(((LinuxPtraceTask)task).getState ());
this.watchpoints = new WatchpointAddresses(this);
}
@@ -101,6 +103,7 @@ public class LinuxPtraceTask extends LiveTask {
TaskObserver.Attached attached) {
super(proc, attached);
((LinuxPtraceHost)proc.getHost()).putTask(tid, this);
+ ((LinuxPtraceProc)proc).addTask(this);
newState = LinuxPtraceTaskState.mainState();
if (attached != null) {
TaskObservation ob = new TaskObservation(this, attachedObservers,
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
index 2854e42..2c07389 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
@@ -249,7 +249,7 @@ class LinuxPtraceTaskState extends State {
// it, just abandon this one (but ack the operation
// regardless).
((LinuxPtraceProc)task.getProc()).performTaskAttachCompleted(task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
return destroyed;
}
LinuxPtraceTaskState handleTerminatedEvent(LinuxPtraceTask task,
@@ -259,7 +259,7 @@ class LinuxPtraceTaskState extends State {
// just abandon this one (but ack the operation
// regardless).
((LinuxPtraceProc)task.getProc()).performTaskAttachCompleted(task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
return destroyed;
}
LinuxPtraceTaskState handleDetach(LinuxPtraceTask task,
@@ -345,7 +345,7 @@ class LinuxPtraceTaskState extends State {
Signal signal,
int status) {
fine.log("handleTerminatedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
handleAttachedTerminated(task, signal, status);
return destroyed;
}
@@ -854,7 +854,7 @@ class LinuxPtraceTaskState extends State {
Signal signal,
int status) {
fine.log("handleTerminatedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
handleAttachedTerminated(task, signal, status);
return destroyed;
}
@@ -1219,7 +1219,7 @@ class LinuxPtraceTaskState extends State {
Signal signal,
int status) {
fine.log("handleTerminatedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
// Lie, really just need to tell the proc that the
// task is no longer lurking.
((LinuxPtraceProc)task.getProc()).performTaskDetachCompleted(task);
@@ -1230,7 +1230,7 @@ class LinuxPtraceTaskState extends State {
// Woops, it disappeared before we were really detached,
// pretend the detached happened anyway.
fine.log("handleDisappearedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
((LinuxPtraceProc)task.getProc()).performTaskDetachCompleted(task);
return destroyed;
}
@@ -1345,7 +1345,7 @@ class LinuxPtraceTaskState extends State {
Signal signal,
int status) {
fine.log("handleTerminatedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
handleAttachedTerminated(task, signal, status);
return destroyed;
}
@@ -1408,7 +1408,7 @@ class LinuxPtraceTaskState extends State {
Signal signal,
int status) {
fine.log("handleTerminatedEvent", task);
- ((LinuxPtraceProc)task.getProc()).remove(task);
+ ((LinuxPtraceProc)task.getProc()).removeTask(task);
handleAttachedTerminated(task, signal, status);
return destroyed;
}
hooks/post-receive
--
frysk system monitor/debugger
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-27 6:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27 6:28 [SCM] master: Maintain a LinuxPtraceProc local set of tasks cagney
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).