Browse Source

Renamed files to match class names

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5102 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
0bda39c286
  1. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs
  3. 0
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugFieldInfo.cs
  4. 48
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugLocalVariableInfo.cs
  5. 53
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs
  6. 0
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs
  7. 146
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType-Helpers.cs
  8. 77
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType.cs
  9. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs

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

@ -219,12 +219,12 @@ @@ -219,12 +219,12 @@
<Compile Include="Src\Interop\Enums\CorTokenType.cs" />
<Compile Include="Src\Interop\MetaData\COR_FIELD_OFFSET.cs" />
<Compile Include="Src\Interop\MetaData\IMetaDataImport.cs" />
<Compile Include="Src\Metadata\DebugLocalVariableInfo.cs" />
<Compile Include="Src\Metadata\DebugParameterInfo.cs" />
<Compile Include="Src\Metadata\DebugType-Helpers.cs" />
<Compile Include="Src\Metadata\DebugType.cs" />
<Compile Include="Src\Metadata\FieldInfo.cs" />
<Compile Include="Src\Metadata\MethodInfo.cs" />
<Compile Include="Src\Metadata\PropertyInfo.cs" />
<Compile Include="Src\Metadata\DebugFieldInfo.cs" />
<Compile Include="Src\Metadata\DebugMethodInfo.cs" />
<Compile Include="Src\Metadata\DebugPropertyInfo.cs" />
<Compile Include="Src\Mono.Cecil\Mono.Cecil.Binary\ImageFormatException.cs" />
<Compile Include="Src\Mono.Cecil\Mono.Cecil.Metadata\CodedIndex.cs" />
<Compile Include="Src\Mono.Cecil\Mono.Cecil.Metadata\ElementType.cs" />

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

