Browse Source

Significantly beefing up the MetaData wrapper

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3154 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 17 years ago
parent
commit
3c97029fc0
  1. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs
  3. 40
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaData/IMetaDataImport.cs
  4. 16
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
  5. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs
  6. 41
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/FieldProps.cs
  7. 25
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/InterfaceImplProps.cs
  8. 1098
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaDataImport.cs
  9. 43
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MethodProps.cs
  10. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/ParamProps.cs
  11. 29
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/TypeDefProps.cs
  12. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/TypeRefProps.cs
  13. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  14. 77
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebuggerAttributes.cs
  15. 4
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/_Template.cs

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -361,13 +361,7 @@ @@ -361,13 +361,7 @@
<Compile Include="Src\Wrappers\CorSym\ISymUnmanagedVariable.cs" />
<Compile Include="Src\Wrappers\CorSym\SequencePoint.cs" />
<Compile Include="Src\Wrappers\ICorDebugManagedCallbacks.cs" />
<Compile Include="Src\Wrappers\MetaData\FieldProps.cs" />
<Compile Include="Src\Wrappers\MetaData\InterfaceImplProps.cs" />
<Compile Include="Src\Wrappers\MetaData\MetaDataImport.cs" />
<Compile Include="Src\Wrappers\MetaData\MethodProps.cs" />
<Compile Include="Src\Wrappers\MetaData\ParamProps.cs" />
<Compile Include="Src\Wrappers\MetaData\TypeDefProps.cs" />
<Compile Include="Src\Wrappers\MetaData\TypeRefProps.cs" />
<Compile Include="Src\Wrappers\NativeMethods.cs" />
<Compile Include="Src\Wrappers\ResourceManager.cs" />
<Compile Include="Src\Wrappers\Util.cs" />

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs

