本文整理汇总了C#中Mono.Debugger.Soft.ValueImpl类的典型用法代码示例。如果您正苦于以下问题:C# ValueImpl类的具体用法?C# ValueImpl怎么用?C# ValueImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueImpl类属于Mono.Debugger.Soft命名空间,在下文中一共展示了ValueImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Array_GetValues
internal ValueImpl[] Array_GetValues(long id, int index, int len)
{
var r = SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (len));
ValueImpl[] res = new ValueImpl [len];
for (int i = 0; i < len; ++i)
res [i] = r.ReadValue ();
return res;
}
示例2: WriteValue
public PacketWriter WriteValue(ValueImpl v)
{
ElementType t;
if (v.Value != null)
t = TypeCodeToElementType (Type.GetTypeCode (v.Value.GetType ()));
else
t = v.Type;
WriteByte ((byte)t);
switch (t) {
case ElementType.Boolean:
WriteInt ((bool)v.Value ? 1 : 0);
break;
case ElementType.Char:
WriteInt ((int)(char)v.Value);
break;
case ElementType.I1:
WriteInt ((int)(sbyte)v.Value);
break;
case ElementType.U1:
WriteInt ((int)(byte)v.Value);
break;
case ElementType.I2:
WriteInt ((int)(short)v.Value);
break;
case ElementType.U2:
WriteInt ((int)(ushort)v.Value);
break;
case ElementType.I4:
WriteInt ((int)(int)v.Value);
break;
case ElementType.U4:
WriteInt ((int)(uint)v.Value);
break;
case ElementType.I8:
WriteLong ((long)(long)v.Value);
break;
case ElementType.U8:
WriteLong ((long)(ulong)v.Value);
break;
case ElementType.R4:
WriteFloat ((float)v.Value);
break;
case ElementType.R8:
WriteDouble ((double)v.Value);
break;
case ElementType.String:
case ElementType.SzArray:
case ElementType.Class:
case ElementType.Array:
case ElementType.Object:
WriteId (v.Objid);
break;
case ElementType.ValueType:
// FIXME:
if (v.IsEnum)
throw new NotImplementedException ();
WriteByte (0);
WriteId (v.Klass);
WriteInt (v.Fields.Length);
for (int i = 0; i < v.Fields.Length; ++i)
WriteValue (v.Fields [i]);
break;
case (ElementType)ValueTypeId.VALUE_TYPE_ID_NULL:
break;
default:
throw new NotImplementedException ();
}
return this;
}
示例3: WriteValues
public PacketWriter WriteValues(ValueImpl[] values)
{
for (int i = 0; i < values.Length; ++i)
WriteValue (values [i]);
return this;
}
示例4: read_invoke_res
void read_invoke_res(PacketReader r, out ValueImpl v, out ValueImpl exc, out ValueImpl out_this, out ValueImpl[] out_args)
{
int resflags = r.ReadByte ();
v = null;
exc = null;
out_this = null;
out_args = null;
if (resflags == 0) {
exc = r.ReadValue ();
} else {
v = r.ReadValue ();
if ((resflags & 2) != 0)
out_this = r.ReadValue ();
if ((resflags & 4) != 0) {
int nargs = r.ReadInt ();
out_args = new ValueImpl [nargs];
for (int i = 0; i < nargs; ++i)
out_args [i] = r.ReadValue ();
}
}
}
示例5: ReadValue
public ValueImpl ReadValue()
{
ElementType etype = (ElementType)ReadByte ();
switch (etype) {
case ElementType.Void:
return new ValueImpl { Type = etype };
case ElementType.I1:
return new ValueImpl { Type = etype, Value = (sbyte)ReadInt () };
case ElementType.U1:
return new ValueImpl { Type = etype, Value = (byte)ReadInt () };
case ElementType.Boolean:
return new ValueImpl { Type = etype, Value = ReadInt () != 0 };
case ElementType.I2:
return new ValueImpl { Type = etype, Value = (short)ReadInt () };
case ElementType.U2:
return new ValueImpl { Type = etype, Value = (ushort)ReadInt () };
case ElementType.Char:
return new ValueImpl { Type = etype, Value = (char)ReadInt () };
case ElementType.I4:
return new ValueImpl { Type = etype, Value = ReadInt () };
case ElementType.U4:
return new ValueImpl { Type = etype, Value = (uint)ReadInt () };
case ElementType.I8:
return new ValueImpl { Type = etype, Value = ReadLong () };
case ElementType.U8:
return new ValueImpl { Type = etype, Value = (ulong)ReadLong () };
case ElementType.R4:
return new ValueImpl { Type = etype, Value = ReadFloat () };
case ElementType.R8:
return new ValueImpl { Type = etype, Value = ReadDouble () };
case ElementType.I:
case ElementType.U:
case ElementType.Ptr:
// FIXME: The client and the debuggee might have different word sizes
return new ValueImpl { Type = etype, Value = ReadLong () };
case ElementType.String:
case ElementType.SzArray:
case ElementType.Class:
case ElementType.Array:
case ElementType.Object:
long objid = ReadId ();
return new ValueImpl () { Type = etype, Objid = objid };
case ElementType.ValueType:
bool is_enum = ReadByte () == 1;
long klass = ReadId ();
long nfields = ReadInt ();
ValueImpl[] fields = new ValueImpl [nfields];
for (int i = 0; i < nfields; ++i)
fields [i] = ReadValue ();
return new ValueImpl () { Type = etype, Klass = klass, Fields = fields, IsEnum = is_enum };
case (ElementType)ValueTypeId.VALUE_TYPE_ID_NULL:
return new ValueImpl { Type = etype };
case (ElementType)ValueTypeId.VALUE_TYPE_ID_TYPE:
return new ValueImpl () { Type = etype, Id = ReadId () };
case (ElementType)ValueTypeId.VALUE_TYPE_ID_PARENT_VTYPE:
return new ValueImpl () { Type = etype, Index = ReadInt () };
default:
throw new NotImplementedException ("Unable to handle type " + etype);
}
}
示例6: InvokeCB
// This is called when the result of an invoke is received
static void InvokeCB (ValueImpl v, ValueImpl exc, ValueImpl out_this, ValueImpl[] out_args, ErrorCode error, object state) {
InvokeAsyncResult r = (InvokeAsyncResult)state;
if (error != 0) {
r.ErrorCode = error;
} else {
r.Value = v;
r.Exception = exc;
}
r.OutThis = out_this;
r.OutArgs = out_args;
r.IsCompleted = true;
((ManualResetEvent)r.AsyncWaitHandle).Set ();
if (r.Callback != null)
r.Callback.BeginInvoke (r, null, null);
}
示例7: VM_BeginInvokeMethod
internal int VM_BeginInvokeMethod (long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, InvokeMethodCallback callback, object state) {
return Send (CommandSet.VM, (int)CmdVM.INVOKE_METHOD, new PacketWriter ().WriteId (thread).WriteInt ((int)flags).WriteId (method).WriteValue (this_arg).WriteInt (arguments.Length).WriteValues (arguments), delegate (PacketReader r) {
ValueImpl v, exc;
if (r.ErrorCode != 0) {
callback (null, null, (ErrorCode)r.ErrorCode, state);
} else {
if (r.ReadByte () == 0) {
exc = r.ReadValue ();
v = null;
} else {
v = r.ReadValue ();
exc = null;
}
callback (v, exc, 0, state);
}
}, 1);
}
示例8: Type_SetValues
internal void Type_SetValues(long id, long[] fields, ValueImpl[] values)
{
SendReceive (CommandSet.TYPE, (int)CmdType.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (fields.Length).WriteIds (fields).WriteValues (values));
}
示例9: VM_BeginInvokeMethod
internal int VM_BeginInvokeMethod(long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, InvokeMethodCallback callback, object state)
{
return Send (CommandSet.VM, (int)CmdVM.INVOKE_METHOD, new PacketWriter ().WriteId (thread).WriteInt ((int)flags).WriteId (method).WriteValue (this_arg).WriteInt (arguments.Length).WriteValues (arguments), delegate (PacketReader r) {
ValueImpl v, exc, out_this = null;
ValueImpl[] out_args = null;
if (r.ErrorCode != 0) {
callback (null, null, null, null, (ErrorCode)r.ErrorCode, state);
} else {
read_invoke_res (r, out v, out exc, out out_this, out out_args);
callback (v, exc, out_this, out_args, 0, state);
}
}, 1);
}
示例10: StackFrame_SetValues
internal void StackFrame_SetValues(long thread_id, long id, int[] pos, ValueImpl[] values)
{
/* pos < 0 -> argument at pos (-pos) - 1 */
/* pos >= 0 -> local at pos */
int len = pos.Length;
SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos).WriteValues (values));
}
示例11: Type_GetValues
internal ValueImpl[] Type_GetValues(long id, long[] fields, long thread_id)
{
int len = fields.Length;
PacketReader r;
if (thread_id != 0)
r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_VALUES_2, new PacketWriter ().WriteId (id).WriteId (thread_id).WriteInt (len).WriteIds (fields));
else
r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (len).WriteIds (fields));
ValueImpl[] res = new ValueImpl [len];
for (int i = 0; i < len; ++i)
res [i] = r.ReadValue ();
return res;
}
示例12: StackFrame_GetValues
internal ValueImpl[] StackFrame_GetValues(long thread_id, long id, int[] pos)
{
/* pos < 0 -> argument at pos (-pos) - 1 */
/* pos >= 0 -> local at pos */
int len = pos.Length;
PacketReader r = SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos));
ValueImpl[] res = new ValueImpl [len];
for (int i = 0; i < len; ++i)
res [i] = r.ReadValue ();
return res;
}
示例13: Object_SetValues
internal void Object_SetValues(long id, long[] fields, ValueImpl[] values)
{
SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (fields.Length).WriteIds (fields).WriteValues (values));
}
示例14: Object_GetValues
internal ValueImpl[] Object_GetValues(long id, long[] fields)
{
int len = fields.Length;
PacketReader r = SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (len).WriteIds (fields));
ValueImpl[] res = new ValueImpl [len];
for (int i = 0; i < len; ++i)
res [i] = r.ReadValue ();
return res;
}
示例15: Array_SetValues
internal void Array_SetValues(long id, int index, ValueImpl[] values)
{
SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (values.Length).WriteValues (values));
}