public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: frysk@sourceware.org
Subject: [patch] Mark Task as justStarted when receiving an ExecedEvent
Date: Wed, 09 Apr 2008 14:26:00 -0000	[thread overview]
Message-ID: <1207750491.3515.60.camel@localhost.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

Hi,

Phil found another corner case which needed to be handled specially. We
need to mark the Task as just started when it gets an execed event
because the first "step" in such a task is special (it isn't a real
step, it is just the kernel adjusting the PC to the start of the dynamic
loader).

frysk-core/frysk/proc/ChangeLog
2008-04-09  Mark Wielaard  <mwielaard@redhat.com>

   * TestTaskObserverInstruction (testFirstInstructionAtEntry):
   New test.

frysk-core/frysk/proc/live/ChangeLog
2008-04-09  Mark Wielaard  <mwielaard@redhat.com>

   * LinuxPtraceTaskState.java (Running.handleExecedEvent): Mark
   Task as justStarted.

No regressions on x86_64, fedora 8.

It would be nice to have this just depend on the state, or route the
marking of just started in Running.sendContinue() since that is the real
place this matters. I'll look into that.

Pushed and committed,

Mark

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 2476 bytes --]

diff --git a/frysk-core/frysk/proc/TestTaskObserverInstruction.java b/frysk-core/frysk/proc/TestTaskObserverInstruction.java
index d5e3d2a..546a763 100644
--- a/frysk-core/frysk/proc/TestTaskObserverInstruction.java
+++ b/frysk-core/frysk/proc/TestTaskObserverInstruction.java
@@ -43,6 +43,9 @@ import frysk.testbed.TestLib;
 import frysk.testbed.Offspring;
 import frysk.testbed.SlaveOffspring;
 
+import frysk.testbed.DaemonBlockedAtEntry;
+import frysk.config.Config;
+
 public class TestTaskObserverInstruction extends TestLib
 {
   public void testInstruction()
@@ -136,6 +139,30 @@ public class TestTaskObserverInstruction extends TestLib
     assertTrue("InstructionObserver hit", instr.hit == 2);
   }
 
+  /**
+   * Tests stepping the very first instruction (actualy the start of the
+   * dynamic loader which is going to load the actual program). This is
+   * a nasty corner case since this isn't a "real step" but actually the
+   * kernel adjusting the task so that it will start running.
+   */
+  public void testFirstInstructionAtEntry()
+  {
+    DaemonBlockedAtEntry daemon;
+    daemon = new DaemonBlockedAtEntry(Config.getPkgLibFile("funit-child"));
+    Task task = daemon.getMainTask();
+
+    InstructionObserver instr = new InstructionObserver();
+    task.requestAddInstructionObserver(instr);
+    assertRunUntilStop("add InstructionObserver");
+    assertTrue("InstructionObserver added", instr.added);
+    assertTrue("InstructionObserver hit", instr.hit == 1);
+
+    daemon.requestUnblock();
+    task.requestUnblock(instr);
+    assertRunUntilStop("step first instruction");
+    assertTrue("InstructionObserver hit again", instr.hit == 2);
+  }
+
   private class StepAttachedObserver implements TaskAttachedObserverXXX
   {
     private final InstructionObserver instr;
diff --git a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
index 3e590c4..9a71530 100644
--- a/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
+++ b/frysk-core/frysk/proc/live/LinuxPtraceTaskState.java
@@ -891,6 +891,10 @@ abstract class LinuxPtraceTaskState extends State {
 		((TaskObservation) i.next()).delete();
 	    }
 
+	    // Mark this LinuxPtraceTask as just started.  See
+	    // Running.handleTrapped for more explanation.
+	    task.justStartedXXX = true;
+
 	    if (task.notifyExeced() > 0) {
 		return (task.syscallObservers.numberOfObservers() > 0
 			? syscallBlockedInSyscallContinue

                 reply	other threads:[~2008-04-09 14:15 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=1207750491.3515.60.camel@localhost.localdomain \
    --to=mark@klomp.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).