Browse Source

Support creating type from signature for arrays and pointers

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4529 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 17 years ago
parent
commit
ea1cb8a263
  1. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/AppDomain.cs
  2. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/AppDomainCollection.cs
  3. 30
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
  4. 26
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebugTypes.cs

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/AppDomain.cs

@ -40,7 +40,7 @@ namespace Debugger @@ -40,7 +40,7 @@ namespace Debugger
}
}
internal ICorDebugAppDomain CorDebugAppDomain {
internal ICorDebugAppDomain CorAppDomain {
get {
return corAppDomain;
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/AppDomainCollection.cs

@ -19,7 +19,7 @@ namespace Debugger @@ -19,7 +19,7 @@ namespace Debugger
public AppDomain this[ICorDebugAppDomain corAppDomain] {
get {
foreach(AppDomain a in this) {
if (a.CorDebugAppDomain.Equals(corAppDomain)) {
if (a.CorAppDomain.Equals(corAppDomain)) {
return a;
}
}

30
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs

@ -401,6 +401,36 @@ namespace Debugger.MetaData @@ -401,6 +401,36 @@ namespace Debugger.MetaData
return Create(module.AppDomain, genInstance);
}
if (sigType is ARRAY) {
ARRAY arraySig = (ARRAY)sigType;
DebugType elementType = Create(module, arraySig.Type, declaringType);
ICorDebugType res = module.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)sigType.ElementType, (uint)arraySig.Shape.Rank, elementType.CorType);
return Create(module.AppDomain, res);
}
if (sigType is SZARRAY) {
SZARRAY arraySig = (SZARRAY)sigType;
DebugType elementType = Create(module, arraySig.Type, declaringType);
ICorDebugType res = module.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)sigType.ElementType, 1, elementType.CorType);
return Create(module.AppDomain, res);
}
if (sigType is PTR) {
PTR ptrSig = (PTR)sigType;
DebugType elementType;
if (ptrSig.Void) {
elementType = Create(module.AppDomain, typeof(void).FullName);
} else {
elementType = Create(module, ptrSig.PtrType, declaringType);
}
ICorDebugType res = module.AppDomain.CorAppDomain.CastTo<ICorDebugAppDomain2>().GetArrayOrPointerType((uint)sigType.ElementType, 0, elementType.CorType);
return Create(module.AppDomain, res);
}
if (sigType is FNPTR) {
// TODO: FNPTR
}
throw new NotImplementedException(sigType.ElementType.ToString());
}

26
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebugTypes.cs

@ -21,6 +21,7 @@ namespace Debugger.Tests.TestPrograms @@ -21,6 +21,7 @@ namespace Debugger.Tests.TestPrograms
public char c;
public IntPtr intPtr;
public int* pInt;
public void* pVoid;
public int[] intArray;
public int[,] intMultiArray;
public List<int> intList;
@ -124,10 +125,10 @@ namespace Debugger.Tests { @@ -124,10 +125,10 @@ namespace Debugger.Tests {
<ProcessStarted />
<ModuleLoaded>mscorlib.dll (No symbols)</ModuleLoaded>
<ModuleLoaded>DebugTypes.exe (Has symbols)</ModuleLoaded>
<DebuggingPaused>Break DebugTypes.cs:75,4-75,40</DebuggingPaused>
<DebuggingPaused>Break DebugTypes.cs:76,4-76,40</DebuggingPaused>
<MyClassMemberts
Capacity="16"
Count="14">
Count="15">
<Item>
<FieldInfo
DeclaringType="MyClass"
@ -171,7 +172,16 @@ namespace Debugger.Tests { @@ -171,7 +172,16 @@ namespace Debugger.Tests {
IsPublic="True"
Module="DebugTypes.exe"
Name="pInt"
Type="{Exception: Ptr}" />
Type="System.Int32*" />
</Item>
<Item>
<FieldInfo
DeclaringType="MyClass"
FullName="MyClass.pVoid"
IsPublic="True"
Module="DebugTypes.exe"
Name="pVoid"
Type="System.Void*" />
</Item>
<Item>
<FieldInfo
@ -180,7 +190,7 @@ namespace Debugger.Tests { @@ -180,7 +190,7 @@ namespace Debugger.Tests {
IsPublic="True"
Module="DebugTypes.exe"
Name="intArray"
Type="{Exception: SzArray}" />
Type="System.Int32[]" />
</Item>
<Item>
<FieldInfo
@ -189,7 +199,7 @@ namespace Debugger.Tests { @@ -189,7 +199,7 @@ namespace Debugger.Tests {
IsPublic="True"
Module="DebugTypes.exe"
Name="intMultiArray"
Type="{Exception: Array}" />
Type="System.Int32[,]" />
</Item>
<Item>
<FieldInfo
@ -207,7 +217,7 @@ namespace Debugger.Tests { @@ -207,7 +217,7 @@ namespace Debugger.Tests {
IsPublic="True"
Module="DebugTypes.exe"
Name="intListArray"
Type="{Exception: SzArray}" />
Type="System.Collections.Generic.List&lt;System.Int32&gt;[]" />
</Item>
<Item>
<FieldInfo
@ -244,7 +254,7 @@ namespace Debugger.Tests { @@ -244,7 +254,7 @@ namespace Debugger.Tests {
Module="DebugTypes.exe"
Name="Foo"
ParameterCount="2"
ParameterTypes="{Exception: SzArray}"
ParameterTypes="{System.Object, System.Object[]}"
ReturnType="System.Object" />
</Item>
<Item>
@ -775,7 +785,7 @@ namespace Debugger.Tests { @@ -775,7 +785,7 @@ namespace Debugger.Tests {
</Value>
</Item>
</LocalVariables>
<DebuggingPaused>Break DebugTypes.cs:92,4-92,40</DebuggingPaused>
<DebuggingPaused>Break DebugTypes.cs:93,4-93,40</DebuggingPaused>
<Arguments
Capacity="16"
Count="15">

Loading…
Cancel
Save