Example #1
0
        public bool BreakpointExists(ParsingScript script)
        {
            if (m_debugger == null || m_breakpoints.Count == 0)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(script.Filename))
            {
                return(false);
            }

            string filename = Path.GetFileName(script.Filename);

            HashSet <int> bps;

            if (!m_breakpoints.TryGetValue(filename, out bps))
            {
                return(false);
            }

            int line = script.GetOriginalLineNumber();

            return(bps.Contains(line));
        }
Example #2
0
        int GetCurrentLineNumber(ParsingScript script)
        {
            if (script == m_debugging && !m_debugging.StillValid())
            {
#if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false
                return(-1);
#else
                return(-2);
#endif
            }
            return(script.GetOriginalLineNumber());
        }
Example #3
0
        public void AddOutput(string output, ParsingScript script)
        {
            if (!string.IsNullOrEmpty(Output) && !Output.EndsWith("\n"))
            {
                Output += "\n";
            }
            if (ReplMode)
            {
                Output += output;
                return;
            }
            int    origLineNumber = script.GetOriginalLineNumber();
            string filename       = Path.GetFullPath(script.Filename);

            Output += origLineNumber + "\t" + filename + "\n";
            Output += output;//.Replace('\n', ' ');
        }
Example #4
0
        public string GetStack(int firstOffset = 0)
        {
            StringBuilder result = new StringBuilder();
            ParsingScript script = this;

            while (script != null)
            {
                int    pointer    = script == this ? script.Pointer + firstOffset : script.Pointer;
                int    lineNumber = script.GetOriginalLineNumber(pointer);
                string filename   = string.IsNullOrWhiteSpace(script.Filename) ? "" : Path.GetFullPath(script.Filename);
                string line       = string.IsNullOrWhiteSpace(filename) ? "" : File.ReadLines(filename).Skip(lineNumber).Take(1).First();
                result.AppendLine("" + lineNumber);
                result.AppendLine(filename);
                result.AppendLine(line.Trim());
                script = script.ParentScript;
            }

            return(result.ToString().Trim());
        }
Example #5
0
        public void AddOutput(string output, ParsingScript script = null)
        {
            if (!string.IsNullOrEmpty(Output) && !Output.EndsWith("\n"))
            {
                Output += "\n";
            }
            if (ReplMode)
            {
                Output += output;
                return;
            }
            int    origLineNumber = script == null ? 0 : script.GetOriginalLineNumber();
            string filename       = "";

            if (script != null && script.Filename != null)
            {
                filename = Path.GetFullPath(script.Filename);
            }


            Output += origLineNumber + "\t" + filename + "\n";
            Output += output;
        }