public void NewParameterizedObject(CorFunction managedFunction, CorType[] argumentTypes, CorValue[] arguments) { ICorDebugType[] types = null; int typesLength = 0; ICorDebugValue[] values = null; int valuesLength = 0; ICorDebugEval2 eval2 = (ICorDebugEval2)m_eval; if (argumentTypes != null) { types = new ICorDebugType[argumentTypes.Length]; for (int i = 0; i < argumentTypes.Length; i++) { types[i] = argumentTypes[i].m_type; } typesLength = types.Length; } if (arguments != null) { values = new ICorDebugValue[arguments.Length]; for (int i = 0; i < arguments.Length; i++) { values[i] = arguments[i].m_val; } valuesLength = values.Length; } eval2.NewParameterizedObject(managedFunction.m_function, (uint)typesLength, types, (uint)valuesLength, values); }
public void NewParameterizedObject(CorFunction managedFunction, CorType[] argumentTypes, CorValue[] arguments) { ICorDebugType[] types = null; int typesLength = 0; ICorDebugValue[] values = null; int valuesLength = 0; ICorDebugEval2 eval2 = (ICorDebugEval2) m_eval; if (argumentTypes != null) { types = new ICorDebugType[argumentTypes.Length]; for (int i = 0; i < argumentTypes.Length; i++) types[i] = argumentTypes[i].m_type; typesLength = types.Length; } if (arguments != null) { values = new ICorDebugValue[arguments.Length]; for (int i = 0; i < arguments.Length; i++) values[i] = arguments[i].m_val; valuesLength = values.Length; } eval2.NewParameterizedObject(managedFunction.m_function, (uint)typesLength, types, (uint)valuesLength, values); }
internal MDbgFunction(MDbgModule managedModule, CorFunction managedFunction) { Debug.Assert(managedModule != null); Debug.Assert(managedFunction != null); Debug.Assert(managedFunction.Version >= 0 && managedFunction.Version - 1 <= managedModule.EditsCounter); // version numbers starts with 1 m_module = managedModule; m_function = managedFunction; EnsureIsUpToDate(); }
/// <summary> /// Looks up a CorFunction. /// </summary> /// <param name="managedFunction">Which CorFunction to lookup.</param> /// <returns>The coresponding MDbgFunction.</returns> public MDbgFunction LookupFunction(CorFunction managedFunction) { if (managedFunction != null) { return this.Lookup(managedFunction.Module).GetFunction(managedFunction); } else { return null; } }
public void CallFunction(CorFunction managedFunction, CorValue[] arguments) { ICorDebugValue[] values = null; if(arguments!=null) { values = new ICorDebugValue[arguments.Length]; for(int i=0;i<arguments.Length;i++) values[i] = arguments[i].m_val; } m_eval.CallFunction(managedFunction.m_function, (uint) (arguments==null?0:arguments.Length), values); }
public MDbgFunction Get(CorFunction managedFunction) { int funcVersion; funcVersion = managedFunction.Version; // now get version from our cache. MDbgFunction mdbgFunction = RetrieveFromCache(managedFunction.Token, funcVersion); if (mdbgFunction == null) { mdbgFunction = new MDbgFunction(m_module, managedFunction); AddToCache(managedFunction.Token, funcVersion, mdbgFunction); } return mdbgFunction; }
public void CallFunction(CorFunction managedFunction, CorValue[] arguments) { ICorDebugValue[] values = null; if (arguments != null) { values = new ICorDebugValue[arguments.Length]; for (int i = 0; i < arguments.Length; i++) { values[i] = arguments[i].m_val; } } m_eval.CallFunction(managedFunction.m_function, (uint)(arguments == null ? 0 : arguments.Length), values); }
private bool attemptToSetBreakpointThroughSequencePoints(ISymbolDocument doc, int line, ISymbolMethod method, CorFunction function) { bool found = false; foreach (var sp in getSequencePoints(method)) { if (sp.Document.URL.Equals(doc.URL) && sp.LineStart.Equals(line)) { var bp = function.ILCode.CreateBreakpoint(sp.Offset); bp.Activate(true); found = true; break; } } return found; }
public CorType GetVirtualMethodAndType(int memberToken, out CorFunction managedFunction) { ICorDebugType dt = null; ICorDebugFunction pfunc = null; (m_objVal as ICorDebugObjectValue2).GetVirtualMethodAndType((uint)memberToken, out pfunc, out dt); if (pfunc == null) { managedFunction = null; } else { managedFunction = new CorFunction(pfunc); } return(dt == null ? null : new CorType(dt)); }
/// <summary> /// Create a new instance of the FunctionRemapCompleteStopReason class. /// </summary> /// <param name="appDomain">The appDomain where remapping is occuring.</param> /// <param name="thread">The thread on which the remapping is occuring.</param> /// <param name="managedFunction">The version of function the debugger remapped to.</param> public FunctionRemapCompleteStopReason(CorAppDomain appDomain, CorThread thread, CorFunction managedFunction) { Debug.Assert(appDomain != null); Debug.Assert(thread != null); Debug.Assert(managedFunction != null); m_appDomain = appDomain; m_thread = thread; m_function = managedFunction; }
private void setBreakpointThroughFunction(CorFunction function) { var bp = function.CreateBreakpoint(); bp.Activate(true); }
/// <summary> /// Releases all resources used by the MDbgFunction. /// </summary> public void Dispose() { // Release unmanaged resources, especially symbol readers m_function = null; m_symMethod = null; m_SPoffsets = null; m_SPdocuments = null; m_SPstartLines = null; m_SPendLines = null; m_SPstartColumns = null; m_SPendColumns = null; m_SPcount = 0; }
public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain, CorThread thread, CorFunction managedFunction ) : base(appDomain, thread) { m_managedFunction = managedFunction; }
public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain, CorThread thread, CorFunction oldFunction, CorFunction newFunction, int oldILoffset ) : base(appDomain, thread) { m_oldFunction = oldFunction; m_newFunction = newFunction; m_oldILoffset = oldILoffset; }
internal CorActiveFunction(int ilOffset, CorFunction managedFunction, CorModule managedModule) { m_ilOffset = ilOffset; m_function = managedFunction; m_module = managedModule; }
private SequencePoint get_location(CorFunction function, uint offset) { var reader = _symbolReaders.Find(r => r.Key.Equals(function.Module.Name)).Value; var symmethod = reader.GetMethod(new SymbolToken(function.Token)); if (symmethod == null) return null; SequencePoint prev_sp = null; foreach (var sp in new SequencePointFactory().Generate(symmethod)) { if (sp.Offset > offset) break; prev_sp = sp; } return prev_sp; }
public RemapOpportunityReachedStopReason(CorAppDomain appDomain, CorThread thread, CorFunction oldFunction, CorFunction newFunction, int oldILOffset) { Debug.Assert(appDomain != null); Debug.Assert(thread != null); Debug.Assert(oldFunction != null); Debug.Assert(newFunction != null); m_appDomain = appDomain; m_thread = thread; m_oldFunction = oldFunction; m_newFunction = newFunction; m_oldILOffset = oldILOffset; }
public CorValue RuntimeInvoke (CorFunction function, CorType[] typeArgs, CorValue thisObj, CorValue[] arguments) { return Session.RuntimeInvoke (this, function, typeArgs, thisObj, arguments); }
public CorValue RuntimeInvoke (CorEvaluationContext ctx, CorFunction function, CorType[] typeArgs, CorValue thisObj, CorValue[] arguments) { if (!ctx.Thread.ActiveChain.IsManaged) throw new EvaluatorException ("Cannot evaluate expression because the thread is stopped in native code."); CorValue[] args; if (thisObj == null) args = arguments; else { args = new CorValue[arguments.Length + 1]; args[0] = thisObj; arguments.CopyTo (args, 1); } CorMethodCall mc = new CorMethodCall (); CorValue exception = null; CorEval eval = ctx.Eval; EvalEventHandler completeHandler = delegate (object o, CorEvalEventArgs eargs) { OnEndEvaluating (); mc.DoneEvent.Set (); eargs.Continue = false; }; EvalEventHandler exceptionHandler = delegate (object o, CorEvalEventArgs eargs) { OnEndEvaluating (); exception = eargs.Eval.Result; mc.DoneEvent.Set (); eargs.Continue = false; }; process.OnEvalComplete += completeHandler; process.OnEvalException += exceptionHandler; mc.OnInvoke = delegate { if (function.GetMethodInfo (this).Name == ".ctor") eval.NewParameterizedObject (function, typeArgs, args); else eval.CallParameterizedFunction (function, typeArgs, args); process.SetAllThreadsDebugState (CorDebugThreadState.THREAD_SUSPEND, ctx.Thread); ClearEvalStatus (); OnStartEvaluating (); process.Continue (false); }; mc.OnAbort = delegate { eval.Abort (); }; mc.OnGetDescription = delegate { System.Reflection.MethodInfo met = function.GetMethodInfo (ctx.Session); if (met != null) return met.Name; else return "<Unknown>"; }; try { ObjectAdapter.AsyncExecute (mc, ctx.Options.EvaluationTimeout); } finally { process.OnEvalComplete -= completeHandler; process.OnEvalException -= exceptionHandler; } if (exception != null) { /* ValueReference<CorValue, CorType> msg = ctx.Adapter.GetMember (ctx, val, "Message"); if (msg != null) { string s = msg.ObjectValue as string; mc.ExceptionMessage = s; } else mc.ExceptionMessage = "Evaluation failed.";*/ CorValRef vref = new CorValRef (exception); throw new EvaluatorException ("Evaluation failed: " + ObjectAdapter.GetValueTypeName (ctx, vref)); } return eval.Result; }
public CorType GetVirtualMethodAndType(int memberToken, out CorFunction managedFunction) { ICorDebugType dt = null; ICorDebugFunction pfunc = null; (m_objVal as ICorDebugObjectValue2).GetVirtualMethodAndType((uint)memberToken, out pfunc, out dt); if (pfunc == null) managedFunction = null; else managedFunction = new CorFunction (pfunc); return dt==null?null:new CorType (dt); }
public CorEditAndContinueRemapEventArgs(CorAppDomain appDomain, CorThread thread, CorFunction managedFunction, int accurate, ManagedCallbackType callbackType) : base(appDomain, thread, callbackType) { m_managedFunction = managedFunction; m_accurate = accurate; }
internal CorActiveFunction(int ilOffset, CorFunction managedFunction, CorModule managedModule) { m_ilOffset = ilOffset; m_function = managedFunction; m_module = managedModule; }
public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain, CorThread thread, CorFunction oldFunction, CorFunction newFunction, int oldILoffset, ManagedCallbackType callbackType ) : base(appDomain, thread, callbackType) { m_oldFunction = oldFunction; m_newFunction = newFunction; m_oldILoffset = oldILoffset; }
/// <summary> /// Gets the MDbgFunction for a given CorFunction. /// </summary> /// <param name="managedFunction">The CorFunction to lookup.</param> /// <returns>The coresponding MDbgFunction.</returns> public MDbgFunction GetFunction(CorFunction managedFunction) { return m_functions.Get(managedFunction); }
public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain, CorThread thread, CorFunction managedFunction, ManagedCallbackType callbackType ) : base(appDomain, thread, callbackType) { m_managedFunction = managedFunction; }
/// <summary> /// Looks up a CorFunction. /// </summary> /// <param name="managedFunction">Which CorFunction to lookup.</param> /// <returns>The coresponding MDbgFunction.</returns> public MDbgFunction LookupFunction(CorFunction managedFunction) { return this.Lookup(managedFunction.Module).GetFunction(managedFunction); }