From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15178 invoked by alias); 9 Apr 2008 14:15:22 -0000 Received: (qmail 15169 invoked by uid 22791); 9 Apr 2008 14:15:20 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_53 X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (83.160.170.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Apr 2008 14:15:00 +0000 Received: from cc1341701-a.deven1.ov.home.nl ([82.72.26.122] helo=[192.168.1.106]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1Jjb4h-0006hx-N8 for frysk@sourceware.org; Wed, 09 Apr 2008 16:14:57 +0200 Subject: [patch] Mark Task as justStarted when receiving an ExecedEvent From: Mark Wielaard To: frysk@sourceware.org Content-Type: multipart/mixed; boundary="=-6Vcn7gE8rK3igjFtQnx4" Date: Wed, 09 Apr 2008 14:26:00 -0000 Message-Id: <1207750491.3515.60.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-3.fc8) X-Spam-Score: -0.2 (/) X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00039.txt.bz2 --=-6Vcn7gE8rK3igjFtQnx4 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 883 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 * TestTaskObserverInstruction (testFirstInstructionAtEntry): New test. frysk-core/frysk/proc/live/ChangeLog 2008-04-09 Mark Wielaard * 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 --=-6Vcn7gE8rK3igjFtQnx4 Content-Disposition: inline; filename=patch Content-Type: text/x-patch; name=patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 2476 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 --=-6Vcn7gE8rK3igjFtQnx4--