コード例 #1
0
ファイル: JintHelper.cs プロジェクト: xhute/Kooboo
        private static object GetValue(Jint.Runtime.Debugger.DebugInformation info, string property)
        {
            var value = info.Locals.Where(item => item.Key.ToLower() == property).Select(item => item.Value).FirstOrDefault();

            if (value == null)
            {
                value = info.Globals.Where(item => item.Key.ToLower() == property).Select(item => item.Value).FirstOrDefault();
            }
            return(value);
        }
コード例 #2
0
 private Jint.Runtime.Debugger.StepMode C_Step(object sender, Jint.Runtime.Debugger.DebugInformation e)
 {
     if (mOutputConsole != null)
     {
         mOutputConsole.WriteString(string.Format("Line {1}: {0}\n", e.CurrentStatement.ToString(), e.CurrentStatement.Location.Start.Line));
     }
     while (mDebugWait && !mDoStep)
     {
         Thread.Sleep(200);
     }
     mDoStep = false;
     return(Jint.Runtime.Debugger.StepMode.Over);
 }
コード例 #3
0
        private static Jint.Runtime.Debugger.StepMode Engine_Step(object sender, Jint.Runtime.Debugger.DebugInformation e, ScriptDebugger.DebugSession session)
        {
            if (session.EndOfSession)
            {
                return(Jint.Runtime.Debugger.StepMode.None);
            }

            var info = new ScriptDebugger.DebugInfo
            {
                Start = e.CurrentStatement.Location.Start,
                End   = e.CurrentStatement.Location.End,

                Variables = Kooboo.Sites.Scripting.Manager.GetVariables(sender as Jint.Engine)
            };

            session.DebugInfo = info;

            int count = 1;

            while (session.Action == null)
            {
                System.Threading.Thread.Sleep(100);
                count += 1;
                if (count > 10000)
                {
                    break;
                }

                if (session.EndOfSession)
                {
                    return(Jint.Runtime.Debugger.StepMode.None);
                }
            }


            if (session.EndOfSession)
            {
                return(Jint.Runtime.Debugger.StepMode.None);
            }

            if (session.Action != null)
            {
                var mode = session.Action.StepMode;
                session.Action = null;
                return(mode);
            }

            return(Jint.Runtime.Debugger.StepMode.None);
        }
コード例 #4
0
ファイル: Manager.cs プロジェクト: weedkiller/Kooboo
        private static Jint.Runtime.Debugger.StepMode EngineStepOrBreak(object sender, Jint.Runtime.Debugger.DebugInformation e, DebugSession session)
        {
            try
            {
                if (session.Exception != null)
                {
                    return(Jint.Runtime.Debugger.StepMode.None);
                }

                session.HandleStep(new DebugInfo
                {
                    CurrentLine = e.CurrentStatement.Location.Start.Line,
                    Variables   = GetVariables(session.JsEngine)
                });

                Task.Delay(new TimeSpan(0, 10, 0), session.CancellationTokenSource.Token).Wait();
                return(Jint.Runtime.Debugger.StepMode.None);
            }
            catch
            {
                return(session.StepMode);
            }
        }