Browse Source

Preparing to remove ValueCollection

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2776 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
62bb8ba089
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs
  2. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  3. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  4. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs
  5. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs
  6. 84
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs
  7. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  8. 2
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs

@ -79,7 +79,7 @@ namespace Debugger @@ -79,7 +79,7 @@ namespace Debugger
public override string Name {
get {
return val.Name;
return string.Empty; // TODO
}
}

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

@ -225,13 +225,12 @@ @@ -225,13 +225,12 @@
<Compile Include="Src\Variables\Types\MemberInfo.cs" />
<Compile Include="Src\Variables\Types\MethodInfo.cs" />
<Compile Include="Src\Variables\Types\PropertyInfo.cs" />
<Compile Include="Src\Variables\Values\ValueCollection.cs" />
<Compile Include="Src\Variables\Values\Value.Array.cs" />
<Compile Include="Src\Variables\Values\Value.Helpers.cs" />
<Compile Include="Src\Variables\Values\Value.Object.cs" />
<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\Values\ValueCollection.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" />

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

@ -379,25 +379,6 @@ namespace Debugger @@ -379,25 +379,6 @@ namespace Debugger
}
}
/// <summary> Gets value of given name which is accessible from this function </summary>
/// <returns> Null if not found </returns>
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;
}
/// <summary>
/// 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 @@ -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;
}
}
}

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Process.cs

@ -254,11 +254,7 @@ namespace Debugger @@ -254,11 +254,7 @@ namespace Debugger
/// <returns> Null if not found </returns>
public Value GetValue(string name)
{
if (SelectedFunction == null || IsRunning) {
return null;
} else {
return SelectedFunction.GetValue(name);
}
return null; // TODO
}
}
}

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

@ -81,8 +81,7 @@ namespace Debugger @@ -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 @@ -163,14 +162,6 @@ namespace Debugger
this.process = process;
this.corValueGetter = corValueGetter;
// TODO: clean up
if (name.StartsWith("<") && name.Contains(">") && name != "<Base class>") {
string middle = name.TrimStart('<').Split('>')[0]; // Get text between '<' and '>'
if (middle != "") {
this.name = middle;
}
}
process.DebuggingResumed += delegate {
this.isExpired = true;
OnExpired(EventArgs.Empty);

84
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/ValueCollection.cs

@ -12,89 +12,15 @@ using System.Collections.Generic; @@ -12,89 +12,15 @@ using System.Collections.Generic;
namespace Debugger
{
/// <summary>
/// An enumerable collection of values accessible by name.
/// An enumerable collection of values
/// </summary>
public class ValueCollection: DebuggerObject, IEnumerable<Value>, IEnumerable
public class ValueCollection: List<Value>
{
internal static ValueCollection Empty = new ValueCollection(new Value[0]);
public static ValueCollection Empty = new ValueCollection(new Value[0]);
List<Value> list = new List<Value>();
Dictionary<string, List<Value>> hashtable = new Dictionary<string, List<Value>>();
IEnumerator<Value> IEnumerable<Value>.GetEnumerator()
{
foreach(Value namedValue in list) {
yield return namedValue;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
foreach(Value namedValue in list) {
yield return namedValue;
}
}
internal ValueCollection(IEnumerable<Value> namedValues)
{
foreach(Value namedValue in namedValues) {
string name = namedValue.Name;
if (hashtable.ContainsKey(name)) {
hashtable[name].Add(namedValue);
} else {
hashtable[name] = new List<Value>(new Value[] {namedValue});
}
list.Add(namedValue);
}
}
/// <summary>
/// Gets a value indicating whether the collection contains a
/// value with a given name
/// </summary>
public bool Contains(string name)
public ValueCollection(IEnumerable<Value> values):base(values)
{
return hashtable.ContainsKey(name);
}
/// <summary>
/// Gets number of <see cref="Debugger.NamedValue">named values</see> contained in the collection
/// </summary>
public int Count {
get {
return list.Count;
}
}
/// <summary>
/// Gets a value by index
/// </summary>
public Value this[int i] {
get {
return list[i];
}
}
/// <summary>
/// Gets a value by its name.
/// </summary>
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");
}
}
}
}

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj

@ -38,7 +38,6 @@ @@ -38,7 +38,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\DebuggerTests.cs" />
<Compile Include="Src\DebuggerTestsBase.cs" />
<Compile Include="Src\TestPrograms\Exception.cs" />
<Compile Include="Src\TestPrograms\ExceptionCustom.cs" />

2
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs

@ -20,7 +20,7 @@ using System.Threading; @@ -20,7 +20,7 @@ using System.Threading;
namespace Debugger.Tests
{
//[TestFixture]
[TestFixture]
public class DebuggerTests: DebuggerTestsBase
{
[Test]

Loading…
Cancel
Save