Example #1
0
 /// <summary>
 /// Notify the debug process of our suspension.
 /// </summary>
 private void HandleSuspendPolicy(Jdwp.SuspendPolicy suspendPolicy, SuspendReason reason, DalvikThread thread)
 {
     if (suspendPolicy == Jdwp.SuspendPolicy.All)
     {
         debugger.Process.OnSuspended(reason, thread);
     }
 }
Example #2
0
 /// <summary>
 /// Record myself as current thread if needed.
 /// </summary>
 protected override void OnProcessSuspended(SuspendReason reason, bool isCurrentThread)
 {
     base.OnProcessSuspended(reason, isCurrentThread);
     if (isCurrentThread) {
         // Record in debugger
         Dot42Debugger.Instance.CurrentThread = this;
     }
 }
Example #3
0
 /// <summary>
 /// We've justed suspended the process.
 /// Refresh call stack.
 /// </summary>
 protected internal virtual void OnProcessSuspended(SuspendReason reason, bool isCurrentThread)
 {
     callStack        = null;
     status           = null;
     suspended        = null;
     name             = null;
     suspendCount     = null;
     CurrentException = null;
 }
Example #4
0
 /// <summary>
 /// Record myself as current thread if needed.
 /// </summary>
 protected override void OnProcessSuspended(SuspendReason reason, bool isCurrentThread)
 {
     base.OnProcessSuspended(reason, isCurrentThread);
     if (isCurrentThread)
     {
         // Record in debugger
         Dot42Debugger.Instance.CurrentThread = this;
     }
 }
 /// <summary>
 /// Refresh the thread list and notify all threads that's we've justed suspended the process.
 /// </summary>
 /// <param name="reason">The reason the VM is suspended</param>
 /// <param name="thread">The thread involved in the suspend. This can be null depending on the reason.</param>
 internal void OnProcessSuspended(SuspendReason reason, DalvikThread thread)
 {
     // Ask all threads to cleanup
     foreach (var t in Threads)
     {
         t.OnProcessSuspended(reason, (t == thread));
     }
     // Refresh threads
     RefreshThreadsAsync().Wait();
 }
Example #6
0
 protected bool SetChildrenTerminationReason(SuspendReason reason)
 {
     return(UpdateChildrenRefs <bool>(cc =>
     {
         var c = cc as TerminatingChildrenContainer;
         if (c != null)
         {
             //The arguments says: Update; with a new reason; and return true
             return new Tuple <bool, ChildrenContainer, bool>(true, c.CreateCopyWithReason(reason), true);
         }
         //The arguments says:Do NOT update; any container will do since it wont be updated; return false
         return new Tuple <bool, ChildrenContainer, bool>(false, cc, false);
     }));
 }
Example #7
0
        public Tuple <Result[], SuspendReason> GetScreensaverTasks()
        {
            CheckDisposed();
            CheckConnected();

            XElement response = PerformRpc("<get_screensaver_tasks/>");

            CheckResponse(response, "handle_get_screensaver_tasks");

            Result[] results = response.Elements("result").Select(e => new Result(e)).ToArray();

            SuspendReason suspendReason = (SuspendReason)response.ElementInt("suspend_reason");

            return(new Tuple <Result[], SuspendReason>(results, suspendReason));
        }
Example #8
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="reason">TBD</param>
 /// <returns>TBD</returns>
 protected bool SetChildrenTerminationReason(SuspendReason reason)
 {
     while (true)
     {
         if (ChildrenContainer is TerminatingChildrenContainer c)
         {
             var n = c.CreateCopyWithReason(reason);
             if (SwapChildrenRefs(c, n))
             {
                 return(true);
             }
         }
         else
         {
             return(false);
         }
     }
 }
Example #9
0
 public void suspend(SuspendReason reason, Context context, ISection section)
 {
     status = Status.SUSPENDED;
     if (listener != null)
     {
         listener.handleSuspendEvent(reason, context, section);
     }
     try
     {
         blocker.WaitOne();
     }
     finally
     {
         status = Status.RUNNING;
         if (listener != null)
         {
             listener.handleResumeEvent(resumeReason, context, section);
         }
     }
 }
