public void RunTo(string filename, int line) { Breakpoint b = new Breakpoint(filename,null,line); AddBreakpoint(b); Run(); RemoveBreakpoint(b); }
/// <summary> /// Tell xdebug to set a line-based breakpoint. Other types /// not yet supported. /// </summary> public void AddBreakpoint(Breakpoint brk) { string filename = "file://"; if (brk.filename[0] != '/') filename += "/"; filename += System.Web.HttpUtility.UrlPathEncode(brk.filename); XDebug.Command c = new Command( "breakpoint_set", String.Format( "-t line -f {0} -n {1}", filename, brk.LineNumber_XDebug ) ); XDebug.Response resp = this.SendCommand(c); brk.xdebugId = resp.XmlMessage.DocumentElement.Attributes["id"].Value; }
/// <summary> /// Tell xdebug to remove a line-based breakpoint. Other types /// not yet supported. /// </summary> public void RemoveBreakpoint(Breakpoint brk) { XDebug.Command c = new Command( "breakpoint_remove", String.Format("-d {0}", brk.xdebugId) ); XDebug.Response resp = this.SendCommand(c); }
/// <summary> /// Record the given breakpoint under the given state. If the breakpoint already /// exists in our list simply remove it. It's state during this runstate is unchanged. /// </summary> public void Record(Breakpoint brk, BreakpointState brkState) { if (brkState == BreakpointState.Added) { // User removed it, but changed his mind before hitting Run. if (_Removed.Contains(brk)) { _Removed.Remove(brk); } else { _Added.Add(brk); } _Breakpoints.Add(brk); } else { if (_Added.Contains(brk)) { _Added.Remove(brk); } else { _Removed.Add(brk); } _Breakpoints.Remove(brk); } }