[SCM] master: Test case for 5331.

pmachata@sourceware.org pmachata@sourceware.org
Thu Nov 15 16:18:00 GMT 2007


The branch, master has been updated
       via  5f6f1885590d461c102fe24fee06a4917398a21c (commit)
      from  efc98011cc2d005c62da7050c720e037a9c22944 (commit)

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

- Log -----------------------------------------------------------------
commit 5f6f1885590d461c102fe24fee06a4917398a21c
Author: Petr Machata <pmachata@redhat.com>
Date:   Thu Nov 15 16:45:18 2007 +0100

    Test case for 5331.
    
    * When the task observed by a codeObserver forks, its child dies due to a SIGTRAP.
    * funit-fib-fork.c: if the child dies with a signal, it now kills itself with the same signal.
    * funit-fib-fork.c: added dummy breakpoint_me function to place a breakpoint to.  (Main wouldn't work (probably), thread of execution has to hit the breakpoint.)
    * Fix of my later ftrace changelog.

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

Summary of changes:
 frysk-core/frysk/ftrace/ChangeLog               |   16 ++++++----
 frysk-core/frysk/pkglibdir/ChangeLog            |    6 ++++
 frysk-core/frysk/pkglibdir/funit-fib-fork.c     |   12 +++++++
 frysk-core/frysk/proc/ChangeLog                 |    4 ++
 frysk-core/frysk/proc/TestTaskObserverCode.java |   37 +++++++++++++++++++++++
 5 files changed, 69 insertions(+), 6 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog
index f369a79..def9b9b 100644
--- a/frysk-core/frysk/ftrace/ChangeLog
+++ b/frysk-core/frysk/ftrace/ChangeLog
@@ -1,5 +1,9 @@
 2007-11-14  Petr Machata  <pmachata@redhat.com>
 
+	* ChangeLog: remove paths from my previous entry
+
+2007-11-14  Petr Machata  <pmachata@redhat.com>
+
 	* TestLtrace.java (testAllLibrariesGetDetected): No longer
 	unresolvedx8664.
 	(testCallRecorded): Ditto.
@@ -7,12 +11,12 @@
 
 2007-11-14  Petr Machata  <pmachata@redhat.com>
 
-	* frysk-core/frysk/ftrace/Symbol.java (offset): New field.
-	* frysk-core/frysk/ftrace/TracePoint.java (offset): New field.
-	* frysk-core/frysk/ftrace/ObjectFile.java: Support `offset'.
-	* frysk-core/frysk/ftrace/MemoryMapping.java: Rewritten.
-	* frysk-core/frysk/ftrace/MappingGuard.java: Adapted to above.
-	* frysk-core/frysk/ftrace/Ltrace.java: Adapted to above.
+	* Symbol.java (offset): New field.
+	* TracePoint.java (offset): New field.
+	* ObjectFile.java: Support `offset'.
+	* MemoryMapping.java: Rewritten.
+	* MappingGuard.java: Adapted to above.
+	* Ltrace.java: Adapted to above.
 
 2007-11-13  Sami Wagiaalla  <swagiaal@redhat.com>
 
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index ea6107a..4371841 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-15  Petr Machata  <pmachata@redhat.com>
+
+	* funit-fib-fork.c: When a child dies on signal, kills itself with
+	that same signal.
+	(breakpoint_me) New dummy function.
+
 2007-11-13 Teresa Thomas <tthomas@redhat.com>
 
 	* funit-addresses.c (ptr): New.
diff --git a/frysk-core/frysk/pkglibdir/funit-fib-fork.c b/frysk-core/frysk/pkglibdir/funit-fib-fork.c
index 4fbfd53..d64138e 100644
--- a/frysk-core/frysk/pkglibdir/funit-fib-fork.c
+++ b/frysk-core/frysk/pkglibdir/funit-fib-fork.c
@@ -45,6 +45,11 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+void
+breakpoint_me(void)
+{
+}
+
 int
 main (int argc, char *argv[], char *envp[])
 {
@@ -66,6 +71,7 @@ main (int argc, char *argv[], char *envp[])
   n = want;
  compute_fib_n:
   /* Children jump back here with an updated N.  */
+  breakpoint_me();
   switch (n)
     {
     case 0:
@@ -113,6 +119,12 @@ main (int argc, char *argv[], char *envp[])
 	      {
 		printf ("waitpid (%ld) got non exit staus 0x%x\n",
 			(long) child[i], status);
+		if (WIFSIGNALED(status))
+		  {
+		    printf("waitpid (%ld) got signal %d\n",
+			   (long) child[i], WTERMSIG(status));
+		    kill(getpid(), WTERMSIG(status));
+		  }
 		exit (1);
 	      }
 	    result += WEXITSTATUS (status);
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index 8d9b128..b0238b2 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-15  Petr Machata  <pmachata@redhat.com>
+
+	* TestTaskObserverCode.java (testCodeOverFork): New test.
+
 2007-11-09  Andrew Cagney  <cagney@redhat.com>
 
 	* PPCBankRegisters.java (PPC32BE_ON_PPC64BE): Don't add "nip",
diff --git a/frysk-core/frysk/proc/TestTaskObserverCode.java b/frysk-core/frysk/proc/TestTaskObserverCode.java
index 92141b1..3f887cf 100644
--- a/frysk-core/frysk/proc/TestTaskObserverCode.java
+++ b/frysk-core/frysk/proc/TestTaskObserverCode.java
@@ -47,6 +47,7 @@ import lib.dwfl.*;
 import java.util.*;
 
 import frysk.testbed.TestLib;
+import frysk.testbed.DaemonBlockedAtEntry;
 
 public class TestTaskObserverCode extends TestLib
 {
@@ -861,6 +862,42 @@ public class TestTaskObserverCode extends TestLib
     assertFalse("unblocked unhit 2", code2.hit);
   }
 
+  // Tests whether a task with breakpoint gets killed by a SIGTRAP
+  // after the fork.
+  public void testCodeOverFork() throws Exception
+  {
+    if (unresolved(5331))
+      return;
+
+    String[] argv = {getExecPath ("funit-fib-fork"), "2"};
+    child = null;
+    DaemonBlockedAtEntry child = new DaemonBlockedAtEntry(argv);
+    task = child.getMainTask();
+    proc = task.getProc();
+    int pid = proc.getPid();
+
+    long address1 = getFunctionEntryAddress("breakpoint_me");
+    CodeObserver code1 = new CodeObserver(task, address1);
+    code1.block = false;
+    TerminatingObserver terminatingObserver = new TerminatingObserver();
+    task.requestAddCodeObserver(code1, address1);
+    assertRunUntilStop("add breakpoint observer");
+    task.requestAddTerminatingObserver(terminatingObserver);
+    assertRunUntilStop("add terminating observer");
+
+    new StopEventLoopWhenProcRemoved(pid);
+    child.requestRemoveBlock();
+    assertRunUntilStop("run \"fork\" until exit");
+    assertTrue("breakpoint hit", code1.hit);
+    assertTrue("termination was noticed", terminatingObserver.task != null);
+
+    // The logic here is that when one of the forked processes dies
+    // due to a signal, parent task notices that and kills itself with
+    // that same signal.
+    assertTrue("task didn't die on signal", !terminatingObserver.signal);
+    assertEquals("task exit status", 0, terminatingObserver.value);
+  }
+
   // Tells the child to run the dummy () function
   // which calls bp1_func () and bp2_func ().
   static final Sig dummySig = Sig.PROF;


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



More information about the Frysk-cvs mailing list