From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28914 invoked by alias); 14 Apr 2008 13:16:53 -0000 Received: (qmail 28888 invoked by uid 9514); 14 Apr 2008 13:16:53 -0000 Date: Mon, 14 Apr 2008 13:16:00 -0000 Message-ID: <20080414131653.28873.qmail@sourceware.org> From: pmuldoon@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 05a02786605b522770d51c9c5cf5bcd503ce24ad X-Git-Newrev: dd89b9e98efbe563cef22c6b18b9b135523a8205 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00092.txt.bz2 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 Date: Mon Apr 14 14:15:43 2008 +0100 Add new test testRunningAndReadOnlyWatchpoint. Adjust funit-watcjpoints.S for test. 2008-04-14 Phil Muldoon * TestTaskObserverWatchpoint.java (testRunningAndReadOnlyWatchpoint): New. 2008-04-14 Phil Muldoon * 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 + + * funit-watchpoint.S: Add new read_only WORD + symbol. Read it. + 2008-04-08 Andrew Cagney * 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 + + * TestTaskObserverWatchpoint.java (testRunningAndReadOnlyWatchpoint): New. + 2008-04-10 Phil Muldoon * 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