/// <summary> /// Constructor. /// </summary> /// <param name="luaDebug">Lua debug structure.</param> /// <param name="fileName">Filename</param> /// <param name="line">Line number</param> /// <param name="action">Action</param> /// <param name="breakpoint">Brewakpoint</param> public StopingEventArgs(LuaDebug luaDebug, string fileName, int line, DebuggerActions action, LuaDebugBreakpoint breakpoint) { LuaDebug = luaDebug; FileName = fileName; Line = line; Action = action; Breakpoint = breakpoint; }
/// <summary> /// Toggels the breakpoint at a given line. /// </summary> /// <param name="line">Line number.</param> /// <returns> /// If the breakpoint was created, then the breakpoint is returned. /// If the breakpoint was removen, then null is returned. /// </returns> public LuaDebugBreakpoint ToggleBreakpoint(int line) { LuaDebugBreakpoint breakpoint = GetBreakpoint(line); if (breakpoint != null) { RemoveBreakpoint(breakpoint); return(null); } else { return(AddBreakpoint(line)); } }
/// <summary> /// Adds a new breapoint. /// </summary> /// <param name="line">Line number.</param> /// <returns> /// Returns the new breakpoints. /// If the breakpoint at that line already exists, then the existing breakpoint is returned. /// </returns> public LuaDebugBreakpoint AddBreakpoint(int line) { LuaDebugBreakpoint breakpoint = GetBreakpoint(line); if (breakpoint != null) { breakpoint.Enabled = true; } else { breakpoint = Debugger.BreakpointFactory.CreateBreakpoint(this, line); m_Breakpoints.Add(breakpoint); } return(breakpoint); }
/// <summary> /// Adds a new breakpoint. /// </summary> /// <param name="fileName">Filename</param> /// <param name="line">Line</param> /// <returns> /// Returns the new breakpoint. /// If the breakpoint already exists, then the existing breakpoint is returned. /// </returns> public LuaDebugBreakpoint AddBreakpoint(string fileName, int line) { LuaDebugFile file = GetFile(fileName); if (file == null) { file = AddFile(fileName); } LuaDebugBreakpoint breakpoint = file.GetBreakpoint(line); if (breakpoint == null) { breakpoint = file.AddBreakpoint(line); } return(breakpoint); }
/// <summary> /// Stops execution. /// </summary> /// <param name="luaDebug">LuaDebug from debug hook.</param> /// <param name="action">Current Debugger Action.</param> /// <param name="breakpoint">Brekpoint. Can be null.</param> /// <remarks> /// The WaitingForAction event is called as long as State == Stoped. /// </remarks> private void StopExecution(LuaDebug luaDebug, DebuggerActions action, LuaDebugBreakpoint breakpoint) { m_State = LuaDebuggerState.Stoped; try { OnStopping(new StopingEventArgs( luaDebug, luaDebug.shortsrc, luaDebug.eventCode == EventCodes.LUA_HOOKCALL ? luaDebug.linedefined : luaDebug.currentline, action, breakpoint)); do { OnWaitingForAction(new EventArgs()); }while (m_State == LuaDebuggerState.Stoped); } finally { m_State = LuaDebuggerState.Running; } }
/// <summary> /// Removes a breakpoint. /// </summary> /// <param name="breakpoint">Breakpoint</param> public void RemoveBreakpoint(LuaDebugBreakpoint breakpoint) { m_Breakpoints.Remove(breakpoint); }