Browse Source

Build compound expressions (eg "localVar.field[5]")

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2770 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
bd5484d113
  1. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  2. 9
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.cs
  3. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs
  4. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs
  5. 10
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.xml
  6. 10
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.xml
  7. 32
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml
  8. 20
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.xml

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

@ -440,7 +440,7 @@ namespace Debugger
thisValueCache = new Value( thisValueCache = new Value(
process, process,
"this", "this",
ThisExpresson, new Ast.ThisReferenceExpression(),
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {}, new IMutable[] {},
delegate { return ThisCorValue; } delegate { return ThisCorValue; }
@ -450,12 +450,6 @@ namespace Debugger
} }
} }
static private Expression ThisExpresson {
get {
return new Expression(new ICSharpCode.NRefactory.Ast.ThisReferenceExpression());
}
}
ICorDebugValue ThisCorValue { ICorDebugValue ThisCorValue {
get { get {
if (this.HasExpired) throw new CannotGetValueException("Function has expired"); if (this.HasExpired) throw new CannotGetValueException("Function has expired");

9
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.cs

@ -46,6 +46,15 @@ namespace Debugger
return new Expression(expressionAst); return new Expression(expressionAst);
} }
public static implicit operator ICSharpCode.NRefactory.Ast.Expression(Expression expression)
{
if (expression == null) {
return null;
} else {
return expression.AbstractSynatxTree;
}
}
public override string ToString() public override string ToString()
{ {
return this.Code; return this.Code;

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

@ -96,14 +96,14 @@ namespace Debugger
return elementName; return elementName;
} }
static Expression GetExpressionFromIndices(uint[] indices) Expression GetExpressionFromIndices(uint[] indices)
{ {
List<Ast.Expression> indicesAst = new List<Ast.Expression>(); List<Ast.Expression> indicesAst = new List<Ast.Expression>();
foreach(uint indice in indices) { foreach(uint indice in indices) {
indicesAst.Add(new Ast.PrimitiveExpression(indice, indice.ToString())); indicesAst.Add(new Ast.PrimitiveExpression((int)indice, ((int)indice).ToString()));
} }
return new Ast.IndexerExpression( return new Ast.IndexerExpression(
new Ast.IdentifierExpression("parent"), // TODO this.Expression,
indicesAst indicesAst
); );
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs

@ -53,7 +53,7 @@ namespace Debugger
objectInstance.Process, objectInstance.Process,
fieldInfo.Name, fieldInfo.Name,
new Ast.FieldReferenceExpression( new Ast.FieldReferenceExpression(
new Ast.IdentifierExpression("parent"), // TODO objectInstance.Expression,
fieldInfo fieldInfo
), ),
new IExpirable[] {objectInstance}, new IExpirable[] {objectInstance},
@ -121,7 +121,7 @@ namespace Debugger
objectInstance.Process, objectInstance.Process,
propertyInfo.Name, propertyInfo.Name,
new Ast.PropertyReferenceExpression( new Ast.PropertyReferenceExpression(
new Ast.IdentifierExpression("parent"), // TODO objectInstance.Expression,
propertyInfo propertyInfo
), ),
dependencies.ToArray(), dependencies.ToArray(),

10
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.xml

@ -39,7 +39,7 @@
<Name>[0]</Name> <Name>[0]</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>0</AsString> <AsString>0</AsString>
<Expression>parent[0u]</Expression> <Expression>array[0]</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -55,7 +55,7 @@
<Name>[1]</Name> <Name>[1]</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>1</AsString> <AsString>1</AsString>
<Expression>parent[1u]</Expression> <Expression>array[1]</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -71,7 +71,7 @@
<Name>[2]</Name> <Name>[2]</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>2</AsString> <AsString>2</AsString>
<Expression>parent[2u]</Expression> <Expression>array[2]</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -87,7 +87,7 @@
<Name>[3]</Name> <Name>[3]</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent[3u]</Expression> <Expression>array[3]</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -103,7 +103,7 @@
<Name>[4]</Name> <Name>[4]</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>4</AsString> <AsString>4</AsString>
<Expression>parent[4u]</Expression> <Expression>array[4]</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>

10
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.xml

@ -54,7 +54,7 @@
<Name>class</Name> <Name>class</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.@class</Expression> <Expression>this.@class</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -109,7 +109,7 @@
<Name>class</Name> <Name>class</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.@class</Expression> <Expression>this.@class</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -182,7 +182,7 @@
<Name>class</Name> <Name>class</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.@class</Expression> <Expression>this.@class</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -255,7 +255,7 @@
<Name>class</Name> <Name>class</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.@class</Expression> <Expression>this.@class</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -346,7 +346,7 @@
<Name>class</Name> <Name>class</Name>
<IsNull exception="Value has expired" /> <IsNull exception="Value has expired" />
<AsString exception="Value has expired" /> <AsString exception="Value has expired" />
<Expression>parent.@class</Expression> <Expression>this.@class</Expression>
<HasExpired>True</HasExpired> <HasExpired>True</HasExpired>
<Type exception="Value has expired" /> <Type exception="Value has expired" />
</Value> </Value>

32
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.xml

@ -39,7 +39,7 @@
<Name>buckets</Name> <Name>buckets</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.Int32[]}</AsString> <AsString>{System.Int32[]}</AsString>
<Expression>parent.buckets</Expression> <Expression>dict.buckets</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32[]</Type> <Type>System.Int32[]</Type>
</Value> </Value>
@ -55,7 +55,7 @@
<Name>entries</Name> <Name>entries</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{Entry&lt;System.String,System.Int32&gt;[]}</AsString> <AsString>{Entry&lt;System.String,System.Int32&gt;[]}</AsString>
<Expression>parent.entries</Expression> <Expression>dict.entries</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>Entry&lt;System.String,System.Int32&gt;[]</Type> <Type>Entry&lt;System.String,System.Int32&gt;[]</Type>
</Value> </Value>
@ -71,7 +71,7 @@
<Name>count</Name> <Name>count</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.count</Expression> <Expression>dict.count</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -87,7 +87,7 @@
<Name>version</Name> <Name>version</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>3</AsString> <AsString>3</AsString>
<Expression>parent.version</Expression> <Expression>dict.version</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -103,7 +103,7 @@
<Name>freeList</Name> <Name>freeList</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>-1</AsString> <AsString>-1</AsString>
<Expression>parent.freeList</Expression> <Expression>dict.freeList</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -119,7 +119,7 @@
<Name>freeCount</Name> <Name>freeCount</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>0</AsString> <AsString>0</AsString>
<Expression>parent.freeCount</Expression> <Expression>dict.freeCount</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Int32</Type> <Type>System.Int32</Type>
</Value> </Value>
@ -135,7 +135,7 @@
<Name>comparer</Name> <Name>comparer</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;}</AsString> <AsString>{System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;}</AsString>
<Expression>parent.comparer</Expression> <Expression>dict.comparer</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;</Type> <Type>System.Collections.Generic.GenericEqualityComparer&lt;System.String&gt;</Type>
</Value> </Value>
@ -151,7 +151,7 @@
<Name>keys</Name> <Name>keys</Name>
<IsNull>True</IsNull> <IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString> <AsString>&lt;null&gt;</AsString>
<Expression>parent.keys</Expression> <Expression>dict.keys</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>KeyCollection&lt;System.String,System.Int32&gt;</Type> <Type>KeyCollection&lt;System.String,System.Int32&gt;</Type>
</Value> </Value>
@ -167,7 +167,7 @@
<Name>values</Name> <Name>values</Name>
<IsNull>True</IsNull> <IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString> <AsString>&lt;null&gt;</AsString>
<Expression>parent.values</Expression> <Expression>dict.values</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>ValueCollection&lt;System.String,System.Int32&gt;</Type> <Type>ValueCollection&lt;System.String,System.Int32&gt;</Type>
</Value> </Value>
@ -183,7 +183,7 @@
<Name>_syncRoot</Name> <Name>_syncRoot</Name>
<IsNull>True</IsNull> <IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString> <AsString>&lt;null&gt;</AsString>
<Expression>parent._syncRoot</Expression> <Expression>dict._syncRoot</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Object</Type> <Type>System.Object</Type>
</Value> </Value>
@ -199,7 +199,7 @@
<Name>m_siInfo</Name> <Name>m_siInfo</Name>
<IsNull>True</IsNull> <IsNull>True</IsNull>
<AsString>&lt;null&gt;</AsString> <AsString>&lt;null&gt;</AsString>
<Expression>parent.m_siInfo</Expression> <Expression>dict.m_siInfo</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.Runtime.Serialization.SerializationInfo</Type> <Type>System.Runtime.Serialization.SerializationInfo</Type>
</Value> </Value>
@ -215,7 +215,7 @@
<Name>Comparer</Name> <Name>Comparer</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString> <AsString>{System.TypeLoadException}</AsString>
<Expression>parent.Comparer</Expression> <Expression>dict.Comparer</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type> <Type>System.TypeLoadException</Type>
</Value> </Value>
@ -231,7 +231,7 @@
<Name>Count</Name> <Name>Count</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString> <AsString>{System.TypeLoadException}</AsString>
<Expression>parent.Count</Expression> <Expression>dict.Count</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type> <Type>System.TypeLoadException</Type>
</Value> </Value>
@ -247,7 +247,7 @@
<Name>Keys</Name> <Name>Keys</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString> <AsString>{System.TypeLoadException}</AsString>
<Expression>parent.Keys</Expression> <Expression>dict.Keys</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type> <Type>System.TypeLoadException</Type>
</Value> </Value>
@ -263,7 +263,7 @@
<Name>Values</Name> <Name>Values</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString> <AsString>{System.TypeLoadException}</AsString>
<Expression>parent.Values</Expression> <Expression>dict.Values</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type> <Type>System.TypeLoadException</Type>
</Value> </Value>
@ -279,7 +279,7 @@
<Name>Item</Name> <Name>Item</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>{System.TypeLoadException}</AsString> <AsString>{System.TypeLoadException}</AsString>
<Expression>parent.Item</Expression> <Expression>dict.Item</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.TypeLoadException</Type> <Type>System.TypeLoadException</Type>
</Value> </Value>

20
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.xml

@ -39,7 +39,7 @@
<Name>privateField</Name> <Name>privateField</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>private</AsString> <AsString>private</AsString>
<Expression>parent.privateField</Expression> <Expression>val.privateField</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -55,7 +55,7 @@
<Name>publicFiled</Name> <Name>publicFiled</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>public</AsString> <AsString>public</AsString>
<Expression>parent.publicFiled</Expression> <Expression>val.publicFiled</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -71,7 +71,7 @@
<Name>PublicProperty</Name> <Name>PublicProperty</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>private</AsString> <AsString>private</AsString>
<Expression>parent.PublicProperty</Expression> <Expression>val.PublicProperty</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -87,7 +87,7 @@
<Name>basePublic</Name> <Name>basePublic</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>a</AsString> <AsString>a</AsString>
<Expression>parent.basePublic</Expression> <Expression>val.basePublic</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -103,7 +103,7 @@
<Name>basePrivate</Name> <Name>basePrivate</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>b</AsString> <AsString>b</AsString>
<Expression>parent.basePrivate</Expression> <Expression>val.basePrivate</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -146,7 +146,7 @@
<Name>privateField</Name> <Name>privateField</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>new private</AsString> <AsString>new private</AsString>
<Expression>parent.privateField</Expression> <Expression>val.privateField</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -162,7 +162,7 @@
<Name>publicFiled</Name> <Name>publicFiled</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>public</AsString> <AsString>public</AsString>
<Expression>parent.publicFiled</Expression> <Expression>val.publicFiled</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -178,7 +178,7 @@
<Name>PublicProperty</Name> <Name>PublicProperty</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>new private</AsString> <AsString>new private</AsString>
<Expression>parent.PublicProperty</Expression> <Expression>val.PublicProperty</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -194,7 +194,7 @@
<Name>basePublic</Name> <Name>basePublic</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>a</AsString> <AsString>a</AsString>
<Expression>parent.basePublic</Expression> <Expression>val.basePublic</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>
@ -210,7 +210,7 @@
<Name>basePrivate</Name> <Name>basePrivate</Name>
<IsNull>False</IsNull> <IsNull>False</IsNull>
<AsString>b</AsString> <AsString>b</AsString>
<Expression>parent.basePrivate</Expression> <Expression>val.basePrivate</Expression>
<HasExpired>False</HasExpired> <HasExpired>False</HasExpired>
<Type>System.String</Type> <Type>System.String</Type>
</Value> </Value>

Loading…
Cancel
Save