public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmuldoon@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Merge branch 'master' of ssh://sources.redhat.com/git/frysk
Date: Mon, 12 May 2008 16:07:00 -0000	[thread overview]
Message-ID: <20080512160729.18970.qmail@sourceware.org> (raw)

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


             reply	other threads:[~2008-05-12 16:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-12 16:07 pmuldoon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-06-05 15:33 rmoseley
2008-05-12 16:30 rmoseley
2008-05-09 17:29 rmoseley
2008-04-02 22:41 pmuldoon
2008-04-01 12:28 pmuldoon
2008-03-20 20:20 rmoseley
2008-03-18 16:22 pmuldoon
2008-02-26 15:32 pmuldoon
2008-01-24 19:23 rmoseley
2008-01-23 21:10 rmoseley
2008-01-03 16:55 pmuldoon
2007-12-13 20:18 rmoseley
2007-12-04 17:45 jflavio
2007-11-30  4:24 jflavio
2007-11-28 21:40 jflavio
2007-11-28 16:20 jflavio
2007-11-28 13:08 pmuldoon
2007-11-28 12:04 mark
2007-11-20 22:47 scox
2007-11-19 17:58 scox
2007-11-17  8:35 rmoseley
2007-11-16 15:59 scox
2007-11-16 14:59 pmuldoon
2007-11-14  2:38 scox
2007-11-14  2:09 jflavio
2007-11-13  0:41 scox
2007-11-10 14:47 jflavio
2007-11-10  0:34 scox
2007-11-09 14:59 jflavio

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=20080512160729.18970.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).