using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MoonSharp.Interpreter.Execution.VM;
namespace MoonSharp.Interpreter.Debugging
{
///
/// Interface for debuggers to implement, in order to provide debugging facilities to Scripts.
///
public interface IDebugger
{
///
/// Called by the script engine when a source code is added or changed.
///
/// The source code object.
void SetSourceCode(SourceCode sourceCode);
///
/// Called by the script engine when the bytecode changes.
///
/// The bytecode source
void SetByteCode(string[] byteCode);
///
/// Called by the script engine at execution time to check if a break has
/// been requested. Should return pretty fast as it's called A LOT.
///
bool IsPauseRequested();
///
/// Called by the script engine when a runtime error occurs.
/// The debugger can return true to signal the engine that it wants to break
/// into the source of the error. If it does so, it should also return true
/// to subsequent calls to IsPauseRequested().
///
/// The runtime exception.
/// True if this error should break execution.
bool SignalRuntimeException(ScriptRuntimeException ex);
///
/// Called by the script engine to get what action to do next.
///
/// The instruction pointer in bytecode.
/// The source reference.
/// T
DebuggerAction GetAction(int ip, SourceRef sourceref);
///
/// Called by the script engine when the execution ends.
///
void SignalExecutionEnded();
///
/// Called by the script engine to update watches of a given type. Note
/// that this method is not called only for watches in the strictest term,
/// but also for the stack, etc.
///
/// Type of the watch.
/// The items.
void Update(WatchType watchType, IEnumerable items);
///
/// Called by the script engine to get which expressions are active
/// watches in the debugger.
///
/// A list of watches
List GetWatchItems();
///
/// Called by the script engine to refresh the breakpoint list.
///
void RefreshBreakpoints(IEnumerable refs);
}
}