Browse Source

Removed classes ArrayElement, LocalVariable, MemberValue and MethodArgument. They added no functionality to the Value class except for specifying how the Value was created.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2765 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
775adac3ea
  1. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  2. 23
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  3. 12
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/FieldInfo.cs
  4. 14
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/PropertyInfo.cs
  5. 33
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs
  6. 71
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/ArrayElement.cs
  7. 37
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/LocalVariable.cs
  8. 53
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/MemberValue.cs
  9. 53
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/MethodArgument.cs

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

@ -237,10 +237,6 @@ @@ -237,10 +237,6 @@
<Compile Include="Src\Variables\Values\Value.Primitive.cs" />
<Compile Include="Src\Variables\Values\Value.cs" />
<Compile Include="Src\Variables\Values\ValueEventArgs.cs" />
<Compile Include="Src\Variables\Variables\ArrayElement.cs" />
<Compile Include="Src\Variables\Variables\LocalVariable.cs" />
<Compile Include="Src\Variables\Variables\MemberValue.cs" />
<Compile Include="Src\Variables\Variables\MethodArgument.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebug.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebugChainReason.cs" />
<Compile Include="Src\Wrappers\CorDebug\Autogenerated\CorDebugClass.cs" />
@ -404,7 +400,6 @@ @@ -404,7 +400,6 @@
<Folder Include="Src\Variables\Evals" />
<Folder Include="Src\Variables\Types" />
<Folder Include="Src\Variables\Values" />
<Folder Include="Src\Variables\Variables" />
<Folder Include="Src\Wrappers" />
<Folder Include="Src\Wrappers\CorDebug" />
<Folder Include="Src\Wrappers\CorDebug\Autogenerated" />

