Beispiel #1
0
        private SourcecodeSegment SetIP(bool simulate, string filename, int line, int column)
        {
            process.AssertPaused();

            SourcecodeSegment segment = SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, filename, null, line, column);

            if (segment != null && segment.CorFunction.GetToken() == this.MethodInfo.MetadataToken)
            {
                try
                {
                    if (simulate)
                    {
                        CorILFrame.CanSetIP((uint)segment.ILStart);
                    }
                    else
                    {
                        // Invalidates all frames and chains for the current thread
                        CorILFrame.SetIP((uint)segment.ILStart);
                        process.NotifyResumed(DebuggeeStateAction.Keep);
                        process.NotifyPaused(PausedReason.SetIP);
                        process.RaisePausedEvents();
                    }
                }
                catch
                {
                    return(null);
                }
                return(segment);
            }
            return(null);
        }
Beispiel #2
0
 /// <exception cref="DebuggerException">Evaluation can not be stopped</exception>
 /// <exception cref="GetValueException">Process exited</exception>
 private Value WaitForResult()
 {
     // Note that aborting is not supported for suspended threads
     try
     {
         process.WaitForPause(TimeSpan.FromMilliseconds(500));
         if (!Evaluated)
         {
             process.TraceMessage("Aborting eval: " + Description);
             this.CorEval.Abort();
             process.WaitForPause(TimeSpan.FromMilliseconds(2500));
             if (!Evaluated)
             {
                 process.TraceMessage("Rude aborting eval: " + Description);
                 this.CorEval2.RudeAbort();
                 process.WaitForPause(TimeSpan.FromMilliseconds(5000));
                 if (!Evaluated)
                 {
                     if (Variables.Langue == "en")
                     {
                         throw new DebuggerException(VelerSoftware.SZC.Properties.Resources.Eval_Not_Stopped_EN);
                     }
                     else
                     {
                         throw new DebuggerException(VelerSoftware.SZC.Properties.Resources.Eval_Not_Stopped);
                     }
                 }
             }
             // Note that this sets Evaluated to true
             state = EvalState.EvaluatedTimeOut;
         }
         process.AssertPaused();
         return(this.Result);
     }
     catch (ProcessExitedException)
     {
         if (Variables.Langue == "en")
         {
             throw new GetValueException(VelerSoftware.SZC.Properties.Resources.Eval_Process_Exited_EN);
         }
         else
         {
             throw new GetValueException(VelerSoftware.SZC.Properties.Resources.Eval_Process_Exited);
         }
     }
 }
Beispiel #3
0
        internal StackFrame GetStackFrameAt(uint chainIndex, uint frameIndex)
        {
            process.AssertPaused();

            ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains();

            if (chainIndex >= corChainEnum.GetCount())
            {
                throw new DebuggerException("The requested chain index is too big");
            }
            corChainEnum.Skip(corChainEnum.GetCount() - chainIndex - 1);
            ICorDebugChain corChain = corChainEnum.Next();

            if (corChain.IsManaged() == 0)
            {
                throw new DebuggerException("The requested chain is not managed");
            }

            ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames();

            if (frameIndex >= corFrameEnum.GetCount())
            {
                throw new DebuggerException("The requested frame index is too big");
            }
            corFrameEnum.Skip(corFrameEnum.GetCount() - frameIndex - 1);
            ICorDebugFrame corFrame = corFrameEnum.Next();

            if (!(corFrame is ICorDebugILFrame))
            {
                throw new DebuggerException("The rquested frame is not IL frame");
            }

            StackFrame stackFrame = new StackFrame(this, (ICorDebugILFrame)corFrame, chainIndex, frameIndex);

            return(stackFrame);
        }