Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jestedfa@microsoft.com>2020-02-11 04:55:56 +0300
committerJeffrey Stedfast <jestedfa@microsoft.com>2020-02-11 05:10:48 +0300
commit1d05b7038f38efdf26b753bc9dd8e987a15fbfd2 (patch)
treead27f7eed0a48c29e69253a8a683236c9acfb022 /UnitTests
parent16894129caef1e091852780205e1fe2bcf052639 (diff)
[UnitTests] Added helper GetAllLocalsSync() method
This change effectively just makes sure that all of the Local Variable objects are fetched synchronously. When a debugger backend's GetAllLocals() implementation returns an EvalutingGroup dummy variable so that the local variables can be fetched asynchronously, the new GetAllLocalsSync() method will evaluate & replace that EvaluatingGroup dummy variable with the real list of local variables that the unit tests expect to find.
Diffstat (limited to 'UnitTests')
-rw-r--r--UnitTests/Mono.Debugging.Tests/Shared/AdvancedEvaluationTests.cs6
-rw-r--r--UnitTests/Mono.Debugging.Tests/Shared/DebugTests.cs15
2 files changed, 18 insertions, 3 deletions
diff --git a/UnitTests/Mono.Debugging.Tests/Shared/AdvancedEvaluationTests.cs b/UnitTests/Mono.Debugging.Tests/Shared/AdvancedEvaluationTests.cs
index 9fd0a9b..c0a777c 100644
--- a/UnitTests/Mono.Debugging.Tests/Shared/AdvancedEvaluationTests.cs
+++ b/UnitTests/Mono.Debugging.Tests/Shared/AdvancedEvaluationTests.cs
@@ -106,7 +106,7 @@ namespace Mono.Debugging.Tests
Assert.AreEqual ("23", val.Value);
var frame = Session.ActiveThread.Backtrace.GetFrame (0);
- var locals = frame.GetAllLocals ();
+ var locals = frame.GetAllLocalsSync ();
Assert.AreEqual (4, locals.Length);
val = locals.Single (l => l.Name == "a");
@@ -139,7 +139,7 @@ namespace Mono.Debugging.Tests
Assert.AreEqual ("17", val.Value);
var frame = Session.ActiveThread.Backtrace.GetFrame (0);
- var locals = frame.GetAllLocals ();
+ var locals = frame.GetAllLocalsSync ();
Assert.AreEqual (3, locals.Length);
val = locals.Single (l => l.Name == "a");
@@ -168,7 +168,7 @@ namespace Mono.Debugging.Tests
Assert.AreEqual ("5", val.Value);
var frame = Session.ActiveThread.Backtrace.GetFrame (0);
- var locals = frame.GetAllLocals ();
+ var locals = frame.GetAllLocalsSync ();
Assert.AreEqual (2, locals.Length);
val = locals.Single (l => l.Name == "a");
diff --git a/UnitTests/Mono.Debugging.Tests/Shared/DebugTests.cs b/UnitTests/Mono.Debugging.Tests/Shared/DebugTests.cs
index 911f910..f84f240 100644
--- a/UnitTests/Mono.Debugging.Tests/Shared/DebugTests.cs
+++ b/UnitTests/Mono.Debugging.Tests/Shared/DebugTests.cs
@@ -468,5 +468,20 @@ namespace Mono.Debugging.Tests
}
return children;
}
+
+ public static ObjectValue[] GetAllLocalsSync(this StackFrame frame)
+ {
+ var locals = new List<ObjectValue> ();
+ var values = frame.GetAllLocals ();
+ for (int i = 0; i < values.Length; i++) {
+ var value = values[i].Sync ();
+
+ if (value.IsEvaluatingGroup)
+ locals.AddRange (value.GetAllChildrenSync ());
+ else
+ locals.Add (value);
+ }
+ return locals.ToArray ();
+ }
}
}