|
|
|
@ -18,10 +18,11 @@ namespace DebuggerLibrary |
|
|
|
ICorDebugClass corClass; |
|
|
|
ICorDebugClass corClass; |
|
|
|
ICorDebugModule corModule; |
|
|
|
ICorDebugModule corModule; |
|
|
|
IMetaDataImport metaData; |
|
|
|
IMetaDataImport metaData; |
|
|
|
uint classToken; |
|
|
|
|
|
|
|
uint superCallsToken; |
|
|
|
|
|
|
|
ICorDebugModule corModuleSuperclass; |
|
|
|
ICorDebugModule corModuleSuperclass; |
|
|
|
ObjectVariable baseClass; |
|
|
|
ObjectVariable baseClass; |
|
|
|
|
|
|
|
uint classToken; |
|
|
|
|
|
|
|
uint superCallsToken; |
|
|
|
|
|
|
|
uint typeDefFlags; |
|
|
|
string type; |
|
|
|
string type; |
|
|
|
|
|
|
|
|
|
|
|
public override object Value { |
|
|
|
public override object Value { |
|
|
|
@ -55,13 +56,27 @@ namespace DebuggerLibrary |
|
|
|
corClass.GetModule(out corModule); |
|
|
|
corClass.GetModule(out corModule); |
|
|
|
metaData = new Module(corModule).MetaDataInterface; //TODO
|
|
|
|
metaData = new Module(corModule).MetaDataInterface; //TODO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint pStringLenght = 0; // Terminating character included in pStringLenght
|
|
|
|
|
|
|
|
IntPtr pString = IntPtr.Zero; |
|
|
|
|
|
|
|
// Get length of string 'type'
|
|
|
|
metaData.GetTypeDefProps(classToken, |
|
|
|
metaData.GetTypeDefProps(classToken, |
|
|
|
NDebugger.pString, |
|
|
|
pString, |
|
|
|
NDebugger.pStringLen, |
|
|
|
pStringLenght, |
|
|
|
out NDebugger.unused, // real string lenght
|
|
|
|
out pStringLenght, |
|
|
|
out NDebugger.unused, |
|
|
|
out typeDefFlags, |
|
|
|
out superCallsToken); |
|
|
|
out superCallsToken); |
|
|
|
type = NDebugger.pStringAsUnicode; |
|
|
|
// Allocate string buffer
|
|
|
|
|
|
|
|
pString = Marshal.AllocHGlobal((int)pStringLenght * 2); |
|
|
|
|
|
|
|
// Get properties
|
|
|
|
|
|
|
|
metaData.GetTypeDefProps(classToken, |
|
|
|
|
|
|
|
pString, |
|
|
|
|
|
|
|
pStringLenght, |
|
|
|
|
|
|
|
out pStringLenght, |
|
|
|
|
|
|
|
out typeDefFlags, |
|
|
|
|
|
|
|
out superCallsToken); |
|
|
|
|
|
|
|
type = Marshal.PtrToStringUni(pString); |
|
|
|
|
|
|
|
Marshal.FreeHGlobal(pString); |
|
|
|
|
|
|
|
|
|
|
|
corModuleSuperclass = corModule; |
|
|
|
corModuleSuperclass = corModule; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -82,19 +97,39 @@ namespace DebuggerLibrary |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint unused; |
|
|
|
|
|
|
|
IntPtr unusedPtr = IntPtr.Zero; |
|
|
|
|
|
|
|
uint pStringLenght = 0; // Terminating character included in pStringLenght
|
|
|
|
|
|
|
|
IntPtr pString = IntPtr.Zero; |
|
|
|
uint attrib; |
|
|
|
uint attrib; |
|
|
|
metaData.GetFieldProps(fieldToken, |
|
|
|
metaData.GetFieldProps(fieldToken, |
|
|
|
out NDebugger.unused, |
|
|
|
out unused, |
|
|
|
NDebugger.pString, |
|
|
|
pString, |
|
|
|
NDebugger.pStringLen, |
|
|
|
pStringLenght, |
|
|
|
out NDebugger.unused, // real string lenght
|
|
|
|
out pStringLenght, // real string lenght
|
|
|
|
out attrib, |
|
|
|
out attrib, |
|
|
|
IntPtr.Zero, |
|
|
|
IntPtr.Zero, |
|
|
|
out NDebugger.unused, |
|
|
|
out unused, |
|
|
|
out NDebugger.unused, |
|
|
|
out unused, |
|
|
|
out NDebugger.unusedPtr, |
|
|
|
out unusedPtr, |
|
|
|
out NDebugger.unused); |
|
|
|
out unused); |
|
|
|
string name = NDebugger.pStringAsUnicode; |
|
|
|
// Allocate string buffer
|
|
|
|
|
|
|
|
pString = Marshal.AllocHGlobal((int)pStringLenght * 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
metaData.GetFieldProps(fieldToken, |
|
|
|
|
|
|
|
out unused, |
|
|
|
|
|
|
|
pString, |
|
|
|
|
|
|
|
pStringLenght, |
|
|
|
|
|
|
|
out pStringLenght, // real string lenght
|
|
|
|
|
|
|
|
out attrib, |
|
|
|
|
|
|
|
IntPtr.Zero, |
|
|
|
|
|
|
|
out unused, |
|
|
|
|
|
|
|
out unused, |
|
|
|
|
|
|
|
out unusedPtr, |
|
|
|
|
|
|
|
out unused); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string name = Marshal.PtrToStringUni(pString); |
|
|
|
|
|
|
|
Marshal.FreeHGlobal(pString); |
|
|
|
|
|
|
|
|
|
|
|
ICorDebugValue innerValue; |
|
|
|
ICorDebugValue innerValue; |
|
|
|
if ((attrib & (uint)ClassFieldAttribute.fdStatic)!=0) |
|
|
|
if ((attrib & (uint)ClassFieldAttribute.fdStatic)!=0) |
|
|
|
@ -137,12 +172,25 @@ namespace DebuggerLibrary |
|
|
|
// If referencing to external assembly
|
|
|
|
// If referencing to external assembly
|
|
|
|
if ((superCallsToken & 0x01000000) != 0) |
|
|
|
if ((superCallsToken & 0x01000000) != 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
uint unused; |
|
|
|
|
|
|
|
uint pStringLenght = 0; // Terminating character included in pStringLenght
|
|
|
|
|
|
|
|
IntPtr pString = IntPtr.Zero; |
|
|
|
metaData.GetTypeRefProps(superCallsToken, |
|
|
|
metaData.GetTypeRefProps(superCallsToken, |
|
|
|
out NDebugger.unused, |
|
|
|
out unused, |
|
|
|
NDebugger.pString, |
|
|
|
pString, |
|
|
|
NDebugger.pStringLen, |
|
|
|
pStringLenght, |
|
|
|
out NDebugger.unused); // real string lenght
|
|
|
|
out pStringLenght); // real string lenght
|
|
|
|
fullTypeName = NDebugger.pStringAsUnicode; |
|
|
|
// Allocate string buffer
|
|
|
|
|
|
|
|
pString = Marshal.AllocHGlobal((int)pStringLenght * 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
metaData.GetTypeRefProps(superCallsToken, |
|
|
|
|
|
|
|
out unused, |
|
|
|
|
|
|
|
pString, |
|
|
|
|
|
|
|
pStringLenght, |
|
|
|
|
|
|
|
out pStringLenght); // real string lenght
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fullTypeName = Marshal.PtrToStringUni(pString); |
|
|
|
|
|
|
|
Marshal.FreeHGlobal(pString); |
|
|
|
|
|
|
|
|
|
|
|
superCallsToken = 0; |
|
|
|
superCallsToken = 0; |
|
|
|
foreach (Module m in NDebugger.Instance.Modules) |
|
|
|
foreach (Module m in NDebugger.Instance.Modules) |
|
|
|
|