Browse Source

Added debugger test: FunctionLocalVariables

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@866 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
fc5718d45b
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  3. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Debugger.Tests.csproj
  4. 31
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTests.cs
  5. 1
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs
  6. 28
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -103,8 +103,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -103,8 +103,6 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
public static void AddVariableToTree(Variable variableToAdd, TreeListViewItemCollection tree)
{
if (variableToAdd.Name.StartsWith("CS$")) return;
TreeListViewDebuggerItem newItem = new TreeListViewDebuggerItem(variableToAdd);
tree.Add(newItem);

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

@ -476,7 +476,9 @@ namespace Debugger @@ -476,7 +476,9 @@ namespace Debugger
if (symMethod != null) { // TODO: Is this needed?
ISymbolScope symRootScope = symMethod.RootScope;
foreach(Variable var in GetLocalVariablesInScope(symRootScope)) {
yield return var;
if (!var.Name.StartsWith("CS$")) { // TODO: Generalize
yield return var;
}
}
}
}

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

@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
<Compile Include="Src\TestPrograms\Stepping.cs" />
<Compile Include="Src\TestPrograms\Callstack.cs" />
<Compile Include="Src\TestPrograms\FunctionArgumentVariables.cs" />
<Compile Include="Src\TestPrograms\FunctionLocalVariables.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src" />

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

@ -277,5 +277,36 @@ namespace Debugger.Tests @@ -277,5 +277,36 @@ namespace Debugger.Tests
debugger.Continue();
debugger.WaitForPrecessExit();
}
[Test]
public void FunctionLocalVariables()
{
List<Variable> args;
StartProgram("FunctionLocalVariables");
WaitForPause(PausedReason.Break, null);
args = new List<Variable>(debugger.CurrentFunction.LocalVariables);
// Argument names
Assert.AreEqual("i", args[0].Name);
Assert.AreEqual("s", args[1].Name);
Assert.AreEqual("args", args[2].Name);
Assert.AreEqual("n", args[3].Name);
Assert.AreEqual("o", args[4].Name);
// Argument types
Assert.AreEqual(typeof(PrimitiveValue), args[0].Value.GetType());
Assert.AreEqual(typeof(PrimitiveValue), args[1].Value.GetType());
Assert.AreEqual(typeof(ArrayValue), args[2].Value.GetType());
Assert.AreEqual(typeof(NullValue), args[3].Value.GetType());
Assert.AreEqual(typeof(ObjectValue), args[4].Value.GetType());
// Argument values
Assert.AreEqual("0", args[0].Value.AsString);
Assert.AreEqual("S", args[1].Value.AsString);
Assert.AreEqual(1 ,((ArrayValue)args[2].Value).Lenght);
Assert.IsNotNull(args[3].Value.AsString);
Assert.AreEqual("{System.Object}", args[4].Value.AsString);
debugger.Continue();
debugger.WaitForPrecessExit();
}
}
}

1
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestProgram.cs

@ -24,6 +24,7 @@ namespace Debugger.Tests @@ -24,6 +24,7 @@ namespace Debugger.Tests
case "Callstack": Progs.Callstack.Main(); break;
case "FileRelease": Progs.FileRelease.Main(); break;
case "FunctionArgumentVariables": Progs.FunctionArgumentVariables.Main(); break;
case "FunctionLocalVariables": Progs.FunctionLocalVariables.Main(); break;
case "HelloWorld": Progs.HelloWorld.Main(); break;
case "SimpleProgram": Progs.SimpleProgram.Main(); break;
case "Stepping": Progs.Stepping.Main(); break;

28
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/FunctionLocalVariables.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
#pragma warning disable 0219
namespace Debugger.Tests.TestPrograms
{
public class FunctionLocalVariables
{
public static void Main()
{
int i = 0;
string s = "S";
string[] args = new string[] {"p1"};
object n = null;
object o = new object();
System.Diagnostics.Debugger.Break();
}
}
}
#pragma warning restore 0219
Loading…
Cancel
Save