public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: frysk-core/frysk/stepping:
@ 2008-02-24  2:24 mcvet
  0 siblings, 0 replies; only message in thread
From: mcvet @ 2008-02-24  2:24 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  8ae8b5bbf07d2a0dde2b5db8bcf01199e3ea2ced (commit)
      from  f0df1c7855297f1d4c4ea143655f7546ca80fb5b (commit)

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

- Log -----------------------------------------------------------------
commit 8ae8b5bbf07d2a0dde2b5db8bcf01199e3ea2ced
Author: Varg <varg@localhost.localdomain>
Date:   Sat Feb 23 18:21:17 2008 -0500

    frysk-core/frysk/stepping:
    
    	* SteppingEngine.java (updateClonedOffspring): Make sure that
    	the current Object is added as a TerminatedObserver, and the
    	steppingObserver is added. Fixes #5674.
    
    	* TestSteppingEngine.java (testChildThreadStart): Added, for above.
    
    frysk-core/frysk/pkglibdir:
    
    	* funit-threads-stepping.c: Added tags for above test.

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

Summary of changes:
 frysk-core/frysk/pkglibdir/funit-threads-looper.c |   16 ++--
 frysk-core/frysk/stepping/SteppingEngine.java     |    4 +
 frysk-core/frysk/stepping/TestSteppingEngine.java |   95 ++++++++++++++++++---
 3 files changed, 94 insertions(+), 21 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/pkglibdir/funit-threads-looper.c b/frysk-core/frysk/pkglibdir/funit-threads-looper.c
index d13f6a2..1e436d5 100644
--- a/frysk-core/frysk/pkglibdir/funit-threads-looper.c
+++ b/frysk-core/frysk/pkglibdir/funit-threads-looper.c
@@ -66,21 +66,21 @@ static char * myname;
 
 void
 *do_it ()
