public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test.
@ 2008-04-14 13:16 pmuldoon
  0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2008-04-14 13:16 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  dd89b9e98efbe563cef22c6b18b9b135523a8205 (commit)
      from  05a02786605b522770d51c9c5cf5bcd503ce24ad (commit)

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

- Log -----------------------------------------------------------------
commit dd89b9e98efbe563cef22c6b18b9b135523a8205
Author: Phil Muldoon <pmuldoon@redhat.com>
Date:   Mon Apr 14 14:15:43 2008 +0100

    Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test.
    
    2008-04-14  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* TestTaskObserverWatchpoint.java (testRunningAndReadOnlyWatchpoint): New.
    
    2008-04-14  Phil Muldoon  <pmuldoon@redhat.com>
    
    	* funit-watchpoint.S: Add new read_only WORD
    	symbol. Read it.

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

Summary of changes:
 frysk-core/frysk/pkglibdir/ChangeLog               |    5 ++
 frysk-core/frysk/pkglibdir/funit-watchpoint.S      |   12 +++--
 frysk-core/frysk/proc/ChangeLog                    |    4 ++
 .../frysk/proc/TestTaskObserverWatchpoint.java     |   57 +++++++++++++++++++-
 4 files changed, 72 insertions(+), 6 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index 23fd5b2..d0090ce 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-14  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* funit-watchpoint.S: Add new read_only WORD
+	symbol. Read it.
+
 2008-04-08  Andrew Cagney  <cagney@redhat.com>
 
 	* funit-threads.xml-in: Add version information.
diff --git a/frysk-core/frysk/pkglibdir/funit-watchpoint.S b/frysk-core/frysk/pkglibdir/funit-watchpoint.S
index e03093e..cfb0f39 100644
--- a/frysk-core/frysk/pkglibdir/funit-watchpoint.S
+++ b/frysk-core/frysk/pkglibdir/funit-watchpoint.S
@@ -60,17 +60,17 @@ LOAD_IMMED_BYTE (REG3, 0x77)
 
 // Clear the decks ...
 NOP
-NOP
-NOP
-
 // Write 0x77 into the location of source (held by GPR1)
 STORE_WORD(REG3, REG1)
-
-// Clear the decks ....
 NOP
+
 NOP
+// Read read_only memory, and copy it to source
+LOAD_IMMED_WORD(REG3, read_only)
+STORE_WORD(REG3, REG1)
 NOP
 
+
 // End. And exit
 MAIN_EPILOGUE(0)
 FUNCTION_RETURN(main,0)
@@ -80,4 +80,6 @@ FUNCTION_END(main,0)
 .globl source
 WORD(source, 0x99)
 
+.globl read_only
+WORD(read_only, 0x01)
 
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index c6cdbd1..63785a8 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-14  Phil Muldoon  <pmuldoon@redhat.com>
+
+	* TestTaskObserverWatchpoint.java (testRunningAndReadOnlyWatchpoint): New.
+
 2008-04-10  Phil Muldoon  <pmuldoon@redhat.com>
 
 	* TestTaskObserverWatchpoint.java (testAddthenDeleteWatchpoint): New Test.
diff --git a/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java b/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
index 59b8c33..2fde8c2 100644
--- a/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
+++ b/frysk-core/frysk/proc/TestTaskObserverWatchpoint.java
@@ -177,7 +177,62 @@ extends TestLib
 
     }
 
-    
+
+    // 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
+    // a terminated observer to guard the watchpoint was caught, and simply set the task to run.
+    // If the watchpoint observer is called on address read, 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 testRunningAndReadOnlyWatchpoint () {
+	if (unresolvedOnPPC(5991)) 
+	    return;
+	
+	DaemonBlockedAtEntry ackProc = new DaemonBlockedAtEntry(
+		Config.getPkgLibFile("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,"read_only");
+
+	// Add watch observer. Set it to fire on read OR write.
+	WatchObserver watch = new WatchObserver(task, address, 4);
+	task.requestAddWatchObserver(watch, address, 4, false);
+
+	task.requestUnblock(co);
+	assertRunUntilStop("Run and test watchpoint ");
+
+	// Make sure it triggered.
+	assertTrue("added", watch.added);
+	assertEquals("hit code", 1, watch.hit);
+
+	// Delete both observers.
+	task.requestDeleteCodeObserver(co, mainAddress);
+	task.requestDeleteWatchObserver(watch, address, 4, true);
+	runPending();
+
+	// Verify they were removed.
+	assertTrue("deleted watch", watch.deleted);
+	assertTrue("deleted code", co.deleted);
+	assertEquals("hit code", 1, watch.hit);
+
+    }
+
     // This test tests that a watchpoint is properly deleted: from the othe observer lists
     // and the hardware. In this case, if the watchpoint is caught, then it fails. It should have
     // been deleted. This test adds the watchpoint, then runs to main, then deletes the watchpoint.


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


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

only message in thread, other threads:[~2008-04-14 13:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 13:16 [SCM] master: Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test 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).