Example #10
0
        /// <summary>
        /// Notify listeners that we're suspended.
        /// </summary>
        protected override bool OnSuspended(SuspendReason reason, DalvikThread thread, StepRequest stepRequest)
        {
            var rc = base.OnSuspended(reason, thread, stepRequest);

            if (rc)
            {
                if (reason == SuspendReason.ProcessSuspend)
                {
                    foreach (var threadx in ThreadManager.Threads)
                    {
                        eventCallback.Send(threadx, new ASyncBreakCompleteEvent());
                    }
                }
                if (reason == SuspendReason.SingleStep)
                {
                    eventCallback.Send((DebugThread)thread, new StepCompleteEvent());
                }
            }
            return(rc);
        }
Example #11
0
 /// <summary>
 /// Notify listeners that we're suspended.
 /// </summary>
 /// <param name="reason">The reason the VM is suspended</param>
 /// <param name="thread">The thread involved in the suspend. This can be null depending on the reason.</param>
 /// <returns>True if the suspend is performed, false if execution is continued.</returns>
 protected internal virtual bool OnSuspended(SuspendReason reason, DalvikThread thread)
 {
     if ((reason == SuspendReason.SingleStep) && (thread != null))
     {
         // Make sure we're are a location where we have a source.
         thread.OnProcessSuspended(reason, true);
         var topFrame = thread.GetCallStack().FirstOrDefault();
         if (topFrame != null)
         {
             var location = topFrame.GetDocumentLocationAsync().Await(VmTimeout);
             if (location.Document == null)
             {
                 // Not my code
                 StepOutLastRequestAsync();
                 return(false);
             }
         }
     }
     ThreadManager.OnProcessSuspended(reason, thread);
     ReferenceTypeManager.OnProcessSuspended(reason);
     isSuspended = true;
     IsSuspendedChanged.Fire(this);
     return(true);
 }
 /// <summary>
 /// Refresh the class list.
 /// </summary>
 internal void OnProcessSuspended(SuspendReason reason)
 {
     // Refresh classes
     //RefreshClasses().Wait();
 }
 public TerminatingChildrenContainer(IImmutableDictionary<string, IChildStats> children, IActorRef toDie, SuspendReason reason)
     : this(children, ImmutableHashSet<IActorRef>.Empty.Add(toDie), reason)
 {
     //Intentionally left blank
 }
 public TerminatingChildrenContainer(IImmutableMap<string, IChildStats> children, IActorRef toDie, SuspendReason reason)
     : this(children, ImmutableTreeSet<IActorRef>.Create(toDie), reason)
 {
     //Intentionally left blank
 }
 public TerminatingChildrenContainer(IImmutableMap<string, IChildStats> children, IImmutableSet<IActorRef> toDie, SuspendReason reason)
     : base(children)
 {
     _toDie = toDie;
     _reason = reason;
 }
 public IChildrenContainer CreateCopyWithReason(SuspendReason reason)
 {
     return new TerminatingChildrenContainer(InternalChildren, _toDie, reason);
 }
