diff options
author | Artem Bukhonov <artem.bukhonov@jetbrains.com> | 2017-02-15 19:24:18 +0300 |
---|---|---|
committer | Artem Bukhonov <Artem.Bukhonov@jetbrains.com> | 2017-03-11 21:30:27 +0300 |
commit | f0d9d3dad27406bbec1776a925ef37e206a51787 (patch) | |
tree | bf5ecfa9ecb7aec65299e2762ee692632c31d58f /main/src/addins/MonoDevelop.Debugger.Win32 | |
parent | b29e9453337a600fce8fb59ea6ce19fe6d739376 (diff) |
CorDebug: reading of string, float, double and bool constants from metadata.
(cherry picked from commit 97c1a6a)
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.Win32')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataFieldInfo.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataFieldInfo.cs b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataFieldInfo.cs index 64c7f01b0b..84bf5db789 100644 --- a/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataFieldInfo.cs +++ b/main/src/addins/MonoDevelop.Debugger.Win32/CorApi2/Metadata/MetadataFieldInfo.cs @@ -64,13 +64,13 @@ namespace Microsoft.Samples.Debugging.CorMetadata FieldAttributes staticLiteralField = FieldAttributes.Static | FieldAttributes.HasDefault | FieldAttributes.Literal;
if ((m_fieldAttributes & staticLiteralField) == staticLiteralField)
{
- m_value = ParseDefaultValue(declaringType,ppvSigBlob,ppvRawValue);
+ m_value = ParseDefaultValue(declaringType,ppvSigBlob,ppvRawValue, pcchValue);
}
// [Xamarin] Expression evaluator.
MetadataHelperFunctionsExtensions.GetCustomAttribute (m_importer, m_fieldToken, typeof (DebuggerBrowsableAttribute));
}
- private static object ParseDefaultValue(MetadataType declaringType, IntPtr ppvSigBlob, IntPtr ppvRawValue)
+ private static object ParseDefaultValue(MetadataType declaringType, IntPtr ppvSigBlob, IntPtr ppvRawValue, int rawValueSize)
{
IntPtr ppvSigTemp = ppvSigBlob;
CorCallingConvention callingConv = MetadataHelperFunctions.CorSigUncompressCallingConv(ref ppvSigTemp);
@@ -94,7 +94,7 @@ namespace Microsoft.Samples.Debugging.CorMetadata }
}
}
-
+
switch (elementType)
{
case CorElementType.ELEMENT_TYPE_CHAR:
@@ -117,10 +117,21 @@ namespace Microsoft.Samples.Debugging.CorMetadata return (ulong)Marshal.ReadInt64(ppvRawValue);
case CorElementType.ELEMENT_TYPE_I:
return Marshal.ReadIntPtr(ppvRawValue);
- case CorElementType.ELEMENT_TYPE_U:
+ case CorElementType.ELEMENT_TYPE_STRING:
+ return Marshal.PtrToStringAuto (ppvRawValue, rawValueSize);
case CorElementType.ELEMENT_TYPE_R4:
+ unsafe {
+ return *(float*) ppvRawValue.ToPointer ();
+ }
case CorElementType.ELEMENT_TYPE_R8:
- // Technically U and the floating-point ones are options in the CLI, but not in the CLS or C#, so these are NYI
+ unsafe {
+ return *(double*) ppvRawValue.ToPointer ();
+ }
+ case CorElementType.ELEMENT_TYPE_BOOLEAN:
+ unsafe {
+ return *(bool*) ppvRawValue.ToPointer ();
+ }
+
default:
return null;
}
|