SetDebugger() public method

Set the associated debugger.
Set the associated debugger.
public SetDebugger ( Debugger debugger, object contextData ) : void
debugger Debugger /// the debugger to be used on callbacks from /// the engine. ///
contextData object /// arbitrary object that debugger can use to store /// per Context data. ///
return void
示例#1
0
文件: Dim.cs 项目: hazzik/Rhino.Net
			// ContextFactory.Listener
			/// <summary>Called when a Context is created.</summary>
			/// <remarks>Called when a Context is created.</remarks>
			public virtual void ContextCreated(Context cx)
			{
				if (type != IPROXY_LISTEN)
				{
					Kit.CodeBug();
				}
				Dim.ContextData contextData = new Dim.ContextData();
				Rhino.Debug.Debugger debugger = new Dim.DimIProxy(dim, IPROXY_DEBUG);
				cx.SetDebugger(debugger, contextData);
				cx.SetGeneratingDebug(true);
				cx.SetOptimizationLevel(-1);
			}
示例#2
0
文件: Dim.cs 项目: hazzik/Rhino.Net
		/// <summary>Evaluates script in the given stack frame.</summary>
		/// <remarks>Evaluates script in the given stack frame.</remarks>
		private static string Do_eval(Context cx, Dim.StackFrame frame, string expr)
		{
			string resultString;
			Rhino.Debug.Debugger saved_debugger = cx.GetDebugger();
			object saved_data = cx.GetDebuggerContextData();
			int saved_level = cx.GetOptimizationLevel();
			cx.SetDebugger(null, null);
			cx.SetOptimizationLevel(-1);
			cx.SetGeneratingDebug(false);
			try
			{
				Callable script = (Callable)cx.CompileString(expr, string.Empty, 0, null);
				object result = script.Call(cx, frame.scope, frame.thisObj, ScriptRuntime.emptyArgs);
				if (result == Undefined.instance)
				{
					resultString = string.Empty;
				}
				else
				{
					resultString = ScriptRuntime.ToString(result);
				}
			}
			catch (Exception exc)
			{
				resultString = exc.Message;
			}
			finally
			{
				cx.SetGeneratingDebug(true);
				cx.SetOptimizationLevel(saved_level);
				cx.SetDebugger(saved_debugger, saved_data);
			}
			if (resultString == null)
			{
				resultString = "null";
			}
			return resultString;
		}