From 62bb8ba0895bc4669a3f7f13732297c0c6a4e0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Tue, 1 Jan 2008 23:48:14 +0000 Subject: [PATCH] Preparing to remove ValueCollection git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2776 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Variables/ValueItem.cs | 2 +- .../Project/Debugger.Core.csproj | 3 +- .../Project/Src/Threads/Function.cs | 24 +----- .../Project/Src/Threads/Process.cs | 6 +- .../Project/Src/Variables/Values/Value.cs | 11 +-- .../Src/Variables/Values/ValueCollection.cs | 84 ++----------------- .../Project/Debugger.Tests.csproj | 1 - .../Project/Src/DebuggerTests.cs | 2 +- 8 files changed, 12 insertions(+), 121 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs index d44648db13..b2cb7416ca 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs @@ -79,7 +79,7 @@ namespace Debugger public override string Name { get { - return val.Name; + return string.Empty; // TODO } } 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 617b87797a..6c84b4a2df 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -225,13 +225,12 @@ - - + diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs index 9667494aa2..57536346d6 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs @@ -379,25 +379,6 @@ namespace Debugger } } - /// Gets value of given name which is accessible from this function - /// 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 function. /// That is, arguments, local variables and varables of the containing class. @@ -565,9 +546,8 @@ namespace Debugger if (symMethod != null) { // TODO: Is this needed? ISymUnmanagedScope symRootScope = symMethod.RootScope; foreach(Value var in GetLocalVariablesInScope(symRootScope)) { - if (!var.Name.StartsWith("CS$")) { // TODO: Generalize - yield return var; - } + // TODO: Compiler generated variables + yield return var; } } } 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 013802ce79..d36fe557a5 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 @@ -254,11 +254,7 @@ namespace Debugger /// Null if not found public Value GetValue(string name) { - if (SelectedFunction == null || IsRunning) { - return null; - } else { - return SelectedFunction.GetValue(name); - } + return null; // TODO } } } 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 1218a4b8a2..ff241199b0 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 @@ -81,8 +81,7 @@ namespace Debugger if (IsPrimitive) cache.AsString = PrimitiveValue != null ? PrimitiveValue.ToString() : String.Empty; TimeSpan totalTime = Util.HighPrecisionTimer.Now - startTime; - string name = this is Value ? ((Value)this).Name + " = " : String.Empty; - process.TraceMessage("Obtained value: " + name + cache.AsString + " (" + totalTime.TotalMilliseconds + " ms)"); + process.TraceMessage("Obtained value: " + cache.AsString + " (" + totalTime.TotalMilliseconds + " ms)"); } return cache; } @@ -163,14 +162,6 @@ namespace Debugger this.process = process; this.corValueGetter = corValueGetter; - // TODO: clean up - if (name.StartsWith("<") && name.Contains(">") && name != "") { - string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>' - if (middle != "") { - this.name = middle; - } - } - process.DebuggingResumed += delegate { this.isExpired = true; OnExpired(EventArgs.Empty); 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 index afb8fbb762..9b68b8fa12 100644 --- 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 @@ -12,89 +12,15 @@ using System.Collections.Generic; namespace Debugger { /// - /// An enumerable collection of values accessible by name. + /// An enumerable collection of values /// - public class ValueCollection: DebuggerObject, IEnumerable, IEnumerable + public class ValueCollection: List { - internal static ValueCollection Empty = new ValueCollection(new Value[0]); + public 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) + public ValueCollection(IEnumerable values):base(values) { - 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"); - } + } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj index 101c5da720..b83e33e3af 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj @@ -38,7 +38,6 @@ - diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs index 63522c8bdc..80e01cb6e4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs @@ -20,7 +20,7 @@ using System.Threading; namespace Debugger.Tests { - //[TestFixture] + [TestFixture] public class DebuggerTests: DebuggerTestsBase { [Test]