23
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -13,6 +13,8 @@ using Debugger.Wrappers.CorDebug; @@ -13,6 +13,8 @@ using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.CorSym;
using Debugger.Wrappers.MetaData;
using Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
@ -507,12 +509,12 @@ namespace Debugger @@ -507,12 +509,12 @@ namespace Debugger
/// <summary> Gets argument with a given index </summary>
/// <param name="index"> Zero-based index </param>
public MethodArgument GetArgument(int index)
public Value GetArgument(int index)
{
return new MethodArgument(
GetParameterName(index),
index,
return new Value(
process,
GetParameterName(index),
new Ast.IdentifierExpression(GetParameterName(index)),
new IExpirable[] {this},
new IMutable[] {process.DebugeeState},
delegate { return GetArgumentCorValue(index); }
@ -578,7 +580,7 @@ namespace Debugger @@ -578,7 +580,7 @@ namespace Debugger
get {
if (symMethod != null) { // TODO: Is this needed?
ISymUnmanagedScope symRootScope = symMethod.RootScope;
foreach(LocalVariable var in GetLocalVariablesInScope(symRootScope)) {
foreach(Value var in GetLocalVariablesInScope(symRootScope)) {
if (!var.Name.StartsWith("CS$")) { // TODO: Generalize
yield return var;
}
@ -587,23 +589,24 @@ namespace Debugger @@ -587,23 +589,24 @@ namespace Debugger
}
}
IEnumerable<LocalVariable> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
IEnumerable<Value> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
{
foreach (ISymUnmanagedVariable symVar in symScope.Locals) {
yield return GetLocalVariable(symVar);
}
foreach(ISymUnmanagedScope childScope in symScope.Children) {
foreach(LocalVariable var in GetLocalVariablesInScope(childScope)) {
foreach(Value var in GetLocalVariablesInScope(childScope)) {
yield return var;
}
}
}
LocalVariable GetLocalVariable(ISymUnmanagedVariable symVar)
Value GetLocalVariable(ISymUnmanagedVariable symVar)
{
return new LocalVariable(
symVar.Name,
return new Value(
process,
symVar.Name,
new Ast.IdentifierExpression(symVar.Name),
new IExpirable[] {this},
new IMutable[] {process.DebugeeState},
delegate { return GetCorValueOfLocalVariable(symVar); }

12
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/FieldInfo.cs

@ -10,6 +10,8 @@ using System.Collections.Generic; @@ -10,6 +10,8 @@ using System.Collections.Generic;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
using Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
@ -70,10 +72,14 @@ namespace Debugger @@ -70,10 +72,14 @@ namespace Debugger
/// <summary>
/// Given an object of correct type, get the value of this field
/// </summary>
public MemberValue GetValue(Value objectInstance) {
return new MemberValue(
this,
public Value GetValue(Value objectInstance) {
return new Value(
this.Process,
this.Name,
new Ast.MemberReferenceExpression(
new Ast.IdentifierExpression("parent"), // TODO
this.Name
),
new IExpirable[] {objectInstance},
new IMutable[] {objectInstance},
delegate { return GetCorValue(objectInstance); }

14
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/PropertyInfo.cs

@ -10,6 +10,8 @@ using System.Collections.Generic; @@ -10,6 +10,8 @@ using System.Collections.Generic;
using Debugger.Wrappers.CorDebug;
using Debugger.Wrappers.MetaData;
using Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
@ -78,13 +80,13 @@ namespace Debugger @@ -78,13 +80,13 @@ namespace Debugger
}
/// <summary> Get the value of the property using the get accessor </summary>
public MemberValue GetValue(Value objectInstance)
public Value GetValue(Value objectInstance)
{
return GetValue(objectInstance, null);
}
/// <summary> Get the value of indexer property </summary>
public MemberValue GetValue(Value objectInstance, Value[] parameters)
public Value GetValue(Value objectInstance, Value[] parameters)
{
if (getMethod == null) throw new CannotGetValueException("Property does not have a get method");
parameters = parameters ?? new Value[0];
@ -93,9 +95,13 @@ namespace Debugger @@ -93,9 +95,13 @@ namespace Debugger
dependencies.Add(objectInstance);
dependencies.AddRange(parameters);
return new MemberValue(
this,
return new Value(
this.Process,
this.Name,
new Ast.MemberReferenceExpression(
new Ast.IdentifierExpression("parent"), // TODO
this.Name
),
dependencies.ToArray(),
dependencies.ToArray(),
delegate { return getMethod.Invoke(objectInstance, parameters).RawCorValue; }

33
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs

@ -9,6 +9,8 @@ using System; @@ -9,6 +9,8 @@ using System;
using System.Collections.Generic;
using Debugger.Wrappers.CorDebug;
using Ast = ICSharpCode.NRefactory.Ast;
//TODO: Support for lower bound
namespace Debugger
@ -64,25 +66,48 @@ namespace Debugger @@ -64,25 +66,48 @@ namespace Debugger
}
/// <summary> Returns an element of a single-dimensional array </summary>
public ArrayElement GetArrayElement(uint index)
public Value GetArrayElement(uint index)
{
return GetArrayElement(new uint[] {index});
}
/// <summary> Returns an element of an array </summary>
public ArrayElement GetArrayElement(uint[] elementIndices)
public Value GetArrayElement(uint[] elementIndices)
{
uint[] indices = (uint[])elementIndices.Clone();
return new ArrayElement(
indices,
return new Value(
Process,
GetNameFromIndices(indices),
GetExpressionFromIndices(indices),
new IExpirable[] {this},
new IMutable[] {this},
delegate { return GetCorValueOfArrayElement(indices); }
);
}
static string GetNameFromIndices(uint[] indices)
{
string elementName = "[";
for (int i = 0; i < indices.Length; i++) {
elementName += indices[i].ToString() + ",";
}
elementName = elementName.TrimEnd(new char[] {','}) + "]";
return elementName;
}
static Expression GetExpressionFromIndices(uint[] indices)
{
List<Ast.Expression> indicesAst = new List<Ast.Expression>();
foreach(uint indice in indices) {
indicesAst.Add(new Ast.PrimitiveExpression(indice, indice.ToString()));
}
return new Ast.IndexerExpression(
new Ast.IdentifierExpression("parent"), // TODO
indicesAst
);
}
// May be called later
ICorDebugValue GetCorValueOfArrayElement(uint[] indices)
{

71
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/ArrayElement.cs

@ -1,71 +0,0 @@ @@ -1,71 +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 Ast = ICSharpCode.NRefactory.Ast;
using Debugger.Wrappers.CorDebug;
namespace Debugger
{
/// <summary>
/// Represents an element of an array
/// </summary>
public class ArrayElement: Value
{
uint[] indicies;
/// <summary>
/// The indicies of the element; one for each dimension of
/// the array.
/// </summary>
public uint[] Indicies {
get {
return indicies;
}
}
internal ArrayElement(uint[] indicies,
Process process,
IExpirable[] expireDependencies,
IMutable[] mutateDependencies,
CorValueGetter corValueGetter)
:base (process,
GetNameFromIndices(indicies),
GetExpressionFromIndices(indicies),
expireDependencies,
mutateDependencies,
corValueGetter)
{
this.indicies = indicies;
}
static string GetNameFromIndices(uint[] indices)
{
string elementName = "[";
for (int i = 0; i < indices.Length; i++) {
elementName += indices[i].ToString() + ",";
}
elementName = elementName.TrimEnd(new char[] {','}) + "]";
return elementName;
}
static Expression GetExpressionFromIndices(uint[] indices)
{
List<Ast.Expression> indicesAst = new List<Ast.Expression>();
foreach(uint indice in indices) {
indicesAst.Add(new Ast.PrimitiveExpression(indice, indice.ToString()));
}
return new Ast.IndexerExpression(
new Ast.IdentifierExpression("parent"), // TODO
indicesAst
);
}
}
}

37
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/LocalVariable.cs

@ -1,37 +0,0 @@ @@ -1,37 +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 Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
/// Represents a local variable in a function
/// </summary>
public class LocalVariable: Value
{
internal LocalVariable(string name,
Process process,
IExpirable[] expireDependencies,
IMutable[] mutateDependencies,
CorValueGetter corValueGetter)
:base (process,
name,
new Ast.IdentifierExpression(name),
expireDependencies,
mutateDependencies,
corValueGetter)
{
}
}
}

53
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/MemberValue.cs

@ -1,53 +0,0 @@ @@ -1,53 +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 Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
/// Represents a member of class or value type -
/// that is, a field or a property
/// </summary>
public class MemberValue: Value
{
MemberInfo memberInfo;
/// <summary>
/// Gets an MemberInfo object which can be used to obtain
/// metadata information about the member.
/// </summary>
public MemberInfo MemberInfo {
get {
return memberInfo;
}
}
internal MemberValue(MemberInfo memberInfo,
Process process,
IExpirable[] expireDependencies,
IMutable[] mutateDependencies,
CorValueGetter corValueGetter)
:base (process,
memberInfo.Name,
new Ast.MemberReferenceExpression(
new Ast.IdentifierExpression("parent"), // TODO
memberInfo.Name
),
expireDependencies,
mutateDependencies,
corValueGetter)
{
this.memberInfo = memberInfo;
}
}
}

53
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Variables/MethodArgument.cs

@ -1,53 +0,0 @@ @@ -1,53 +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 Ast = ICSharpCode.NRefactory.Ast;
namespace Debugger
{
/// <summary>
/// Represents an argument of a function. That is, it refers to
/// the runtime value of function parameter.
/// </summary>
public class MethodArgument: Value
{
int index;
/// <summary>
/// The index of the function parameter starting at 0.
/// </summary>
/// <remarks>
/// The implicit 'this' is excluded.
/// </remarks>
public int Index {
get {
return index;
}
}
internal MethodArgument(string name,
int index,
Process process,
IExpirable[] expireDependencies,
IMutable[] mutateDependencies,
CorValueGetter corValueGetter)
:base (process,
name,
new Ast.IdentifierExpression(name),
expireDependencies,
mutateDependencies,
corValueGetter)
{
this.index = index;
}
}
}
Loading…
Cancel
Save