public DbgEvaluationContextImpl(DbgLanguage language, DbgRuntime runtime, TimeSpan funcEvalTimeout, DbgEvaluationContextOptions options) { lockObj = new object(); Language = language ?? throw new ArgumentNullException(nameof(language)); Runtime = runtime ?? throw new ArgumentNullException(nameof(runtime)); FuncEvalTimeout = funcEvalTimeout; Options = options; continueContext = new DbgContinueContext(); continueContext.Closed += DbgContinueContext_Closed; runtime.CloseOnContinue(continueContext); }
public static DbgValueNode[] ToValueNodeArray(DbgLanguage language, DbgRuntime runtime, DbgEngineValueNode[] engineNodes) { var nodes = new DbgValueNode[engineNodes.Length]; for (int i = 0; i < nodes.Length; i++) { nodes[i] = new DbgValueNodeImpl(language, runtime, engineNodes[i]); } runtime.CloseOnContinue(nodes); return(nodes); }
public static DbgLocalsValueNodeInfo[] ToLocalsValueNodeInfoArray(DbgLanguage language, DbgRuntime runtime, DbgEngineLocalsValueNodeInfo[] engineNodeInfos) { var infos = new DbgLocalsValueNodeInfo[engineNodeInfos.Length]; var nodes = new DbgValueNode[engineNodeInfos.Length]; for (int i = 0; i < nodes.Length; i++) { var node = new DbgValueNodeImpl(language, runtime, engineNodeInfos[i].ValueNode); nodes[i] = node; infos[i] = new DbgLocalsValueNodeInfo(engineNodeInfos[i].Kind, node); } runtime.CloseOnContinue(nodes); return(infos); }
DbgEvaluationResult CreateResult(DbgRuntime runtime, DbgEngineEvaluationResult result) { if (result.Error != null) { return(new DbgEvaluationResult(PredefinedEvaluationErrorMessagesHelper.GetErrorMessage(result.Error), result.FormatSpecifiers, result.Flags)); } try { var value = new DbgValueImpl(runtime, result.Value); runtime.CloseOnContinue(value); return(new DbgEvaluationResult(value, result.FormatSpecifiers, result.Flags)); } catch { runtime.Process.DbgManager.Close(result.Value); throw; } }
DbgCreateValueNodeResult[] CreateResult(DbgRuntime runtime, DbgEngineValueNode[] results) { if (results.Length == 0) { return(Array.Empty <DbgCreateValueNodeResult>()); } var res = new DbgCreateValueNodeResult[results.Length]; try { for (int i = 0; i < res.Length; i++) { var result = results[i]; var valueNode = new DbgValueNodeImpl(Language, runtime, result); runtime.CloseOnContinue(valueNode); res[i] = new DbgCreateValueNodeResult(valueNode, result.CausesSideEffects); } } catch { runtime.Process.DbgManager.Close(res.Select(a => a.ValueNode).Where(a => !(a is null))); throw; } return(res); }