public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmuldoon@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test.
Date: Mon, 14 Apr 2008 13:16:00 -0000	[thread overview]
Message-ID: <20080414131653.28873.qmail@sourceware.org> (raw)

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


                 reply	other threads:[~2008-04-14 13:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080414131653.28873.qmail@sourceware.org \
    --to=pmuldoon@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).