Example #17
0
        /// <summary>
        /// Notify listeners that we're suspended.
        /// </summary>
        /// <param name="reason">The reason the VM is suspended</param>
        /// <param name="thread">The thread involved in the suspend. This can be null depending on the reason.</param>
        /// <param name="request">A step request, if any.</param>
        /// <returns>True if the suspend is performed, false if execution is continued.</returns>
        protected internal virtual bool OnSuspended(SuspendReason reason, DalvikThread thread, StepRequest request = null)
        {
            if (reason == SuspendReason.SingleStep && thread != null && request != null && request.Thread != null)
            {
                // Make sure we're are a location where we have a source.
                thread.OnProcessSuspended(reason, true);
                var topFrame = thread.GetCallStack().FirstOrDefault();
                if (topFrame != null)
                {
                    var location = topFrame.GetDocumentLocationAsync().Await(VmTimeout);
                    if (location.SourceCode == null)
                    {
                        // Not my code
                        StepOutLastRequestAsync(request);
                        return false;
                    }

                    // check if we have a valid source code position, or if this is
                    // compiler generated code (in which case dalvik will perform single stepping)
                    if (request.StepMode != StepMode.SingleInstruction)
                    {
                        if (location.SourceCode == null || location.SourceCode.IsSpecial ||
                            location.Location.Index < (ulong)location.SourceCode.Position.MethodOffset)
                        {
                            var stepDepth = request.StepDepth == Jdwp.StepDepth.Out ? Jdwp.StepDepth.Over : request.StepDepth;
                            StepAsync(new StepRequest(request.Thread, stepDepth, request.StepMode));
                            return false;
                        }
                    }
                }
            }
            ThreadManager.OnProcessSuspended(reason, thread);
            ReferenceTypeManager.OnProcessSuspended(reason);
            isSuspended = true;
            IsSuspendedChanged.Fire(this);
            return true;
        }
 public TerminatingChildrenContainer(IImmutableDictionary <string, IChildStats> children, IActorRef toDie, SuspendReason reason)
     : this(children, ImmutableHashSet <IActorRef> .Empty.Add(toDie), reason)
 {
     //Intentionally left blank
 }
Example #19
0
 /// <summary>
 /// We've justed suspended the process.
 /// Refresh call stack.
 /// </summary>
 protected internal virtual void OnProcessSuspended(SuspendReason reason, bool isCurrentThread)
 {
     callStack = null;
     status = null;
     suspended = null;
     name = null;
     suspendCount = null;
     CurrentException = null;
 }
Example #20
0
 /// <summary>
 /// Refresh the thread list and notify all threads that's we've justed suspended the process.
 /// </summary>
 /// <param name="reason">The reason the VM is suspended</param>
 /// <param name="thread">The thread involved in the suspend. This can be null depending on the reason.</param>
 internal void OnProcessSuspended(SuspendReason reason, DalvikThread thread)
 {
     // Ask all threads to cleanup
     foreach (var t in Threads)
     {
         t.OnProcessSuspended(reason, (t == thread));
     }
     // Refresh threads
     RefreshThreadsAsync().Wait();
 }
Example #21
0
 /// <summary>
 /// Notify listeners that we're suspended.
 /// </summary>
 protected override bool OnSuspended(SuspendReason reason, DalvikThread thread)
 {
     var rc = base.OnSuspended(reason, thread);
     if (rc)
     {
         if (reason == SuspendReason.ProcessSuspend)
         {
             foreach (var threadx in ThreadManager.Threads)
             {
                 eventCallback.Send(threadx, new ASyncBreakCompleteEvent());
             }
         }
         if (reason == SuspendReason.SingleStep)
         {
             eventCallback.Send((DebugThread) thread, new StepCompleteEvent());
         }
     }
     return rc;
 }
 public TerminatingChildrenContainer(IImmutableMap <string, IChildStats> children, IActorRef toDie, SuspendReason reason)
     : this(children, ImmutableTreeSet <IActorRef> .Create(toDie), reason)
 {
     //Intentionally left blank
 }
 public IChildrenContainer CreateCopyWithReason(SuspendReason reason)
 {
     return(new TerminatingChildrenContainer(InternalChildren, _toDie, reason));
 }
 /// <summary>
 /// Refresh the class list.
 /// </summary>
 internal void OnProcessSuspended(SuspendReason reason)
 {
     // Refresh classes
     //RefreshClasses().Wait();
 }
 public TerminatingChildrenContainer(IImmutableDictionary <string, IChildStats> children, ImmutableHashSet <IActorRef> toDie, SuspendReason reason)
     : base(children)
 {
     _toDie  = toDie;
     _reason = reason;
 }
 public TerminatingChildrenContainer(IImmutableMap <string, ChildStats> children, IImmutableSet <ActorRef> toDie, SuspendReason reason)
     : base(children)
 {
     _toDie  = toDie;
     _reason = reason;
 }