From 882b0af0c5ef3d6ae813be9b89589a30bf47fefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Thu, 17 Jan 2008 22:47:41 +0000 Subject: [PATCH] Removed Value.Name property. Removed ValueCollection. Removed ExpressionCollection. Reorganized methods in StackFrame, added some convenience methods. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2863 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Expressions/SimpleIdentifierExpression.cs | 19 +- .../Project/Src/TreeModel/ValueNode.cs | 2 +- .../Project/Debugger.Core.csproj | 2 - .../Project/Src/Threads/Process.cs | 21 -- .../Project/Src/Threads/StackFrame.cs | 156 ++++----- .../Ast/ThisReferenceExpression.cs | 2 +- .../Expressions/Expression.Create.cs | 30 +- .../Expressions/ExpressionCollection.cs | 16 - .../Project/Src/Variables/Types/MethodInfo.cs | 11 + .../Src/Variables/Values/Value.Array.cs | 16 +- .../Src/Variables/Values/Value.Object.cs | 19 +- .../Project/Src/Variables/Values/Value.cs | 7 - .../Src/Variables/Values/ValueCollection.cs | 105 ------ .../Project/Src/DebuggerTestsBase.cs | 1 + .../Project/Src/TestPrograms/ArrayValue.cs | 11 +- .../Project/Src/TestPrograms/Callstack.cs | 24 -- .../Project/Src/TestPrograms/Expressions.cs | 7 +- .../TestPrograms/FunctionArgumentVariables.cs | 31 +- .../Src/TestPrograms/FunctionLifetime.cs | 32 -- .../TestPrograms/FunctionLocalVariables.cs | 10 +- .../TestPrograms/FunctionVariablesLifetime.cs | 28 +- .../Src/TestPrograms/GenericDictionary.cs | 4 +- .../Project/Src/TestPrograms/Generics.cs | 304 ------------------ .../Src/TestPrograms/MetadataIdentity.cs | 4 +- .../Project/Src/TestPrograms/ObjectValue.cs | 2 +- .../Project/Src/TestPrograms/ValueType.cs | 3 +- 26 files changed, 138 insertions(+), 729 deletions(-) delete mode 100644 src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/ExpressionCollection.cs delete mode 100644 src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/SimpleIdentifierExpression.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/SimpleIdentifierExpression.cs index fea4d9694c..1512d6eb85 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/SimpleIdentifierExpression.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/SimpleIdentifierExpression.cs @@ -31,11 +31,22 @@ namespace Debugger.Expressions protected override Value EvaluateInternal(StackFrame context) { - Value value = context.GetValue(identifier); - if (value == null) { - throw new GetValueException("Identifier " + identifier + " not found"); + if (identifier == "this") { + return context.GetThisValue(); } - return value; + + Value arg = context.GetArgumentValue(identifier); + if (arg != null) return arg; + + Value local = context.GetLocalVariableValue(identifier); + if (local != null) return local; + + if (!context.MethodInfo.IsStatic) { + Value member = context.GetThisValue().GetMemberValue(identifier); + if (member != null) return member; + } + + throw new GetValueException("Identifier " + identifier + " not found"); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs index 6f6d33a9e1..77b39d81fc 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs @@ -36,7 +36,7 @@ namespace Debugger.AddIn.TreeModel this.Image = DebuggerIcons.ImageList.Images[1]; // Field } - this.Name = val.Name; + this.Name = val.Expression.CodeTail; if (ShowValuesInHexadecimal && val.IsInteger) { this.Text = String.Format("0x{0:X}", val.PrimitiveValue); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj index 579df5c993..5649afa683 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -225,7 +225,6 @@ - @@ -240,7 +239,6 @@ - diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs index 32d745d746..2b7ac6a085 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs @@ -233,26 +233,5 @@ namespace Debugger } } } - - public ValueCollection LocalVariables { - get { - if (SelectedStackFrame == null || IsRunning) { - return ValueCollection.Empty; - } else { - return SelectedStackFrame.Variables; - } - } - } - - /// Gets value of given name which is accessible from selected stack frame - /// Null if not found - public Value GetValue(string name) - { - if (SelectedStackFrame == null || IsRunning) { - return null; - } else { - return SelectedStackFrame.GetValue(name); - } - } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/StackFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/StackFrame.cs index 3f7cd1bdb1..3f78d8a270 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/StackFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/StackFrame.cs @@ -293,87 +293,25 @@ namespace Debugger } } - /// Gets value of given name which is accessible from this stack frame - /// Null if not found - public Value GetValue(string name) - { - if (name == "this") { - return ThisValue; - } - if (Arguments.Contains(name)) { - return Arguments[name]; - } - if (LocalVariables.Contains(name)) { - return LocalVariables[name]; - } - if (ContaingClassVariables.Contains(name)) { - return ContaingClassVariables[name]; - } - return null; - } - - /// - /// Gets all variables in the lexical scope of the stack frame. - /// That is, arguments, local variables and varables of the containing class. - /// - [Debugger.Tests.Ignore] // Accessible though others - public ValueCollection Variables { - get { - return new ValueCollection(GetVariables()); - } - } - - IEnumerable GetVariables() - { - if (!this.MethodInfo.IsStatic) { - yield return ThisValue; - } - foreach(Value val in Arguments) { - yield return val; - } - foreach(Value val in LocalVariables) { - yield return val; - } - foreach(Value val in ContaingClassVariables) { - yield return val; - } - } - /// /// Gets the instance of the class asociated with the current frame. /// That is, 'this' in C#. /// - public Value ThisValue { - get { - return new Value(process, new ThisReferenceExpression(), ThisCorValue); - } - } - - ICorDebugValue ThisCorValue { - get { - if (this.MethodInfo.IsStatic) throw new GetValueException("Static method does not have 'this'."); - if (this.HasExpired) throw new GetValueException("StackFrame has expired"); - try { - return CorILFrame.GetArgument(0); - } catch (COMException e) { - // System.Runtime.InteropServices.COMException (0x80131304): An IL variable is not available at the current native IP. (See Forum-8640) - if ((uint)e.ErrorCode == 0x80131304) throw new GetValueException("Not available in the current state"); - throw; - } - } + public Value GetThisValue() + { + return new Value(process, new ThisReferenceExpression(), GetThisCorValue()); } - /// - /// Gets all accessible members of the class that defines this stack frame. - /// - public ValueCollection ContaingClassVariables { - get { - // TODO: Should work for static - if (!this.MethodInfo.IsStatic) { - return ThisValue.GetMemberValues(); - } else { - return ValueCollection.Empty; - } + ICorDebugValue GetThisCorValue() + { + if (this.MethodInfo.IsStatic) throw new GetValueException("Static method does not have 'this'."); + if (this.HasExpired) throw new GetValueException("StackFrame has expired"); + try { + return CorILFrame.GetArgument(0); + } catch (COMException e) { + // System.Runtime.InteropServices.COMException (0x80131304): An IL variable is not available at the current native IP. (See Forum-8640) + if ((uint)e.ErrorCode == 0x80131304) throw new GetValueException("Not available in the current state"); + throw; } } @@ -409,42 +347,38 @@ namespace Debugger } } - /// Gets all arguments of the stack frame. - public ValueCollection Arguments { - get { - return new ValueCollection(ArgumentsEnum); - } - } + #region Convenience methods - IEnumerable ArgumentsEnum { - get { - for (int i = 0; i < ArgumentCount; i++) { - yield return GetArgumentValue(i); + /// Gets argument with a given name + /// Null if not found + public Value GetArgumentValue(string name) + { + for(int i = 0; i < this.ArgumentCount; i++) { + if (this.MethodInfo.GetParameterName(i) == name) { + return GetArgumentValue(i); } } + return null; } - /// Gets all local variables of the stack frame. - public ValueCollection LocalVariables { - get { - return new ValueCollection(LocalVariablesEnum); + /// Gets all arguments of the stack frame. + public Value[] GetArgumentValues() + { + List values = new List(); + for (int i = 0; i < ArgumentCount; i++) { + values.Add(GetArgumentValue(i)); } + return values.ToArray(); } - IEnumerable LocalVariablesEnum { - get { - foreach(ISymUnmanagedVariable symVar in this.MethodInfo.LocalVariables) { - yield return GetLocalVariableValue(symVar); - } - } - } + #endregion public Value GetLocalVariableValue(ISymUnmanagedVariable symVar) { - return new Value(this.Process, new LocalVariableIdentifierExpression(MethodInfo, symVar), GetCorValueOfLocalVariable(symVar)); + return new Value(this.Process, new LocalVariableIdentifierExpression(MethodInfo, symVar), GetLocalVariableCorValue(symVar)); } - ICorDebugValue GetCorValueOfLocalVariable(ISymUnmanagedVariable symVar) + ICorDebugValue GetLocalVariableCorValue(ISymUnmanagedVariable symVar) { if (this.HasExpired) throw new GetValueException("StackFrame has expired"); @@ -455,5 +389,31 @@ namespace Debugger throw; } } + + #region Convenience methods + + /// Get local variable with given name + /// Null if not found + public Value GetLocalVariableValue(string name) + { + foreach(ISymUnmanagedVariable symVar in this.MethodInfo.LocalVariables) { + if (symVar.Name == name) { + return GetLocalVariableValue(symVar); + } + } + return null; + } + + /// Gets all local variables of the stack frame. + public Value[] GetLocalVariableValues() + { + List values = new List(); + foreach(ISymUnmanagedVariable symVar in this.MethodInfo.LocalVariables) { + values.Add(GetLocalVariableValue(symVar)); + } + return values.ToArray(); + } + + #endregion } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Ast/ThisReferenceExpression.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Ast/ThisReferenceExpression.cs index 94428798b5..644f0268d1 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Ast/ThisReferenceExpression.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Ast/ThisReferenceExpression.cs @@ -22,7 +22,7 @@ namespace Debugger.Expressions protected override Value EvaluateInternal(StackFrame context) { - return context.ThisValue; + return context.GetThisValue(); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs index bef48dc83c..441c2d1bfe 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs @@ -19,13 +19,13 @@ namespace Debugger.Expressions return new ArrayIndexerExpression(this, indices); } - public ExpressionCollection AppendIndexers(ArrayDimensions dimensions) + public Expression[] AppendIndexers(ArrayDimensions dimensions) { - ExpressionCollection elements = new ExpressionCollection(); + List elements = new List(); foreach(int[] indices in dimensions.Indices) { elements.Add(this.AppendIndexer(indices)); } - return elements; + return elements.ToArray(); } public Expression AppendFieldReference(FieldInfo fieldInfo) @@ -38,9 +38,9 @@ namespace Debugger.Expressions return new MemberReferenceExpression(this, propertyInfo, null); } - public ExpressionCollection AppendObjectMembers(DebugType type, BindingFlags bindingFlags) + public Expression[] AppendObjectMembers(DebugType type, BindingFlags bindingFlags) { - ExpressionCollection members = new ExpressionCollection(); + List members = new List(); foreach(FieldInfo field in type.GetFields(bindingFlags)) { members.Add(this.AppendFieldReference(field)); @@ -49,13 +49,13 @@ namespace Debugger.Expressions members.Add(this.AppendPropertyReference(property)); } - return members; + return members.ToArray(); } /// Get all variables for a method - this; parameters; local variables - public static ExpressionCollection MethodVariables(MethodInfo methodInfo) + public static Expression[] MethodVariables(MethodInfo methodInfo) { - ExpressionCollection vars = new ExpressionCollection(); + List vars = new List(); if (!methodInfo.IsStatic) { vars.Add(MethodThis()); @@ -63,7 +63,7 @@ namespace Debugger.Expressions vars.AddRange(MethodParameters(methodInfo)); vars.AddRange(MethodLocalVariables(methodInfo)); - return vars; + return vars.ToArray(); } /// Get 'this' variable for a method @@ -73,27 +73,27 @@ namespace Debugger.Expressions } /// Get parameters of a method - public static ExpressionCollection MethodParameters(MethodInfo methodInfo) + public static Expression[] MethodParameters(MethodInfo methodInfo) { - ExpressionCollection pars = new ExpressionCollection(); + List pars = new List(); for(int i = 0; i < methodInfo.ParameterCount; i++) { pars.Add(new ParameterIdentifierExpression(methodInfo, i)); } - return pars; + return pars.ToArray(); } /// Get local variables of a method - public static ExpressionCollection MethodLocalVariables(MethodInfo methodInfo) + public static Expression[] MethodLocalVariables(MethodInfo methodInfo) { - ExpressionCollection vars = new ExpressionCollection(); + List vars = new List(); foreach(ISymUnmanagedVariable var in methodInfo.LocalVariables) { vars.Add(new LocalVariableIdentifierExpression(methodInfo, var)); } - return vars; + return vars.ToArray(); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/ExpressionCollection.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/ExpressionCollection.cs deleted file mode 100644 index fdd5936ce3..0000000000 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/ExpressionCollection.cs +++ /dev/null @@ -1,16 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; - -namespace Debugger.Expressions -{ - public class ExpressionCollection: List - { - } -} diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/MethodInfo.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/MethodInfo.cs index 14949910fa..18cda2acaf 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/MethodInfo.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Types/MethodInfo.cs @@ -113,6 +113,7 @@ namespace Debugger } } + /// Gets the number of paramters of this method [Debugger.Tests.Ignore] public int ParameterCount { get { @@ -132,6 +133,16 @@ namespace Debugger } } + /// Get names of all parameters in order + public string[] GetParameterNames() + { + List names = new List(); + for(int i = 0; i < ParameterCount; i++) { + names.Add(GetParameterName(i)); + } + return names.ToArray(); + } + [Debugger.Tests.Ignore] public List LocalVariables { get { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs index c4af6bcce6..c0e4b39f88 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs @@ -111,19 +111,13 @@ namespace Debugger } /// Returns all elements in the array - public ValueCollection GetArrayElements() + public Value[] GetArrayElements() { - return new ValueCollection(this.ArrayElements); - } - - /// Enumerate over all array elements - [Debugger.Tests.Ignore] - public IEnumerable ArrayElements { - get { - foreach(int[] indices in this.ArrayDimensions.Indices) { - yield return GetArrayElement(indices); - } + List values = new List(); + foreach(int[] indices in this.ArrayDimensions.Indices) { + values.Add(GetArrayElement(indices)); } + return values.ToArray(); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs index 35daa10335..2f89586c32 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs @@ -256,9 +256,8 @@ namespace Debugger ); } - /// - /// Get a field or property of an object with a given name. - /// + /// Get a field or property of an object with a given name. + /// Null if not found public Value GetMemberValue(string name) { DebugType currentType = this.Type; @@ -274,13 +273,11 @@ namespace Debugger } currentType = currentType.BaseType; } - throw new GetValueException("Member " + name + " was not found"); + return null; } - /// - /// Get all fields and properties of an object. - /// - public ValueCollection GetMemberValues() + /// Get all fields and properties of an object. + public Value[] GetMemberValues() { return GetMemberValues(null, BindingFlags.All); } @@ -290,12 +287,12 @@ namespace Debugger /// /// Limit to type, null for all types /// Get only members with certain flags - public ValueCollection GetMemberValues(DebugType type, BindingFlags bindingFlags) + public Value[] GetMemberValues(DebugType type, BindingFlags bindingFlags) { if (IsObject) { - return new ValueCollection(GetObjectMembersEnum(type, bindingFlags)); + return new List(GetObjectMembersEnum(type, bindingFlags)).ToArray(); } else { - return ValueCollection.Empty; + return new Value[0]; } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs index 2cd0909577..0db2561604 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs @@ -34,13 +34,6 @@ namespace Debugger get { return expression; } } - /// Gets the name associated with the value - public string Name { - get { - return this.Expression.CodeTail; - } - } - /// Returns true if the value is null public bool IsNull { get { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs deleted file mode 100644 index 39b58c7abc..0000000000 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Debugger -{ - /// - /// An enumerable collection of values accessible by name. - /// - public class ValueCollection: DebuggerObject, IEnumerable, IEnumerable - { - internal static ValueCollection Empty = new ValueCollection(new Value[0]); - - List list = new List(); - Dictionary> hashtable = new Dictionary>(); - - IEnumerator IEnumerable.GetEnumerator() - { - foreach(Value namedValue in list) { - yield return namedValue; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - foreach(Value namedValue in list) { - yield return namedValue; - } - } - - internal ValueCollection(IEnumerable namedValues) - { - foreach(Value namedValue in namedValues) { - string name = namedValue.Name; - if (hashtable.ContainsKey(name)) { - hashtable[name].Add(namedValue); - } else { - hashtable[name] = new List(new Value[] {namedValue}); - } - list.Add(namedValue); - } - } - - /// - /// Gets a value indicating whether the collection contains a - /// value with a given name - /// - public bool Contains(string name) - { - return hashtable.ContainsKey(name); - } - - /// - /// Gets number of named values contained in the collection - /// - public int Count { - get { - return list.Count; - } - } - - /// - /// Gets a value by index - /// - public Value this[int i] { - get { - return list[i]; - } - } - - /// - /// Gets a value by its name. - /// - public Value this[string variableName] { - get { - if (hashtable.ContainsKey(variableName)) { - foreach(Value val in hashtable[variableName]) { - return val; - } - } - -// int index = variableName.IndexOf('.'); -// if (index != -1) { -// string rootVariable = variableName.Substring(0, index); -// string subVariable = variableName.Substring(index + 1); -// return this[rootVariable].Value.SubVariables[subVariable]; -// } - - throw new DebuggerException("Variable \"" + variableName + "\" is not in collection"); - } - } - - public override string ToString() - { - return string.Format(@"[{0} Count={1}]", this.GetType().Name, this.Count); - } - } -} diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs index 1f147d2834..fb2787b385 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs @@ -237,6 +237,7 @@ namespace Debugger.Tests } foreach(System.Reflection.PropertyInfo property in type.GetProperties()) { + if (type.BaseType == typeof(Array)) continue; if (property.GetGetMethod() == null) continue; if (property.GetGetMethod().GetParameters().Length > 0) continue; if (property.GetCustomAttributes(typeof(Debugger.Tests.IgnoreAttribute), true).Length > 0) continue; diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs index efdcad8b6c..a05d894110 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ArrayValue.cs @@ -31,7 +31,7 @@ namespace Debugger.Tests { { StartTest("ArrayValue.cs"); WaitForPause(); - Value array = process.SelectedStackFrame.LocalVariables["array"]; + Value array = process.SelectedStackFrame.GetLocalVariableValue("array"); ObjectDump("array", array); ObjectDump("array elements", array.GetArrayElements()); @@ -61,14 +61,12 @@ namespace Debugger.Tests { False array - array False {System.Int32[]} False System.Int32[] - - 5 + False @@ -79,7 +77,6 @@ namespace Debugger.Tests { True 0 array[0] - [0] False 0 False @@ -95,7 +92,6 @@ namespace Debugger.Tests { True 1 array[1] - [1] False 1 False @@ -111,7 +107,6 @@ namespace Debugger.Tests { True 2 array[2] - [2] False 2 False @@ -127,7 +122,6 @@ namespace Debugger.Tests { True 3 array[3] - [3] False 3 False @@ -143,7 +137,6 @@ namespace Debugger.Tests { True 4 array[4] - [4] False 4 False diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs index 80ab483cda..d0b7f926e2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Callstack.cs @@ -70,33 +70,21 @@ namespace Debugger.Tests { True False Start=26,4 End=26,40 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] Sub1 True False Start=21,4 End=21,11 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] Main True False Start=16,4 End=16,11 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] StepComplete @@ -107,22 +95,14 @@ namespace Debugger.Tests { True False Start=21,4 End=21,11 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] Main True False Start=16,4 End=16,11 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] StepComplete @@ -133,11 +113,7 @@ namespace Debugger.Tests { True False Start=16,4 End=16,11 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Expressions.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Expressions.cs index 4bb69086ab..ff7940806b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Expressions.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Expressions.cs @@ -59,10 +59,9 @@ namespace Debugger.Tests { StartTest("Expressions.cs"); WaitForPause(); - ObjectDump("Variables", process.SelectedStackFrame.Variables); - ObjectDump("array", process.SelectedStackFrame.Variables["array"].GetArrayElements()); - ObjectDump("array2", process.SelectedStackFrame.Variables["array2"].GetArrayElements()); - ObjectDump("this", process.SelectedStackFrame.ThisValue.GetMemberValues()); + ObjectDump("Arguments", process.SelectedStackFrame.GetArgumentValues()); + ObjectDump("LocalVariables", process.SelectedStackFrame.GetLocalVariableValues()); + ObjectDump("this", process.SelectedStackFrame.GetThisValue().GetMemberValues()); process.Continue(); process.WaitForExit(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs index 282d566b3e..4ec765ba0a 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionArgumentVariables.cs @@ -77,7 +77,7 @@ namespace Debugger.Tests { for(int i = 0; i < 5; i++) { process.Continue(); WaitForPause(); - ObjectDump("Arguments", process.SelectedStackFrame.Arguments); + ObjectDump("Arguments", process.SelectedStackFrame.GetArgumentValues()); } process.Continue(); @@ -97,8 +97,7 @@ namespace Debugger.Tests { FunctionArgumentVariables.exe Break Break - - 9 + False @@ -109,7 +108,6 @@ namespace Debugger.Tests { True 1 i - i False 1 False @@ -125,7 +123,6 @@ namespace Debugger.Tests { False A s - s False A False @@ -141,7 +138,6 @@ namespace Debugger.Tests { False s_null - s_null True <null> False @@ -157,7 +153,6 @@ namespace Debugger.Tests { True 2 ref_i - ref_i False 2 False @@ -173,7 +168,6 @@ namespace Debugger.Tests { True 3 out_i - out_i False 3 False @@ -189,7 +183,6 @@ namespace Debugger.Tests { True 0 out_i2 - out_i2 False 0 False @@ -205,7 +198,6 @@ namespace Debugger.Tests { False B ref_s - ref_s False B False @@ -221,7 +213,6 @@ namespace Debugger.Tests { False iNull - iNull False {System.Nullable<System.Int32>} False @@ -237,7 +228,6 @@ namespace Debugger.Tests { False iNull_null - iNull_null False {System.Nullable<System.Int32>} False @@ -245,8 +235,7 @@ namespace Debugger.Tests { Break - - 1 + True 0 @@ -257,7 +246,6 @@ namespace Debugger.Tests { False args - args False {System.String[]} False @@ -265,8 +253,7 @@ namespace Debugger.Tests { Break - - 1 + True 1 @@ -277,7 +264,6 @@ namespace Debugger.Tests { False args - args False {System.String[]} False @@ -285,8 +271,7 @@ namespace Debugger.Tests { Break - - 1 + True 2 @@ -297,7 +282,6 @@ namespace Debugger.Tests { False args - args False {System.String[]} False @@ -305,8 +289,7 @@ namespace Debugger.Tests { Break - - 2 + False @@ -317,7 +300,6 @@ namespace Debugger.Tests { True 1 i - i False 1 False @@ -333,7 +315,6 @@ namespace Debugger.Tests { False A s - s False A False diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLifetime.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLifetime.cs index 689735877a..04cb750a19 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLifetime.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLifetime.cs @@ -80,11 +80,7 @@ namespace Debugger.Tests { True False Start=22,4 End=22,40 - - [ValueCollection Count=0] 1 - [ValueCollection Count=1] - [ValueCollection Count=0] Break @@ -92,22 +88,14 @@ namespace Debugger.Tests { True True - - [ValueCollection Count=0] - - [ValueCollection Count=0] SubFunction True False Start=29,4 End=29,40 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] Break @@ -115,22 +103,14 @@ namespace Debugger.Tests { True True - - [ValueCollection Count=0] - - [ValueCollection Count=0] Function True False Start=24,4 End=24,40 - - [ValueCollection Count=0] 1 - [ValueCollection Count=1] - [ValueCollection Count=0] Break
@@ -138,33 +118,21 @@ namespace Debugger.Tests { True False Start=17,4 End=17,40 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0]
Function True True - - [ValueCollection Count=0] - - [ValueCollection Count=0] Main True False Start=17,4 End=17,40 - - [ValueCollection Count=0] 0 - [ValueCollection Count=0] - [ValueCollection Count=0] diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs index 963e86d32a..0b2fc65638 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs @@ -32,7 +32,7 @@ namespace Debugger.Tests { { StartTest("FunctionLocalVariables.cs"); WaitForPause(); - ObjectDump("LocalVariables", process.SelectedStackFrame.LocalVariables); + ObjectDump("LocalVariables", process.SelectedStackFrame.GetLocalVariableValues()); process.Continue(); process.WaitForExit(); @@ -50,8 +50,7 @@ namespace Debugger.Tests { mscorlib.dll FunctionLocalVariables.exe Break - - 5 + False @@ -62,7 +61,6 @@ namespace Debugger.Tests { True 0 i - i False 0 False @@ -78,7 +76,6 @@ namespace Debugger.Tests { False S s - s False S False @@ -94,7 +91,6 @@ namespace Debugger.Tests { False args - args False {System.String[]} False @@ -110,7 +106,6 @@ namespace Debugger.Tests { False n - n True <null> False @@ -126,7 +121,6 @@ namespace Debugger.Tests { False o - o False {System.Object} False diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs index ade752ca8b..2e0a10e9b0 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionVariablesLifetime.cs @@ -51,15 +51,15 @@ namespace Debugger.Tests { StartTest("FunctionVariablesLifetime.cs"); // 1 - Enter program WaitForPause(); argument = process.SelectedStackFrame.GetArgumentValue(0); - local = process.SelectedStackFrame.LocalVariables["local"]; - @class = process.SelectedStackFrame.ContaingClassVariables["class"]; + local = process.SelectedStackFrame.GetLocalVariableValue("local"); + @class = process.SelectedStackFrame.GetThisValue().GetMemberValue("class"); ObjectDump("argument", argument); ObjectDump("local", local); ObjectDump("@class", @class); process.Continue(); // 2 - Go to the SubFunction WaitForPause(); - localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"]; + localInSubFunction = process.SelectedStackFrame.GetLocalVariableValue("localInSubFunction"); ObjectDump("argument", argument); ObjectDump("local", local); ObjectDump("@class", @class); @@ -78,7 +78,7 @@ namespace Debugger.Tests { ObjectDump("local", local); ObjectDump("@class", @class); ObjectDump("localInSubFunction", @localInSubFunction); - localInSubFunction = process.SelectedStackFrame.LocalVariables["localInSubFunction"]; + localInSubFunction = process.SelectedStackFrame.GetLocalVariableValue("localInSubFunction"); ObjectDump("localInSubFunction(new)", @localInSubFunction); process.Continue(); // 5 - Setp out of both functions @@ -114,7 +114,6 @@ namespace Debugger.Tests { True 1 argument - argument False 1 False @@ -130,7 +129,6 @@ namespace Debugger.Tests { True 2 local - local False 2 False @@ -146,7 +144,6 @@ namespace Debugger.Tests { True 3 this.class - class False 3 False @@ -163,7 +160,6 @@ namespace Debugger.Tests { argument - argument True @@ -179,7 +175,6 @@ namespace Debugger.Tests { local - local True @@ -195,7 +190,6 @@ namespace Debugger.Tests { this.class - class True @@ -211,7 +205,6 @@ namespace Debugger.Tests { True 4 localInSubFunction - localInSubFunction False 4 False @@ -228,7 +221,6 @@ namespace Debugger.Tests { argument - argument True @@ -244,7 +236,6 @@ namespace Debugger.Tests { local - local True @@ -260,7 +251,6 @@ namespace Debugger.Tests { this.class - class True @@ -276,7 +266,6 @@ namespace Debugger.Tests { localInSubFunction - localInSubFunction True @@ -293,7 +282,6 @@ namespace Debugger.Tests { argument - argument True @@ -309,7 +297,6 @@ namespace Debugger.Tests { local - local True @@ -325,7 +312,6 @@ namespace Debugger.Tests { this.class - class True @@ -341,7 +327,6 @@ namespace Debugger.Tests { localInSubFunction - localInSubFunction True @@ -357,7 +342,6 @@ namespace Debugger.Tests { True 4 localInSubFunction - localInSubFunction False 4 False @@ -374,7 +358,6 @@ namespace Debugger.Tests { argument - argument True @@ -390,7 +373,6 @@ namespace Debugger.Tests { local - local True @@ -406,7 +388,6 @@ namespace Debugger.Tests { this.class - class True @@ -422,7 +403,6 @@ namespace Debugger.Tests { localInSubFunction - localInSubFunction True diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs index 0cf02c815f..122f261f56 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/GenericDictionary.cs @@ -32,8 +32,8 @@ namespace Debugger.Tests { { StartTest("GenericDictionary.cs"); WaitForPause(); - ObjectDump("dict", process.SelectedStackFrame.LocalVariables["dict"]); - ObjectDump("dict members", process.SelectedStackFrame.LocalVariables["dict"].GetMemberValues(null, BindingFlags.All)); + ObjectDump("dict", process.SelectedStackFrame.GetLocalVariableValue("dict")); + ObjectDump("dict members", process.SelectedStackFrame.GetLocalVariableValue("dict").GetMemberValues(null, BindingFlags.All)); process.Continue(); process.WaitForExit(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs index 42ab3c7f08..6ade35655e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Generics.cs @@ -147,45 +147,7 @@ namespace Debugger.Tests { True False Start=36,4 End=36,40 - this = {Debugger.Tests.TestPrograms.GenericClass<System.Int32,System.String>} - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -214,45 +176,7 @@ namespace Debugger.Tests { True False Start=42,4 End=42,40 - this = {Debugger.Tests.TestPrograms.GenericClass<System.Int32,System.String>} - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -281,45 +205,7 @@ namespace Debugger.Tests { True False Start=48,4 End=48,40 - - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -348,45 +234,7 @@ namespace Debugger.Tests { True False Start=54,4 End=54,40 - - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -415,45 +263,7 @@ namespace Debugger.Tests { True False Start=63,4 End=63,40 - this = {Debugger.Tests.TestPrograms.GenericStruct<System.Int32,System.String>} - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -482,45 +292,7 @@ namespace Debugger.Tests { True False Start=69,4 End=69,40 - this = {Debugger.Tests.TestPrograms.GenericStruct<System.Int32,System.String>} - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -549,45 +321,7 @@ namespace Debugger.Tests { True False Start=75,4 End=75,40 - - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break @@ -616,45 +350,7 @@ namespace Debugger.Tests { True False Start=81,4 End=81,40 - - [ValueCollection Count=0] 2 - - 2 - - False - - - - False - True - True - 1 - v - v - False - 1 - False - System.Int32 - - - False - - - - False - True - False - 1! - k - k - False - 1! - False - System.String - - - [ValueCollection Count=0] Break diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/MetadataIdentity.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/MetadataIdentity.cs index 5d080ca294..8662f5902c 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/MetadataIdentity.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/MetadataIdentity.cs @@ -36,12 +36,12 @@ namespace Debugger.Tests { StartTest("MetadataIdentity.cs"); WaitForPause(); - DebugType type = process.SelectedStackFrame.ThisValue.Type; + DebugType type = process.SelectedStackFrame.GetThisValue().Type; MethodInfo mainMethod = process.SelectedStackFrame.MethodInfo; process.Continue(); WaitForPause(); - Assert.AreEqual(type, process.SelectedStackFrame.ThisValue.Type); + Assert.AreEqual(type, process.SelectedStackFrame.GetThisValue().Type); Assert.AreEqual(mainMethod, process.SelectedStackFrame.MethodInfo); process.Continue(); process.WaitForExit(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs index de7859990a..1853879af5 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ObjectValue.cs @@ -47,7 +47,7 @@ namespace Debugger.Tests { StartTest("ObjectValue.cs"); WaitForPause(); - val = process.SelectedStackFrame.LocalVariables["val"]; + val = process.SelectedStackFrame.GetLocalVariableValue("val"); ObjectDump("val", val); ObjectDump("val members", val.GetMemberValues(null, Debugger.BindingFlags.All)); //ObjectDump("typeof(val)", val.Type); diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs index 54e222559b..8964e44331 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/ValueType.cs @@ -37,7 +37,7 @@ namespace Debugger.Tests { StartTest("ValueType.cs"); WaitForPause(); - ObjectDump("this", process.SelectedStackFrame.ThisValue); + ObjectDump("this", process.SelectedStackFrame.GetThisValue()); process.Continue(); process.WaitForExit(); CheckXmlOutput(); @@ -64,7 +64,6 @@ namespace Debugger.Tests { False this - this False {Debugger.Tests.ValueType} False