示例#1
0
        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        private void Initialize()
        {
            enabled    = new bool[] { DefaultEnabled, false };
            loops      = new int[] { 0, 0 };
            active     = new int[] { 0, 0 };
            singleStep = new bool[] { false, false };

#if BREAKPOINTS
            breakOnToken = new bool[] { false, false };
#endif

            breakOnExecute = new bool[] { false, false };
            breakOnCancel  = new bool[] { false, false };
            breakOnError   = new bool[] { false, false };
            breakOnReturn  = new bool[] { false, false };
            breakOnTest    = new bool[] { false, false };
            breakOnExit    = new bool[] { false, false };
            steps          = new long[] { 0, 0 };

            types = new BreakpointType[] {
                DefaultTypes, BreakpointType.None
            };

#if BREAKPOINTS
            breakpoints = new BreakpointDictionary[] {
                new BreakpointDictionary(), null
            };
#endif

#if DEBUGGER_ARGUMENTS
            executeArguments = new ArgumentList[] { null, null };
#endif

            command = new string[] { null, null };
            result  = new Result[] { null, null };
            queue   = new QueueList <string, string>[] { null, null };

            callbackArguments = new StringList[] { null, null };
        }
示例#2
0
        ///////////////////////////////////////////////////////////////////////

#if BREAKPOINTS
        public ReturnCode GetBreakpointList(
            Interpreter interpreter,
            string pattern,
            bool noCase,
            ref IStringList list,
            ref Result error
            )
        {
            CheckDisposed();

            BreakpointDictionary breakpoints = Breakpoints;

            if (breakpoints != null)
            {
                list = breakpoints.ToList(pattern, noCase);
                return(ReturnCode.Ok);
            }
            else
            {
                error = "breakpoints not available";
            }

            return(ReturnCode.Error);
        }
示例#3
0
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode MatchBreakpoint(
            Interpreter interpreter,
            IScriptLocation location,
            ref bool match,
            ref Result error
            )
        {
            CheckDisposed();

            if (location != null)
            {
                if (ScriptLocation.Check(interpreter, location, false))
                {
                    string fileName = location.FileName;

                    if (fileName != null)
                    {
                        fileName = ScriptLocation.NormalizeFileName(
                            interpreter, fileName);
                    }

                    //
                    // NOTE: *WARNING: Empty file names are allowed here, please
                    //       do not change this to !String.IsNullOrEmpty.
                    //
                    if (fileName != null)
                    {
                        BreakpointDictionary breakpoints = Breakpoints;

                        if (breakpoints != null)
                        {
                            ScriptLocationIntDictionary scriptLocations;

                            if (breakpoints.TryGetValue(
                                    interpreter, fileName,
                                    out scriptLocations))
                            {
                                return(scriptLocations.Match(
                                           interpreter, location, ref match,
                                           ref error));
                            }
                            else
                            {
                                //
                                // NOTE: It was not found.
                                //
                                match = false;
                                return(ReturnCode.Ok);
                            }
                        }
                        else
                        {
                            error = "breakpoints not available";
                        }
                    }
                    else
                    {
                        error = "invalid script location file name";
                    }
                }
                else
                {
                    error = "bad script location";
                }
            }
            else
            {
                error = "invalid script location";
            }

            return(ReturnCode.Error);
        }
示例#4
0
        ///////////////////////////////////////////////////////////////////////

        #region IDebugger Members
        public void AddInfo(
            StringPairList list,
            DetailFlags detailFlags
            )
        {
            CheckDisposed();

            bool empty = HostOps.HasEmptyContent(detailFlags);

            if (empty || (suspendCount > 0))
            {
                list.Add("SuspendCount", suspendCount.ToString());
            }

            if (empty || Enabled)
            {
                list.Add("Enabled", Enabled.ToString());
            }

            if (empty || (Loops > 0))
            {
                list.Add("Loops", Loops.ToString());
            }

            if (empty || (Active > 0))
            {
                list.Add("Active", Active.ToString());
            }

            if (empty || SingleStep)
            {
                list.Add("SingleStep", SingleStep.ToString());
            }

#if BREAKPOINTS
            if (empty || BreakOnToken)
            {
                list.Add("BreakOnToken", BreakOnToken.ToString());
            }
#endif

            if (empty || BreakOnExecute)
            {
                list.Add("BreakOnExecute", BreakOnExecute.ToString());
            }

            if (empty || BreakOnCancel)
            {
                list.Add("BreakOnCancel", BreakOnCancel.ToString());
            }

            if (empty || BreakOnError)
            {
                list.Add("BreakOnError", BreakOnError.ToString());
            }

            if (empty || BreakOnReturn)
            {
                list.Add("BreakOnReturn", BreakOnReturn.ToString());
            }

            if (empty || BreakOnTest)
            {
                list.Add("BreakOnTest", BreakOnTest.ToString());
            }

            if (empty || BreakOnExit)
            {
                list.Add("BreakOnExit", BreakOnExit.ToString());
            }

            if (empty || (Steps > 0))
            {
                list.Add("Steps", Steps.ToString());
            }

            if (empty || (Types != BreakpointType.None))
            {
                list.Add("Types", Types.ToString());
            }

#if BREAKPOINTS
            BreakpointDictionary breakpoints = Breakpoints;

            if (empty || ((breakpoints != null) && (breakpoints.Count > 0)))
            {
                list.Add("Breakpoints", (breakpoints != null) ?
                         breakpoints.Count.ToString() : FormatOps.DisplayNull);
            }
#endif

#if DEBUGGER_ARGUMENTS
            ArgumentList executeArguments = ExecuteArguments;

            if (empty || (executeArguments != null))
            {
                list.Add("ExecuteArguments", (executeArguments != null) ?
                         executeArguments.ToString(ToStringFlags.NameAndValue,
                                                   null, false) : FormatOps.DisplayNull);
            }
#endif

            if (empty || !String.IsNullOrEmpty(Command))
            {
                list.Add("Command", FormatOps.DisplayString(
                             FormatOps.ReplaceNewLines(FormatOps.NormalizeNewLines(
                                                           Command))));
            }

            if (empty || !String.IsNullOrEmpty(Result))
            {
                list.Add("Result", FormatOps.DisplayString(
                             FormatOps.ReplaceNewLines(FormatOps.NormalizeNewLines(
                                                           Result))));
            }

            QueueList <string, string> queue = Queue;

            if (empty || ((queue != null) && (queue.Count > 0)))
            {
                list.Add("Queue", (queue != null) ?
                         queue.Count.ToString() : FormatOps.DisplayNull);
            }

            StringList callbackArguments = CallbackArguments;

            if (empty || ((callbackArguments != null) &&
                          (callbackArguments.Count > 0)))
            {
                list.Add("CallbackArguments", (callbackArguments != null) ?
                         callbackArguments.ToString() : FormatOps.DisplayNull);
            }

            if (interpreter != null)
            {
                interpreter.GetHostDebuggerInfo(ref list, detailFlags);
            }
            else if (empty)
            {
                list.Add((IPair <string>)null);
                list.Add("Interpreter");
                list.Add((IPair <string>)null);
                list.Add("Id", FormatOps.DisplayNull);
            }
        }