This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Merge branch 'master' of ssh://sources.redhat.com/git/frysk


The branch, master has been updated
       via  c6ba841bf12cffc9556c92eb1b635d399b477a5b (commit)
       via  6b98aedb4d4f15d496aa90bf8b77fd907c93568a (commit)
      from  198341c5690eeb5f8a9e49ed1be1119f7690878b (commit)

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

- Log -----------------------------------------------------------------
commit c6ba841bf12cffc9556c92eb1b635d399b477a5b
Merge: 6b98aedb4d4f15d496aa90bf8b77fd907c93568a 198341c5690eeb5f8a9e49ed1be1119f7690878b
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Mon May 12 17:06:33 2008 +0100

    Merge branch 'master' of ssh://sources.redhat.com/git/frysk

commit 6b98aedb4d4f15d496aa90bf8b77fd907c93568a
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Mon May 12 17:04:41 2008 +0100

    Call addFailed passing the Exception, rather than raising an exception when a watchpoint observer fails to be added to the task.
    
    2008-05-12  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* TestTaskObserverWatchpoint.java (testAddFailed): New.
    	(AddFailWatchObserver): New.
    
    2008-05-12  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* LinuxPtraceProc.java (requestAddWatchObserver): Call addFailed
    	on any exceptions raised in add().

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

Summary of changes:
 frysk-core/frysk/proc/ChangeLog                    |    5 ++
 .../frysk/proc/TestTaskObserverWatchpoint.java     |   71 ++++++++++++++++++++
 frysk-core/frysk/proc/live/ChangeLog               |    6 ++
 frysk-core/frysk/proc/live/LinuxPtraceProc.java    |   15 +++-
 4 files changed, 94 insertions(+), 3 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index ecf2830..ab70cc1 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-12  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* TestTaskObserverWatchpoint.java (testAddFailed): New.	
+	(AddFailWatchObserver): New.
+
 2008-04-28  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestTaskForkedObserver.java (testTaskVforkObserver):
diff --git a/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java b/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
index 3fc8d23..a100008 100644
--- a/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
+++ b/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
@@ -177,6 +177,54 @@ extends TestLib
 
     }
 
+    // This test case tests whether watchpoints are caught when a task is in a straight
+    // "running" condition. This really tests the basic and advertised functionality of watchpoints:
+    // to be caught by hardware, not software. In this  test:  set up the watchpoint, set up
+    // a terminated observer to guard the watchpoint was caught, and simply set the task to run.
+    // If the watchpoint observer is called, and the test is blocked then the test passes. If the
+    // process terminates and the watchpoint is not caught, then this signified an error condition.
+    public void testAddFailed () {
+	if (unresolvedOnPPC(5991)) 
+	    return;
+	
+	DaemonBlockedAtEntry ackProc = new DaemonBlockedAtEntry(
+		Prefix.pkgLibFile("funit-watchpoint"));
+	assertNotNull(ackProc);
+
+	// Get Proc/Task.
+	Proc proc = ackProc.getMainTask().getProc();
+	Task task = proc.getMainTask();
+
+	// Watch for any unexpected terminations of the child process.
+	TerminatedObserver to = new TerminatedObserver();
+	task.requestAddTerminatedObserver(to);
+
+	// Break at main
+	long mainAddress = getGlobalSymbolAddress(task, "main");
+	CodeObserver co = new CodeObserver();
+	task.requestAddCodeObserver(co, mainAddress);
+	ackProc.requestUnblock();
+	assertRunUntilStop("Run to main");
+
+	// Find Variable source for watch
+	long address = getGlobalSymbolAddress(task,"source");
+
+	// Add watch observer
+	AddFailWatchObserver watch = new AddFailWatchObserver();
+	task.requestAddWatchObserver(watch, address, 72, true);
+	task.requestUnblock(co);
+
+	assertRunUntilStop("Run and test watchpoint ");
+
+	// Make sure it triggered.
+	assertTrue("addedFailed", watch.addFailed);
+
+	// Delete both observers.
+	task.requestDeleteCodeObserver(co, mainAddress);
+	runPending();
+
+
+    }
 
     // This test case tests whether 'read or write' watchpoints are caught when a task is in a straight
     // "running" condition.  In this  test:  set up the 'read or write' watchpoint, set up
@@ -376,6 +424,29 @@ extends TestLib
 	}
     }
 
+    static class AddFailWatchObserver implements TaskObserver.Watch {
+
+	boolean addFailed = false;
+
+	public Action updateHit(Task task, long address, int length) {
+	    fail("Failing watchpoint generated a updateHit when observer should not have been added");
+	    return null;
+	}
+
+	public void addFailed(Object observable, Throwable w) {
+	    Manager.eventLoop.requestStop();
+	    addFailed = true;	    
+	}
+
+	public void addedTo(Object observable) {
+	    fail("Failing watchpoint generated a addedTo when observer should not have been added");	
+	}
+
+	public void deletedFrom(Object observable) {
+	    fail("Failing watchpoint generated a deletedFrom when observer should not have been added");	    
+	}
+	
+    }
     // Code observer. Run to a point in the program (normally main)
     // then block
     static class CodeObserver extends TestObserver
diff --git a/frysk-core/frysk/proc/live/ChangeLog b/frysk-core/frysk/proc/live/ChangeLog
index 8231f51..fe2cff5 100644
--- a/frysk-core/frysk/proc/live/ChangeLog
+++ b/frysk-core/frysk/proc/live/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-12  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* LinuxPtraceProc.java (requestAddWatchObserver): Call addFailed
+	on any exceptions raised in add().
+	
+
 2008-04-22  Mark Wielaard  <mwielaard@redhat.com>
 
 	* Breakpoint.java (reset): Make package private.
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceProc.java b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
index 08db321..f789d84 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceProc.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceProc.java
@@ -651,8 +651,8 @@ public class LinuxPtraceProc extends LiveProc {
 	}
 
 	public void run() {
-	    if (addition) {
-		boolean mustInstall = watchpoints.addWatchpoint(watch, task, address, length, writeOnly);
+	    if (addition) {		
+		boolean mustInstall = watchpoints.addWatchpoint(watch, task, address, length, writeOnly);		
 		if (mustInstall) {
 		    Watchpoint watchpoint;
 		    watchpoint = Watchpoint.create(address, length, writeOnly, task);
@@ -686,12 +686,21 @@ public class LinuxPtraceProc extends LiveProc {
 	fine.log(this, "requestAddWatchObserver");
 	WatchpointAction wpa = new WatchpointAction(observer, task, address, length, writeOnly, true);
 	TaskObservation to;
-	to = new TaskObservation((LinuxPtraceTask) task, observable, observer, wpa, true) {
+	to = new TaskObservation((LinuxPtraceTask) task, observable, observer, wpa, true) {	    	    
 	    public void execute() {
 		handleAddObservation(this);
 	    }
 	    public boolean needsSuspendedAction() {
 		return watchpoints.getWatchObservers(task, address, length, writeOnly) == null;
+	    }	    
+	    public void add() {
+		try {
+		    super.add();
+		} catch (Exception e) {
+		    // On any exceptions being raised in add(), call
+		    getTaskObserver().addFailed(this,e);
+		}
+		
 	    }
 	};
 	Manager.eventLoop.add(to);


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]