@ -382,7 +382,7 @@ namespace Debugger @@ -382,7 +382,7 @@ namespace Debugger
/// <returns> Null if not found </returns>
public Value GetLocalVariableValue(string name)
{
foreach(LocalVariableInfo locVar in this.MethodInfo.LocalVariables) {
foreach(DebugLocalVariableInfo locVar in this.MethodInfo.LocalVariables) {
if (locVar.Name == name) {
return locVar.GetValue(this);
}
@ -394,7 +394,7 @@ namespace Debugger @@ -394,7 +394,7 @@ namespace Debugger
public List<Value> GetLocalVariableValues()
{
List<Value> values = new List<Value>();
foreach(LocalVariableInfo locVar in this.MethodInfo.LocalVariables) {
foreach(DebugLocalVariableInfo locVar in this.MethodInfo.LocalVariables) {
values.Add(locVar.GetValue(this));
}
return values;

0
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/FieldInfo.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugFieldInfo.cs

48
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugLocalVariableInfo.cs

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
// <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.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.CorSym;
using Debugger.Wrappers.MetaData;
using ICSharpCode.NRefactory.Ast;
using Mono.Cecil.Signatures;
namespace Debugger.MetaData
{
public class DebugLocalVariableInfo
{
ValueGetter getter;
public string Name { get; internal set; }
public DebugType Type { get; private set; }
public bool IsThis { get; internal set; }
public bool IsCaptured { get; internal set; }
public DebugLocalVariableInfo(string name, DebugType type, ValueGetter getter)
{
this.Name = name;
this.Type = type;
this.getter = getter;
}
public Value GetValue(StackFrame context)
{
return getter(context);
}
public override string ToString()
{
return this.Type.ToString() + " " + this.Name;
}
}
}

53
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/MethodInfo.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugMethodInfo.cs

@ -475,19 +475,19 @@ namespace Debugger.MetaData @@ -475,19 +475,19 @@ namespace Debugger.MetaData
}
}
public List<LocalVariableInfo> LocalVariables {
public List<DebugLocalVariableInfo> LocalVariables {
get {
if (this.SymMethod != null) { // TODO: Is this needed?
return GetLocalVariables();
} else {
return new List<LocalVariableInfo>();
return new List<DebugLocalVariableInfo>();
}
}
}
public string[] LocalVariableNames {
get {
List<LocalVariableInfo> vars = this.LocalVariables;
List<DebugLocalVariableInfo> vars = this.LocalVariables;
List<string> names = new List<string>();
for(int i = 0; i < vars.Count; i++) {
names.Add(vars[i].Name);
@ -497,9 +497,9 @@ namespace Debugger.MetaData @@ -497,9 +497,9 @@ namespace Debugger.MetaData
}
}
List<LocalVariableInfo> localVariables; // Cache
List<DebugLocalVariableInfo> localVariables; // Cache
List<LocalVariableInfo> GetLocalVariables()
List<DebugLocalVariableInfo> GetLocalVariables()
{
if (localVariables != null) return localVariables;
@ -529,7 +529,7 @@ namespace Debugger.MetaData @@ -529,7 +529,7 @@ namespace Debugger.MetaData
} else {
// Add this
if (!this.IsStatic) {
LocalVariableInfo thisVar = new LocalVariableInfo(
DebugLocalVariableInfo thisVar = new DebugLocalVariableInfo(
"this",
this.DeclaringType,
delegate(StackFrame context) {
@ -543,13 +543,13 @@ namespace Debugger.MetaData @@ -543,13 +543,13 @@ namespace Debugger.MetaData
return localVariables;
}
static void AddCapturedLocalVariables(List<LocalVariableInfo> vars, ValueGetter getCaptureClass, DebugType captureClassType)
static void AddCapturedLocalVariables(List<DebugLocalVariableInfo> vars, ValueGetter getCaptureClass, DebugType captureClassType)
{
if (captureClassType.IsDisplayClass || captureClassType.IsYieldEnumerator) {
foreach(DebugFieldInfo fieldInfo in captureClassType.GetFields()) {
DebugFieldInfo fieldInfoCopy = fieldInfo;
if (fieldInfo.Name.StartsWith("CS$")) continue; // Ignore
LocalVariableInfo locVar = new LocalVariableInfo(
DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
fieldInfo.Name,
fieldInfo.FieldType,
delegate(StackFrame context) {
@ -559,7 +559,7 @@ namespace Debugger.MetaData @@ -559,7 +559,7 @@ namespace Debugger.MetaData
locVar.IsCaptured = true;
if (locVar.Name.StartsWith("<>")) {
bool hasThis = false;
foreach(LocalVariableInfo l in vars) {
foreach(DebugLocalVariableInfo l in vars) {
if (l.IsThis) {
hasThis = true;
break;
@ -582,9 +582,9 @@ namespace Debugger.MetaData @@ -582,9 +582,9 @@ namespace Debugger.MetaData
}
}
List<LocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
List<DebugLocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
{
List<LocalVariableInfo> vars = new List<LocalVariableInfo>();
List<DebugLocalVariableInfo> vars = new List<DebugLocalVariableInfo>();
foreach (ISymUnmanagedVariable symVar in symScope.Locals) {
ISymUnmanagedVariable symVarCopy = symVar;
int start;
@ -605,7 +605,7 @@ namespace Debugger.MetaData @@ -605,7 +605,7 @@ namespace Debugger.MetaData
);
}
} else {
LocalVariableInfo locVar = new LocalVariableInfo(
DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
symVar.Name,
locVarType,
delegate(StackFrame context) {
@ -633,33 +633,4 @@ namespace Debugger.MetaData @@ -633,33 +633,4 @@ namespace Debugger.MetaData
return new Value(context.AppDomain, corVal);
}
}
public delegate Value ValueGetter(StackFrame context);
public class LocalVariableInfo
{
ValueGetter getter;
public string Name { get; internal set; }
public DebugType Type { get; private set; }
public bool IsThis { get; internal set; }
public bool IsCaptured { get; internal set; }
public LocalVariableInfo(string name, DebugType type, ValueGetter getter)
{
this.Name = name;
this.Type = type;
this.getter = getter;
}
public Value GetValue(StackFrame context)
{
return getter(context);
}
public override string ToString()
{
return this.Type.ToString() + " " + this.Name;
}
}
}

0
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/PropertyInfo.cs → src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugPropertyInfo.cs

146
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Metadata/DebugType-Helpers.cs

@ -1,146 +0,0 @@ @@ -1,146 +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>
using System;
using System.Collections.Generic;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
using System.Reflection;
namespace Debugger.MetaData
{
public partial class DebugType
{
private bool primitiveTypeCached;
private System.Type primitiveType;
/// <summary> Returns simple managed type coresponding to the primitive type. </summary>
[Tests.Ignore]
public System.Type PrimitiveType {
get {
if (!primitiveTypeCached) {
primitiveTypeCached = true;
primitiveType = GetPrimitiveType();
}
return primitiveType;
}
}
/// <summary> Returns simple managed type coresponding to the primitive type. </summary>
private System.Type GetPrimitiveType()
{
if (corElementType == CorElementType.VALUETYPE) {
CorElementType corType;
try {
corType = TypeNameToCorElementType(this.FullName);
} catch (DebuggerException) {
return null;
}
return CorElementTypeToManagedType(corType);
} else {
return CorElementTypeToManagedType(corElementType);
}
}
internal static Type CorElementTypeToManagedType(CorElementType corElementType)
{
switch(corElementType) {
case CorElementType.BOOLEAN: return typeof(System.Boolean);
case CorElementType.CHAR: return typeof(System.Char);
case CorElementType.I1: return typeof(System.SByte);
case CorElementType.U1: return typeof(System.Byte);
case CorElementType.I2: return typeof(System.Int16);
case CorElementType.U2: return typeof(System.UInt16);
case CorElementType.I4: return typeof(System.Int32);
case CorElementType.U4: return typeof(System.UInt32);
case CorElementType.I8: return typeof(System.Int64);
case CorElementType.U8: return typeof(System.UInt64);
case CorElementType.R4: return typeof(System.Single);
case CorElementType.R8: return typeof(System.Double);
case CorElementType.I: return typeof(System.IntPtr);
case CorElementType.U: return typeof(System.UIntPtr);
case CorElementType.STRING: return typeof(System.String);
default: return null;
}
}
internal static CorElementType TypeNameToCorElementType(string fullname)
{
switch (fullname) {
case "System.Boolean": return CorElementType.BOOLEAN;
case "System.Char": return CorElementType.CHAR;
case "System.SByte": return CorElementType.I1;
case "System.Byte": return CorElementType.U1;
case "System.Int16": return CorElementType.I2;
case "System.UInt16": return CorElementType.U2;
case "System.Int32": return CorElementType.I4;
case "System.UInt32": return CorElementType.U4;
case "System.Int64": return CorElementType.I8;
case "System.UInt64": return CorElementType.U8;
case "System.Single": return CorElementType.R4;
case "System.Double": return CorElementType.R8;
case "System.IntPtr": return CorElementType.I;
case "System.UIntPtr": return CorElementType.U;
case "System.String": return CorElementType.STRING;
default: throw new DebuggerException("Not a primitive type");
}
}
/*
* Find the super class manually - unused since we have ICorDebugType.GetBase() in .NET 2.0
*
protected static ICorDebugClass GetSuperClass(Process process, ICorDebugClass currClass)
{
Module currModule = process.GetModule(currClass.Module);
uint superToken = currModule.MetaData.GetTypeDefProps(currClass.Token).SuperClassToken;
// It has no base class
if ((superToken & 0x00FFFFFF) == 0x00000000) return null;
// TypeDef - Localy defined
if ((superToken & 0xFF000000) == 0x02000000) {
return currModule.CorModule.GetClassFromToken(superToken);
}
// TypeSpec - generic class whith 'which'
if ((superToken & 0xFF000000) == 0x1B000000) {
// Walkaround - fake 'object' type
string fullTypeName = "System.Object";
foreach (Module superModule in process.Modules) {
try {
uint token = superModule.MetaData.FindTypeDefByName(fullTypeName, 0).Token;
return superModule.CorModule.GetClassFromToken(token);
} catch {
continue;
}
}
}
// TypeRef - Referencing to external assembly
if ((superToken & 0xFF000000) == 0x01000000) {
string fullTypeName = currModule.MetaData.GetTypeRefProps(superToken).Name;
foreach (Module superModule in process.Modules) {
// TODO: Does not work for nested
// TODO: preservesig
try {
uint token = superModule.MetaData.FindTypeDefByName(fullTypeName, 0).Token;
return superModule.CorModule.GetClassFromToken(token);
} catch {
continue;
}
}
}
// TODO: Can also be TypeSpec = 0x1b000000
throw new DebuggerException("Superclass not found");
}
*/
}
}

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

@ -27,7 +27,7 @@ namespace Debugger.MetaData @@ -27,7 +27,7 @@ namespace Debugger.MetaData
/// If two types are identical, the references to DebugType will also be identical
/// Type will be loaded once per each appdomain.
/// </remarks>
public partial class DebugType: System.Type
public class DebugType: System.Type
{
AppDomain appDomain;
Process process;
@ -592,6 +592,81 @@ namespace Debugger.MetaData @@ -592,6 +592,81 @@ namespace Debugger.MetaData
}
}
private bool primitiveTypeCached;
private System.Type primitiveType;
/// <summary> Returns simple managed type coresponding to the primitive type. </summary>
[Tests.Ignore]
public System.Type PrimitiveType {
get {
if (!primitiveTypeCached) {
primitiveTypeCached = true;
primitiveType = GetPrimitiveType();
}
return primitiveType;
}
}
/// <summary> Returns simple managed type coresponding to the primitive type. </summary>
private System.Type GetPrimitiveType()
{
if (corElementType == CorElementType.VALUETYPE) {
CorElementType corType;
try {
corType = TypeNameToCorElementType(this.FullName);
} catch (DebuggerException) {
return null;
}
return CorElementTypeToManagedType(corType);
} else {
return CorElementTypeToManagedType(corElementType);
}
}
internal static Type CorElementTypeToManagedType(CorElementType corElementType)
{
switch(corElementType) {
case CorElementType.BOOLEAN: return typeof(System.Boolean);
case CorElementType.CHAR: return typeof(System.Char);
case CorElementType.I1: return typeof(System.SByte);
case CorElementType.U1: return typeof(System.Byte);
case CorElementType.I2: return typeof(System.Int16);
case CorElementType.U2: return typeof(System.UInt16);
case CorElementType.I4: return typeof(System.Int32);
case CorElementType.U4: return typeof(System.UInt32);
case CorElementType.I8: return typeof(System.Int64);
case CorElementType.U8: return typeof(System.UInt64);
case CorElementType.R4: return typeof(System.Single);
case CorElementType.R8: return typeof(System.Double);
case CorElementType.I: return typeof(System.IntPtr);
case CorElementType.U: return typeof(System.UIntPtr);
case CorElementType.STRING: return typeof(System.String);
default: return null;
}
}
internal static CorElementType TypeNameToCorElementType(string fullname)
{
switch (fullname) {
case "System.Boolean": return CorElementType.BOOLEAN;
case "System.Char": return CorElementType.CHAR;
case "System.SByte": return CorElementType.I1;
case "System.Byte": return CorElementType.U1;
case "System.Int16": return CorElementType.I2;
case "System.UInt16": return CorElementType.U2;
case "System.Int32": return CorElementType.I4;
case "System.UInt32": return CorElementType.U4;
case "System.Int64": return CorElementType.I8;
case "System.UInt64": return CorElementType.U8;
case "System.Single": return CorElementType.R4;
case "System.Double": return CorElementType.R8;
case "System.IntPtr": return CorElementType.I;
case "System.UIntPtr": return CorElementType.U;
case "System.String": return CorElementType.STRING;
default: throw new DebuggerException("Not a primitive type");
}
}
/// <summary> Gets a value indicating whether the type is an integer type </summary>
[Tests.Ignore]
public bool IsInteger {

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs

@ -13,6 +13,8 @@ using Debugger.Wrappers.CorDebug; @@ -13,6 +13,8 @@ using Debugger.Wrappers.CorDebug;
namespace Debugger
{
public delegate Value ValueGetter(StackFrame context);
/// <summary>
/// Value class provides functions to examine value in the debuggee.
/// It has very life-time. In general, value dies whenever debugger is

Loading…
Cancel
Save