public static CorDebugClass ClassFromRuntimeValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { RuntimeValue_Reflection rtvf = rtv as RuntimeValue_Reflection; CorDebugClass cls = null; object objBuiltInKey = null; Debug.Assert(!rtv.IsNull); if (rtvf != null) { objBuiltInKey = rtvf.ReflectionType; } else if (rtv.DataType == RuntimeDataType.DATATYPE_TRANSPARENT_PROXY) { objBuiltInKey = RuntimeDataType.DATATYPE_TRANSPARENT_PROXY; } else { cls = TinyCLR_TypeSystem.CorDebugClassFromTypeIndex(rtv.Type, appDomain); } if (objBuiltInKey != null) { CorDebugProcess.BuiltinType builtInType = appDomain.Process.ResolveBuiltInType(objBuiltInKey); cls = builtInType.GetClass(appDomain); if (cls == null) { cls = new CorDebugClass(builtInType.GetAssembly(appDomain), builtInType.TokenCLR); } } return(cls); }
protected internal RuntimeValue_Indirect(Engine eng, WireProtocol.Commands.Debugging_Value[] array, int pos) : base(eng, array[pos]) { if (++pos < array.Length) { m_value = Convert(eng, array, pos); } }
public static CorDebugClass ClassFromRuntimeValue (RuntimeValue rtv, CorDebugAppDomain appDomain) { RuntimeValue_Reflection rtvf = rtv as RuntimeValue_Reflection; CorDebugClass cls = null; object objBuiltInKey = null; Debug.Assert (!rtv.IsNull); if (rtvf != null) { objBuiltInKey = rtvf.ReflectionType; } else if (rtv.DataType == RuntimeDataType.DATATYPE_TRANSPARENT_PROXY) { objBuiltInKey = RuntimeDataType.DATATYPE_TRANSPARENT_PROXY; } else { cls = TinyCLR_TypeSystem.CorDebugClassFromTypeIndex (rtv.Type, appDomain); } if (objBuiltInKey != null) { CorDebugProcess.BuiltinType builtInType = appDomain.Process.ResolveBuiltInType (objBuiltInKey); cls = builtInType.GetClass (appDomain); if (cls == null) { cls = new CorDebugClass (builtInType.GetAssembly (appDomain), builtInType.TokenCLR); } } return cls; }
protected internal RuntimeValue_Indirect( Engine eng, WireProtocol.Commands.Debugging_Value[] array, int pos ) : base( eng, array[pos] ) { if(++pos < array.Length) { m_value = Convert( eng, array, pos ); } }
private bool IsValuePrimitive() { if (m_fIsBoxed || m_fIsEnum) { if (m_valuePrimitive == null) { if (m_rtv.IsBoxed) { RuntimeValue rtv = m_rtv.GetField(1, 0); Debug.Assert(rtv.IsPrimitive); //Assert that m_class really points to a primitive m_valuePrimitive = (CorDebugValuePrimitive)CreateValue(rtv); } else { Debug.Assert(m_fIsEnum); m_valuePrimitive = new CorDebugValuePrimitive(m_rtv, m_appDomain); Debug.Assert(m_rtv.IsPrimitive); } } } return(m_valuePrimitive != null); }
//Object or CLASS, or VALUETYPE public CorDebugValueObject(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { if (!rtv.IsNull) { m_class = CorDebugValue.ClassFromRuntimeValue(rtv, appDomain); m_fIsEnum = m_class.IsEnum; m_fIsBoxed = rtv.IsBoxed; } }
public static CorDebugValue[] CreateValues (RuntimeValue[] rtv, CorDebugAppDomain appDomain) { CorDebugValue[] values = new CorDebugValue[rtv.Length]; for (int i = 0; i < rtv.Length; i++) { values [i] = CorDebugValue.CreateValue (rtv [i], appDomain); } return values; }
int ICorDebugObjectValue.GetFieldValue(ICorDebugClass pClass, uint fieldDef, out ICorDebugValue ppValue) { //cache fields? RuntimeValue rtv = m_rtv.GetField(0, TinyCLR_TypeSystem.ClassMemberIndexFromCLRToken(fieldDef, ((CorDebugClass)pClass).Assembly)); ppValue = CreateValue(rtv); return(Utility.COM_HResults.S_OK); }
int ICorDebugReferenceValue.SetValue(ulong value) { Debug.Assert(value <= uint.MaxValue); RuntimeValue rtvNew = m_rtv.Assign((uint)value); this.RuntimeValue = rtvNew; return(Utility.COM_HResults.S_OK); }
public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { CorDebugValue val = null; bool fIsReference; if (rtv.IsBoxed) { val = new CorDebugValueBoxedObject (rtv, appDomain); fIsReference = true; } else if (rtv.IsPrimitive) { CorDebugClass c = ClassFromRuntimeValue (rtv, appDomain); if (c.IsEnum) { val = new CorDebugValueObject (rtv, appDomain); fIsReference = false; } else { val = new CorDebugValuePrimitive (rtv, appDomain); fIsReference = false; } } else if (rtv.IsArray) { val = new CorDebugValueArray (rtv, appDomain); fIsReference = true; } else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING) { val = new CorDebugValueString (rtv, appDomain); fIsReference = true; } else { val = new CorDebugValueObject (rtv, appDomain); fIsReference = !rtv.IsValueType; } if (fIsReference) { val = new CorDebugValueReference(val, val.m_rtv, val.m_appDomain); } if (rtv.IsReference) //CorElementType.ELEMENT_TYPE_BYREF { val = new CorDebugValueReferenceByRef(val, val.m_rtv, val.m_appDomain); } return val; }
public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { CorDebugValue val = null; bool fIsReference; if (rtv.IsBoxed) { val = new CorDebugValueBoxedObject(rtv, appDomain); fIsReference = true; } else if (rtv.IsPrimitive) { CorDebugClass c = ClassFromRuntimeValue(rtv, appDomain); if (c.IsEnum) { val = new CorDebugValueObject(rtv, appDomain); fIsReference = false; } else { val = new CorDebugValuePrimitive(rtv, appDomain); fIsReference = false; } } else if (rtv.IsArray) { val = new CorDebugValueArray(rtv, appDomain); fIsReference = true; } else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING) { val = new CorDebugValueString(rtv, appDomain); fIsReference = true; } else { val = new CorDebugValueObject(rtv, appDomain); fIsReference = !rtv.IsValueType; } if (fIsReference) { val = new CorDebugValueReference(val, val.m_rtv, val.m_appDomain); } if (rtv.IsReference) //CorElementType.ELEMENT_TYPE_BYREF { val = new CorDebugValueReferenceByRef(val, val.m_rtv, val.m_appDomain); } return(val); }
int ICorDebugClass.GetStaticFieldValue(uint fieldDef, ICorDebugFrame pFrame, out ICorDebugValue ppValue) { //Cache, and invalidate when necessary??? uint fd = TinyCLR_TypeSystem.ClassMemberIndexFromCLRToken(fieldDef, this.Assembly); this.Process.SetCurrentAppDomain(this.AppDomain); RuntimeValue rtv = this.Engine.GetStaticFieldValue(fd); ppValue = CorDebugValue.CreateValue(rtv, this.AppDomain); return(Utility.COM_HResults.S_OK); }
int ICorDebugThread.GetObject(out ICorDebugValue ppObject) { Debug.Assert(!IsVirtualThread); RuntimeValue rv = Engine.GetThread(m_id); if (rv != null) { ppObject = CorDebugValue.CreateValue(rv, this.AppDomain); } else { ppObject = null; } return(Utility.COM_HResults.S_OK); }
public RuntimeValue Assign(RuntimeValue val) { RuntimeValue retval = null; if (this.IsReflection || (val != null && val.IsReflection)) { byte[] data = new byte[8]; uint dt = (uint)RuntimeDataType.DATATYPE_OBJECT; if (val != null) { dt = val.m_handle.m_dt; Array.Copy(val.m_handle.m_builtinValue, data, data.Length); } if (SetBlock(dt, data)) { retval = this; } } else if (this.IsPrimitive) { if (val == null || val.IsPrimitive == false) { throw new InvalidCastException("The two runtime values are incompatible"); } this.Value = val.Value; retval = this; } else { if (val != null && val.IsPrimitive == true) { throw new InvalidCastException("The two runtime values are incompatible"); } retval = Assign(val != null ? val.ReferenceIdDirect : 0); } return(retval); }
public CorDebugValueReference(CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { m_value = val; }
public CorDebugValueBoxedObject(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { m_value = new CorDebugValueObject(rtv, appDomain); }
public CorDebugValueArray(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }
public CorDebugValueString (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
public RuntimeValue Assign( RuntimeValue val ) { RuntimeValue retval = null; if(this.IsReflection || (val != null && val.IsReflection)) { byte[] data = new byte[8]; uint dt = (uint)RuntimeDataType.DATATYPE_OBJECT; if(val != null) { dt = val.m_handle.m_dt; Array.Copy( val.m_handle.m_builtinValue, data, data.Length ); } if(SetBlock( dt, data )) { retval = this; } } else if(this.IsPrimitive) { if(val == null || val.IsPrimitive == false) { throw new InvalidCastException( "The two runtime values are incompatible" ); } this.Value = val.Value; retval = this; } else { if(val != null && val.IsPrimitive == true) { throw new InvalidCastException( "The two runtime values are incompatible" ); } retval = Assign( val != null ? val .ReferenceIdDirect : 0 ); } return retval; }
public RuntimeValue[] GetStackFrameValueAll(uint pid, uint depth, uint cValues, StackValueKind kind) { WireProtocol.OutgoingMessage[] cmds = new WireProtocol.OutgoingMessage[cValues]; RuntimeValue[] vals = null; uint i; for (i = 0; i < cValues; i++) { cmds[i] = CreateMessage_GetValue_Stack(pid, depth, kind, i); } WireProtocol.IncomingMessage[] replies = SyncMessages(cmds); if (replies != null) { vals = new RuntimeValue[cValues]; for (i = 0; i < cValues; i++) { WireProtocol.Commands.Debugging_Value_Reply reply = replies[i].Payload as WireProtocol.Commands.Debugging_Value_Reply; if (reply != null) { vals[i] = RuntimeValue.Convert(this, reply.m_values); } } } return vals; }
public CorDebugValueBoxedObject (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { m_value = new CorDebugValueObject (rtv, appDomain); }
protected CorDebugValue CreateValue(RuntimeValue rtv) { return(CorDebugValue.CreateValue(rtv, m_appDomain)); }
protected CorDebugValue CreateValue (RuntimeValue rtv) { return CorDebugValue.CreateValue (rtv, m_appDomain); }
public CorDebugValuePrimitive (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
public CorDebugGenericType(CorElementType elemType, RuntimeValue rtv, CorDebugAppDomain appDomain) { m_elemType = elemType; m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugValueReferenceByRef(CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base(val, rtv, appDomain) { }
public CorDebugValue (RuntimeValue rtv, CorDebugAppDomain appDomain) { m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugValueReference (CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { m_value = val; }
public CorDebugValuePrimitive(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }
public CorDebugValueReferenceByRef (CorDebugValue val, RuntimeValue rtv, CorDebugAppDomain appDomain) : base (val, rtv, appDomain) { }
public CorDebugValue(RuntimeValue rtv, CorDebugAppDomain appDomain) { m_rtv = rtv; m_appDomain = appDomain; }
public CorDebugValueArray (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { }
internal RuntimeValue GetFieldValue(RuntimeValue val, uint offset, uint fd) { WireProtocol.Commands.Debugging_Value_GetField cmd = new WireProtocol.Commands.Debugging_Value_GetField(); cmd.m_heapblock = (val == null ? 0 : val.m_handle.m_referenceID); cmd.m_offset = offset; cmd.m_fd = fd; return GetRuntimeValue(WireProtocol.Commands.c_Debugging_Value_GetField, cmd); }
//Object or CLASS, or VALUETYPE public CorDebugValueObject (RuntimeValue rtv, CorDebugAppDomain appDomain) : base (rtv, appDomain) { if (!rtv.IsNull) { m_class = CorDebugValue.ClassFromRuntimeValue (rtv, appDomain); m_fIsEnum = m_class.IsEnum; m_fIsBoxed = rtv.IsBoxed; } }
public uint GetVirtualMethod(uint md, RuntimeValue obj) { WireProtocol.Commands.Debugging_Resolve_VirtualMethod cmd = new WireProtocol.Commands.Debugging_Resolve_VirtualMethod(); cmd.m_md = md; cmd.m_obj = obj.ReferenceId; WireProtocol.IncomingMessage reply = SyncMessage(WireProtocol.Commands.c_Debugging_Resolve_VirtualMethod, 0, cmd); if (reply != null) { WireProtocol.Commands.Debugging_Resolve_VirtualMethod.Reply cmdReply = reply.Payload as WireProtocol.Commands.Debugging_Resolve_VirtualMethod.Reply; if (cmdReply != null) { return cmdReply.m_md; } } return 0; }
public CorDebugValueString(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain) { }