-{
+{  
   int t = 34543;
   while (t > 0)
     t--;
 
   //fprintf (stderr,"attach %s pid=%d -task tid=%d -cli\n", myname, getpid(), gettid());
 
-  int d = 1;
+  volatile int d = 1;
   int e = 0;
   pid_t f = gettid();
   f++;
 
   while (1)
     {
-      d++;
+      d++;  // _childThreadStart2_
       e++;
       if (d == 3)
         {
@@ -95,8 +95,8 @@ void
 
 void
 bak ()
-{
-  while (1)
+{ // _childThreadStart1_
+  while (1)  
     {
       //fprintf (stderr,"attach %s pid=%d -task tid=%d -cli\n", myname, getpid(), gettid());
       int a = 0;
@@ -104,7 +104,7 @@ bak ()
       int c = 0;
       while (1)
         {
-          a++;
+          a++; 
           b++;
           c++;
           if (a + b > 4)
@@ -147,12 +147,12 @@ int
 main (int argc, char **argv)
 {
   myname = argv[0];
-  pthread_attr_t attr;
+  pthread_attr_t attr;	
   pthread_attr_init (&attr);
   pthread_create (&tester_thread, &attr, do_it, NULL);
 
   /* This is a comment */
-  foo ();
+  foo (); 
   int t = 30;
   t++;
   exit (0);
diff --git a/frysk-core/frysk/stepping/SteppingEngine.java b/frysk-core/frysk/stepping/SteppingEngine.java
index e23e2d3..aedb2e6 100644
--- a/frysk-core/frysk/stepping/SteppingEngine.java
+++ b/frysk-core/frysk/stepping/SteppingEngine.java
@@ -1162,8 +1162,12 @@ public class SteppingEngine {
 	    SteppingEngine.this.taskStateMap.put(offspring, new TaskStepEngine(
 		    offspring, SteppingEngine.this));
 	    SteppingEngine.this.threadsList.addLast(offspring);
+
+	    offspring.requestAddInstructionObserver(SteppingEngine.this.steppingObserver);
+
 	    offspring.requestAddClonedObserver(this);
 	    offspring.requestAddTerminatingObserver(this);
+	    offspring.requestAddTerminatedObserver(this);
 	    return Action.CONTINUE;
 	}
 
diff --git a/frysk-core/frysk/stepping/TestSteppingEngine.java b/frysk-core/frysk/stepping/TestSteppingEngine.java
index 149f739..7a7aa18 100644
--- a/frysk-core/frysk/stepping/TestSteppingEngine.java
+++ b/frysk-core/frysk/stepping/TestSteppingEngine.java
@@ -44,8 +44,10 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Observable;
 import java.util.Observer;
+
 import frysk.sys.ProcessIdentifier;
 import frysk.sys.ProcessIdentifierFactory;
+
 import frysk.scopes.SourceLocation;
 import frysk.sys.Signal;
 import frysk.testbed.Offspring;
@@ -109,7 +111,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new AssertLine(endLine, theTask);
 
@@ -153,7 +155,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new AssertLine(endLine, theTask);
 
@@ -199,7 +201,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new AssertLine(endLine, theTask);
 
@@ -243,7 +245,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new AssertLine(endLine, theTask);
 
@@ -324,7 +326,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new StepOverTest(endLine, theTask);
 
@@ -404,7 +406,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new InstructionNextTest(endLine, theTask);
 
@@ -484,7 +486,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new StepOutTest(endLine, theTask);
 
@@ -564,7 +566,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	this.currentTest = new StepAdvanceTest(endLine, theTask);
 
@@ -584,6 +586,66 @@ public class TestSteppingEngine extends TestLib {
 	cleanup();
     }
 
+
+    public void testChildThreadStart() {
+
+	if (unresolvedOnPPC(3277))
+	    return;
+
+	/**
+         * SteppingTest Object definition - tell the stepping test what to look
+         * for at the completion of the test.
+         */
+	class ChildThreadStartTest implements SteppingTest {
+
+	    public void runAssertions() {
+
+			Manager.eventLoop.requestStop();
+	    }
+	}
+
+	/** Variable setup */
+
+	String source = Config.getRootSrcDir()
+		+ "frysk-core/frysk/pkglibdir/funit-threads-looper.c";
+
+	this.scanner = new TestfileTokenScanner(new File(source));
+
+	/* The line number where the test begins */
+	int startLine = this.scanner.findTokenLine("_childThreadStart1_");
+
+	int startLine2 = this.scanner.findTokenLine("_childThreadStart2_");
+
+	/* The line number the test should end up at */
+	int endLine = this.scanner.findTokenLine("_childThreadEnd_");
+
+	/* The test process */
+	dbae = new DaemonBlockedAtEntry(Config
+		.getPkgLibFile("funit-threads-looper"));
+
+	Task theTask = dbae.getMainTask();
+
+	this.testStarted = false;
+
+	initTaskWithTask(theTask, source, startLine, endLine, startLine2);
+
+	this.currentTest = new ChildThreadStartTest();
+
+	DebugInfoFrame frame = DebugInfoStackFactory
+		.createDebugInfoStackTrace(theTask);
+	assertTrue("Line information present", frame.getLine() != SourceLocation.UNKNOWN);
+
+	/** The stepping operation. Step all tasks - if one is not added to the
+	SteppingEngine, it will throw a RuntimeException.  */
+	this.se.stepLine(theTask.getProc().getTasks());
+
+	this.testStarted = true;
+
+	/** Run to completion */
+	assertRunUntilStop("Running test");
+	cleanup();
+    }
+
     public void testBreakpointing() {
 
 	if (unresolvedOnPPC(3277))
@@ -609,7 +671,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, endLine);
+	initTaskWithTask(theTask, source, startLine, endLine, 0);
 
 	DebugInfoFrame frame = DebugInfoStackFactory
 		.createDebugInfoStackTrace(theTask);
@@ -651,7 +713,7 @@ public class TestSteppingEngine extends TestLib {
 
 	    public void addedTo(Object observable) {
 		ProcessIdentifier pid
-		    = ProcessIdentifierFactory.create(((Task)observable).getProc().getPid());
+			= ProcessIdentifierFactory.create(((Task) observable).getProc().getPid());
 		Signal.KILL.kill(pid);
 	    }
 
@@ -705,7 +767,7 @@ public class TestSteppingEngine extends TestLib {
 
 	this.testStarted = false;
 
-	initTaskWithTask(theTask, source, startLine, 0);
+	initTaskWithTask(theTask, source, startLine, 0, 0);
 
 	this.currentTest = new testMissingThreadStep(0, theTask);
 
@@ -736,14 +798,14 @@ public class TestSteppingEngine extends TestLib {
     public Task initTask(Offspring process, String source, int startLine,
 	    int endLine) {
 	Task myTask = process.findTaskUsingRefresh(true);
-	initTaskWithTask(myTask, source, startLine, endLine);
+	initTaskWithTask(myTask, source, startLine, endLine, 0);
 	return myTask;
     }
 
     DaemonBlockedAtEntry dbae = null;
 
     public void initTaskWithTask(Task myTask, String source, int startLine,
-	    int endLine) {
+	    int endLine, int startLine2) {
 
 	this.lineMap = new HashMap();
 	this.lock = new LockObserver();
@@ -768,6 +830,13 @@ public class TestSteppingEngine extends TestLib {
 	lbp.addObserver(new TestSteppingBreakpoint());
 	bManager.enableBreakpoint(lbp, myTask);
 
+	if (startLine2 != 0)
+	{
+	LineBreakpoint lbp2 = bManager.addLineBreakpoint(source, startLine2, 0);
+	lbp2.addObserver(new TestSteppingBreakpoint());
+	bManager.enableBreakpoint(lbp2, myTask);
+	}
+
 	this.se.addObserver(lock);
 	if (dbae != null)
 	    dbae.requestUnblock();


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


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

only message in thread, other threads:[~2008-02-24  2:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-24  2:24 [SCM] master: frysk-core/frysk/stepping: mcvet

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