public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmachata@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Test case for 5331.
Date: Thu, 15 Nov 2007 16:18:00 -0000	[thread overview]
Message-ID: <20071115161844.1974.qmail@sourceware.org> (raw)

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


                 reply	other threads:[~2007-11-15 16:18 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=20071115161844.1974.qmail@sourceware.org \
    --to=pmachata@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).