@ -34,7 +34,7 @@ namespace Debugger @@ -34,7 +34,7 @@ namespace Debugger
}
}
internal MetaDataImport MetaData {
public MetaDataImport MetaData {
get {
return metaData;
}
@ -153,7 +153,7 @@ namespace Debugger @@ -153,7 +153,7 @@ namespace Debugger
public List<string> GetNamesOfDefinedTypes()
{
List<string> names = new List<string>();
foreach(TypeDefProps typeProps in this.MetaData.EnumTypeDefs()) {
foreach(TypeDefProps typeProps in this.MetaData.EnumTypeDefProps()) {
names.Add(typeProps.Name);
}
return names;

40
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Interop/MetaData/IMetaDataImport.cs

@ -27,11 +27,11 @@ namespace Debugger.Interop.MetaData @@ -27,11 +27,11 @@ namespace Debugger.Interop.MetaData
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumInterfaceImpls([In, Out] ref IntPtr phEnum, uint td, out uint rImpls, uint cMax, out uint pcImpls);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumTypeRefs([In, Out] ref IntPtr phEnum, ref uint rTypeRefs, uint cMax, ref uint pcTypeRefs);
void EnumTypeRefs([In, Out] ref IntPtr phEnum, out uint rTypeRefs, uint cMax, out uint pcTypeRefs);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindTypeDefByName([In, MarshalAs(UnmanagedType.LPWStr)] string szTypeDef, [In] uint tkEnclosingClass, out uint ptd);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetScopeProps([Out, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] uint cchName, out uint pchName, out Guid pmvid);
void GetScopeProps([Out] IntPtr szName, [In] uint cchName, out uint pchName, out Guid pmvid);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetModuleFromScope(out uint pmd);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
@ -63,51 +63,51 @@ namespace Debugger.Interop.MetaData @@ -63,51 +63,51 @@ namespace Debugger.Interop.MetaData
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumPermissionSets([In, Out] ref IntPtr phEnum, [In] uint tk, [In] uint dwActions, out uint rPermission, [In] uint cMax, out uint pcTokens);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindMember([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] ref byte pvSigBlob, [In] uint cbSigBlob, out uint pmb);
void FindMember([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] IntPtr pvSigBlob, [In] uint cbSigBlob, out uint pmb);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindMethod([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] ref byte pvSigBlob, [In] uint cbSigBlob, out uint pmb);
void FindMethod([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] IntPtr pvSigBlob, [In] uint cbSigBlob, out uint pmb);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindField([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] ref byte pvSigBlob, [In] uint cbSigBlob, out uint pmb);
void FindField([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] IntPtr pvSigBlob, [In] uint cbSigBlob, out uint pmb);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindMemberRef([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] ref byte pvSigBlob, [In] uint cbSigBlob, out uint pmr);
void FindMemberRef([In] uint td, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] IntPtr pvSigBlob, [In] uint cbSigBlob, out uint pmr);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetMethodProps([In] uint mb, out uint pClass, [Out] IntPtr szMethod, [In] uint cchMethod, out uint pchMethod, out uint pdwAttr, [Out] IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags);
void GetMethodProps([In] uint mb, out uint pClass, [Out] IntPtr szMethod, [In] uint cchMethod, out uint pchMethod, out uint pdwAttr, out IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetMemberRefProps([In] uint mr, out uint ptk, [Out, MarshalAs(UnmanagedType.LPWStr)] string szMember, [In] uint cchMember, out uint pchMember, [Out] IntPtr ppvSigBlob, out uint pbSig);
void GetMemberRefProps([In] uint mr, out uint ptk, [Out] IntPtr szMember, [In] uint cchMember, out uint pchMember, out IntPtr ppvSigBlob, out uint pbSig);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumProperties([In, Out] ref IntPtr phEnum, [In] uint td, out uint rProperties, [In] uint cMax, out uint pcProperties);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumEvents([In, Out] ref IntPtr phEnum, [In] uint td, out uint rEvents, [In] uint cMax, out uint pcEvents);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetEventProps([In] uint ev, out uint pClass, [Out, MarshalAs(UnmanagedType.LPWStr)] string szEvent, [In] uint cchEvent, out uint pchEvent, out uint pdwEventFlags, out uint ptkEventType, out uint pmdAddOn, out uint pmdRemoveOn, out uint pmdFire, out uint rmdOtherMethod, [In] uint cMax, out uint pcOtherMethod);
void GetEventProps([In] uint ev, out uint pClass, [Out] IntPtr szEvent, [In] uint cchEvent, out uint pchEvent, out uint pdwEventFlags, out uint ptkEventType, out uint pmdAddOn, out uint pmdRemoveOn, out uint pmdFire, uint[] rmdOtherMethod, [In] uint cMax, out uint pcOtherMethod);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumMethodSemantics([In, Out] ref IntPtr phEnum, [In] uint mb, out uint rEventProp, [In] uint cMax, out uint pcEventProp);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetMethodSemantics([In] uint mb, [In] uint tkEventProp, out uint pdwSemanticsFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetClassLayout([In] uint td, out uint pdwPackSize, out COR_FIELD_OFFSET rFieldOffset, [In] uint cMax, out uint pcFieldOffset, out uint pulClassSize);
void GetClassLayout([In] uint td, out uint pdwPackSize, COR_FIELD_OFFSET[] rFieldOffset, [In] uint cMax, out uint pcFieldOffset, out uint pulClassSize);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetFieldMarshal([In] uint tk, [Out] IntPtr ppvNativeType, out uint pcbNativeType);
void GetFieldMarshal([In] uint tk, out IntPtr ppvNativeType, out uint pcbNativeType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetRVA([In] uint tk, out uint pulCodeRVA, out uint pdwImplFlags);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetPermissionSetProps([In] uint pm, out uint pdwAction, out IntPtr ppvPermission, out uint pcbPermission);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetSigFromToken([In] uint mdSig, [Out] IntPtr ppvSig, out uint pcbSig);
void GetSigFromToken([In] uint mdSig, out IntPtr ppvSig, out uint pcbSig);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetModuleRefProps([In] uint mur, [Out, MarshalAs(UnmanagedType.LPWStr)] string szName, [In] uint cchName, out uint pchName);
void GetModuleRefProps([In] uint mur, [Out] IntPtr szName, [In] uint cchName, out uint pchName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumModuleRefs([In, Out] ref IntPtr phEnum, out uint rModuleRefs, [In] uint cMax, out uint pcModuleRefs);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetTypeSpecFromToken([In] uint typespec, [Out] IntPtr ppvSig, out uint pcbSig);
void GetTypeSpecFromToken([In] uint typespec, out IntPtr ppvSig, out uint pcbSig);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetNameFromToken([In] uint tk, [Out] IntPtr pszUtf8NamePtr);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumUnresolvedMethods([In, Out] ref IntPtr phEnum, out uint rMethods, [In] uint cMax, out uint pcTokens);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetUserString([In] uint stk, [Out, MarshalAs(UnmanagedType.LPWStr)] string szString, [In] uint cchString, out uint pchString);
void GetUserString([In] uint stk, [Out] IntPtr szString, [In] uint cchString, out uint pchString);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetPinvokeMap([In] uint tk, out uint pdwMappingFlags, [Out, MarshalAs(UnmanagedType.LPWStr)] string szImportName, [In] uint cchImportName, out uint pchImportName, out uint pmrImportDLL);
void GetPinvokeMap([In] uint tk, out uint pdwMappingFlags, [Out] IntPtr szImportName, [In] uint cchImportName, out uint pchImportName, out uint pmrImportDLL);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void EnumSignatures([In, Out] ref IntPtr phEnum, out uint rSignatures, [In] uint cMax, out uint pcSignatures);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
@ -123,13 +123,13 @@ namespace Debugger.Interop.MetaData @@ -123,13 +123,13 @@ namespace Debugger.Interop.MetaData
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void FindTypeRef([In] uint tkResolutionScope, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, out uint ptr);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetMemberProps([In] uint mb, out uint pClass, [In, MarshalAs(UnmanagedType.LPWStr)] string szMember, [In] uint cchMember, out uint pchMember, out uint pdwAttr, [Out] IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags, out uint pdwCPlusTypeFlag, out IntPtr ppValue, out uint pcchValue);
void GetMemberProps([In] uint mb, out uint pClass, IntPtr szMember, [In] uint cchMember, out uint pchMember, out uint pdwAttr, out IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags, out uint pdwCPlusTypeFlag, out IntPtr ppValue, out uint pcchValue);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetFieldProps([In] uint mb, out uint pClass, [In] IntPtr szField, [In] uint cchField, out uint pchField, out uint pdwAttr, [Out] IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pdwCPlusTypeFlag, out IntPtr ppValue, out uint pcchValue);
void GetFieldProps([In] uint mb, out uint pClass, [In] IntPtr szField, [In] uint cchField, out uint pchField, out uint pdwAttr, out IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pdwCPlusTypeFlag, out IntPtr ppValue, out uint pcchValue);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetPropertyProps([In] uint prop, out uint pClass, [Out, MarshalAs(UnmanagedType.LPWStr)] string szProperty, [In] uint cchProperty, out uint pchProperty, out uint pdwPropFlags, [Out] IntPtr ppvSig, out uint pbSig, out uint pdwCPlusTypeFlag, out IntPtr ppDefaultValue, out uint pcchDefaultValue, out uint pmdSetter, out uint pmdGetter, out uint rmdOtherMethod, [In] uint cMax, out uint pcOtherMethod);
void GetPropertyProps([In] uint prop, out uint pClass, [Out] IntPtr szProperty, [In] uint cchProperty, out uint pchProperty, out uint pdwPropFlags, out IntPtr ppvSig, out uint pbSig, out uint pdwCPlusTypeFlag, out IntPtr ppDefaultValue, out uint pcchDefaultValue, out uint pmdSetter, out uint pmdGetter, uint[] rmdOtherMethod, [In] uint cMax, out uint pcOtherMethod);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetParamProps([In] uint tk, out uint pmd, out uint pulSequence, [Out] IntPtr szName, [In] uint cchName, out uint pchName, out uint pdwAttr, out uint pdwCPlusTypeFlag, [Out] IntPtr ppValue, out uint pcchValue);
void GetParamProps([In] uint tk, out uint pmd, out uint pulSequence, [Out] IntPtr szName, [In] uint cchName, out uint pchName, out uint pdwAttr, out uint pdwCPlusTypeFlag, out IntPtr ppValue, out uint pcchValue);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
void GetCustomAttributeByName([In] uint tkObj, [In, MarshalAs(UnmanagedType.LPWStr)] string szName, out IntPtr ppData, out uint pcbData);
[PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]

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

@ -319,7 +319,7 @@ namespace Debugger.MetaData @@ -319,7 +319,7 @@ namespace Debugger.MetaData
foreach(Module module in process.Modules) {
if (!domainID.HasValue || domainID == module.CorModule.Assembly.AppDomain.ID) {
try {
uint token = module.MetaData.FindTypeDefByName(fullTypeName, 0 /* enclosing class for nested */).Token;
uint token = module.MetaData.FindTypeDefPropsByName(fullTypeName, 0 /* enclosing class for nested */).Token;
return Create(process, module.CorModule.GetClassFromToken(token));
} catch {
continue;
@ -403,7 +403,7 @@ namespace Debugger.MetaData @@ -403,7 +403,7 @@ namespace Debugger.MetaData
{
// TODO: Generic types
List<DebugType> types = new List<DebugType>();
foreach(TypeDefProps typeDef in module.MetaData.EnumTypeDefs()) {
foreach(TypeDefProps typeDef in module.MetaData.EnumTypeDefProps()) {
if (module.MetaData.GetGenericParamCount(typeDef.Token) == 0) {
types.Add(DebugType.Create(module, typeDef.Token));
}
@ -442,22 +442,22 @@ namespace Debugger.MetaData @@ -442,22 +442,22 @@ namespace Debugger.MetaData
void LoadMemberInfo()
{
// Load interfaces
foreach(InterfaceImplProps implProps in module.MetaData.EnumInterfaceImpls(this.MetadataToken)) {
if ((implProps.ptkIface & 0xFF000000) == (uint)CorTokenType.TypeDef ||
(implProps.ptkIface & 0xFF000000) == (uint)CorTokenType.TypeRef)
foreach(InterfaceImplProps implProps in module.MetaData.EnumInterfaceImplProps(this.MetadataToken)) {
if ((implProps.Interface & 0xFF000000) == (uint)CorTokenType.TypeDef ||
(implProps.Interface & 0xFF000000) == (uint)CorTokenType.TypeRef)
{
this.interfaces.Add(DebugType.Create(module, implProps.ptkIface));
this.interfaces.Add(DebugType.Create(module, implProps.Interface));
}
}
// Load fields
foreach(FieldProps field in module.MetaData.EnumFields(this.MetadataToken)) {
foreach(FieldProps field in module.MetaData.EnumFieldProps(this.MetadataToken)) {
if (field.IsStatic && field.IsLiteral) continue; // Skip static literals TODO: Why?
members.Add(new FieldInfo(this, field));
};
// Load methods
foreach(MethodProps m in module.MetaData.EnumMethods(this.MetadataToken)) {
foreach(MethodProps m in module.MetaData.EnumMethodProps(this.MetadataToken)) {
members.Add(new MethodInfo(this, m));
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs

@ -207,7 +207,7 @@ namespace Debugger.MetaData @@ -207,7 +207,7 @@ namespace Debugger.MetaData
{
// index = 0 is return parameter
try {
return this.Module.MetaData.GetParamForMethodIndex(this.MetadataToken, (uint)index + 1).Name;
return this.Module.MetaData.GetParamPropsForMethodIndex(this.MetadataToken, (uint)index + 1).Name;
} catch {
return String.Empty;
}

41
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/FieldProps.cs

@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct FieldProps
{
public uint Token;
public string Name;
public uint ClassToken;
public uint Flags;
public bool IsStatic {
get {
return (Flags & (uint)ClassFieldAttribute.fdStatic) != 0;
}
}
public bool IsPublic {
get {
return (Flags & (uint)ClassFieldAttribute.fdPublic) != 0;
}
}
public bool IsLiteral {
get {
return (Flags & (uint)ClassFieldAttribute.fdLiteral) != 0;
}
}
}
}
#pragma warning restore 1591

25
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/InterfaceImplProps.cs

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct InterfaceImplProps
{
public uint Token;
public uint classTypeDef;
public uint ptkIface;
public override string ToString()
{
return string.Format("[InterfaceImplProps Token={0:X} ClassTypeDef={1:X} PtkIface={2:X}]", this.Token, this.classTypeDef, this.ptkIface);
}
}
}

1098
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MetaDataImport.cs

File diff suppressed because it is too large Load Diff

43
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/MethodProps.cs

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct MethodProps
{
public uint Token;
public string Name;
public uint ClassToken;
public uint Flags;
public uint ImplFlags;
public uint CodeRVA;
public bool IsStatic {
get {
return (Flags & (uint)CorMethodAttr.mdStatic) != 0;
}
}
public bool IsPublic {
get {
return (Flags & (uint)CorMethodAttr.mdPublic) != 0;
}
}
public bool HasSpecialName {
get {
return (Flags & (uint)CorMethodAttr.mdSpecialName) != 0;
}
}
}
}
#pragma warning restore 1591

24
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/ParamProps.cs

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct ParamProps
{
public uint Token;
public string Name;
public uint MethodToken;
public uint ParameterSequence;
public uint Flags;
}
}
#pragma warning restore 1591

29
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/TypeDefProps.cs

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct TypeDefProps
{
public uint Token;
public string Name;
public uint Flags;
public uint SuperClassToken;
public bool IsInterface {
get {
return (Flags & 0x00000020) != 0;
}
}
}
}
#pragma warning restore 1591

21
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Wrappers/MetaData/TypeRefProps.cs

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
#pragma warning disable 1591
using System;
namespace Debugger.Wrappers.MetaData
{
public struct TypeRefProps
{
public uint Token;
public string Name;
}
}
#pragma warning restore 1591

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj

@ -46,6 +46,7 @@ @@ -46,6 +46,7 @@
<Compile Include="Src\TestPrograms\Breakpoint.cs" />
<Compile Include="Src\TestPrograms\Callstack.cs" />
<Compile Include="Src\TestPrograms\DebuggeeKilled.cs" />
<Compile Include="Src\TestPrograms\DebuggerAttributes.cs" />
<Compile Include="Src\TestPrograms\DefinedTypes.cs" />
<Compile Include="Src\TestPrograms\Exception.cs" />
<Compile Include="Src\TestPrograms\ExceptionCustom.cs" />

77
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/DebuggerAttributes.cs

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
namespace Debugger.Tests.TestPrograms
{
public class DebuggerAttributes
{
public static void Main()
{
System.Diagnostics.Debug.WriteLine("Start");
System.Diagnostics.Debugger.Break();
Internal();
System.Diagnostics.Debug.WriteLine("End");
}
[DebuggerStepThrough]
static void Internal()
{
System.Diagnostics.Debug.WriteLine("Internal");
}
}
}
#if TEST_CODE
namespace Debugger.Tests {
using Debugger.Wrappers.MetaData;
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void DebuggerAttributes()
{
StartTest("DebuggerAttributes.cs");
process.SelectedStackFrame.StepOver();
process.SelectedStackFrame.StepInto();
Module module = process.SelectedStackFrame.MethodInfo.Module;
foreach(ModuleRefProps mRef in module.MetaData.EnumModuleRefProps()) {
}
uint typeRef = module.MetaData.FindTypeRef(0, "System.Diagnostics.DebuggerStepThroughAttribute");
foreach(CustomAttributeProps ca in module.MetaData.EnumCustomAttributeProps(0, 0)) {
MemberRefProps memProps = module.MetaData.GetMemberRefProps(ca.Type);
TypeRefProps typeDefProps = module.MetaData.GetTypeRefProps(memProps.DeclaringType);
}
EndTest();
}
}
}
#endif
#if EXPECTED_OUTPUT
<?xml version="1.0" encoding="utf-8"?>
<DebuggerTests>
<Test name="DebuggerAttributes.cs">
<ProcessStarted />
<ModuleLoaded symbols="False">mscorlib.dll</ModuleLoaded>
<ModuleLoaded symbols="True">DebuggerAttributes.exe</ModuleLoaded>
<ModuleLoaded symbols="False">System.dll</ModuleLoaded>
<ModuleLoaded symbols="False">System.Configuration.dll</ModuleLoaded>
<ModuleLoaded symbols="False">System.Xml.dll</ModuleLoaded>
<LogMessage>Start\r\n</LogMessage>
<DebuggingPaused>Break</DebuggingPaused>
<DebuggingPaused>StepComplete</DebuggingPaused>
<DebuggingPaused>StepComplete</DebuggingPaused>
<LogMessage>Internal\r\n</LogMessage>
<LogMessage>End\r\n</LogMessage>
<ProcessExited />
</Test>
</DebuggerTests>
#endif // EXPECTED_OUTPUT

4
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/_Template.cs

@ -9,7 +9,7 @@ using System; @@ -9,7 +9,7 @@ using System;
namespace Debugger.Tests.TestPrograms
{
public class Template
public class _Template
{
public static void Main()
{
@ -23,7 +23,7 @@ namespace Debugger.Tests { @@ -23,7 +23,7 @@ namespace Debugger.Tests {
public partial class DebuggerTests
{
[NUnit.Framework.Test]
public void Template()
public void _Template()
{
StartTest("_Template.cs");

Loading…
Cancel
Save