Пример #1
0
 /// <summary>
 /// Associate a source file with a breakpoint or stack frame.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="bp"></param>
 public void AssociateSource(string filename, Breakpoint bp)
 {
     SendCommand("as b {0} {1}", bp.id, System.IO.Path.GetFullPath(filename));
 }
Пример #2
0
 /// <summary>
 /// Remove one or more breakpoints.
 /// </summary>
 /// <param name="bp"></param>
 public override void RemoveBreakpoint(Breakpoint bp)
 {
     SendCommand("rem {0}", bp.id);
 }
Пример #3
0
 public abstract void RemoveBreakpoint(Breakpoint bp);
Пример #4
0
        void ParseLine(string line)
        {
            Match m = null;

            if (ignoreline)
            {
                ignoreline = false;
                return;
            }

//      if (getmodes)
//      {
//        m = modeparse.Match(line);
//        if (m.Success)
//        {
//          bool on = m.Groups["v"].Value == "1";
//          string mode = m.Groups["mode"].Value;
//
//          Mode mm = (Mode) Enum.Parse(typeof(Mode), mode);
//          if (on)
//          {
//            systemmode |= mm;
//          }
//          else
//          {
//            systemmode &= ~mm;
//          }
//        }
//        return;
//      }

            if (line.StartsWith("Warning:"))
            {
                Trace.WriteLine("! " + line);
                return;
            }

            if (line == "Variable unavailable, or not valid" || line == "Error: Variable not found")
            {
                vars.Remove(lastvar);
                currentframe.RemoveAuto(lastvar);
                return;
            }

            if (line == "Failed to find method to match source line. Unable to set breakpoint.")
            {
                bp.SetBound(false);
                return;
            }

            if (line == "Process exited.")
            {
                OnDebugProcessExited();
                return;
            }

            if (line == "No local variables in scope.")
            {
                return;
            }

            if (line == "Process not running.")
            {
                return;
            }

            m = threadstate.Match(line);
            if (m.Success)
            {
                return;
            }

            m = threadmsg.Match(line);
            if (m.Success)
            {
                return;
            }

            m = sourceparse.Match(line);
            if (m.Success)
            {
                othervars.Clear();

                autos = new Set();
                locals.Clear();
                frames.Clear();

                string src = m.Groups["source"].Value;

                foreach (Match mm in autoparse.Matches(src))
                {
                    if (mm.Groups["var"].Success)
                    {
                        string var = mm.Groups["var"].Value;
                        if (IsAllowed(var))
                        {
                            autos.Add(var);
                        }
                    }
                }
                return;
            }

            StackFrame sf = StackFrame.FromDebugger(line);

            if (sf != null)
            {
                if (sf.IsCurrentFrame)
                {
                    currentframe = sf;
                    currentframe.SetAutos(autos);
                }
                frames.Add(sf);
                return;
            }

            m = proccreated.Match(line);
            if (m.Success)
            {
                return;
            }

            m = varparse.Match(line);
            if (m.Success)
            {
                string var  = m.Groups["var"].Value;
                string type = m.Groups["type"].Value;

                if (exinfo == null)
                {
                    if (var.StartsWith("$"))
                    {
                        othervars.Add(var);
                    }
                    else
                    {
                        if (!dontadd)
                        {
                            locals.Add(var);
                        }
                        else
                        {
                            autos.Add(var);
                        }
                    }
                    Trace.WriteLine(string.Format("n: {0} v: {1}", var, type));
                    vars[var] = type;
                }
                else
                {
                    switch (var)
                    {
                    case "_message": exinfo.message = type; break;
                    }
                }
                return;
            }

            m = bpparse.Match(line);
            if (m.Success)
            {
                bool active  = m.Groups["active"].Success;
                bool unbound = m.Groups["unbound"].Success;

                string bpid = m.Groups["id"].Value;
                string file = m.Groups["file"].Value;
                string meth = m.Groups["meth"].Value;

                bp.id = Convert.ToInt32(bpid);
                bp.SetBound(active && !unbound);

                return;
            }

            m = bpparse2.Match(line);
            if (m.Success)
            {
                bool unbound = m.Groups["unbound"].Success;

                string bpid = m.Groups["id"].Value;
                string file = m.Groups["file"].Value;

                bp.id = Convert.ToInt32(bpid);
                bp.SetBound(!unbound);
                return;
            }

            m = bpbound.Match(line);

            if (m.Success)
            {
                int bpid = Convert.ToInt32(m.Groups["id"].Value);

                Breakpoint bp = bptracker[bpid] as Breakpoint;
                if (bp != null)
                {
                    bp.SetBound(true);
                }
                return;
            }

            m = bpbreak.Match(line);

            if (m.Success)
            {
                int bpid = Convert.ToInt32(m.Groups["id"].Value);

                Breakpoint bp = bptracker[bpid] as Breakpoint;
                return;
            }

            m = exparse.Match(line);

            if (m.Success)
            {
                int    addr   = Convert.ToInt32(m.Groups["ex"].Value, 16);
                string extype = m.Groups["type"].Value;
                Trace.WriteLine(addr, extype);
                exinfo      = new ExceptionInfo();
                exinfo.type = extype;
                return;
            }

            Trace.WriteLine(string.Format("# Line not parsed: {0}", line));
        }
Пример #5
0
 public abstract void Break(Breakpoint bp);