MethodMirror m = entry_point.DeclaringType.Assembly.GetType ("LocalReflectClass").GetMethod ("RunMe");
Assert.IsNotNull (m);
- //Console.WriteLine ("X: " + name + " " + m.ILOffsets.Count + " " + m.Locations.Count);
+
+// foreach (var x in m.Locations) {
+// Console.WriteLine (x);
+// }
+
var offset = -1;
int method_base_linum = m.Locations [0].LineNumber;
foreach (var location in m.Locations)
e = single_step (e.Thread);
var frame = e.Thread.GetFrames ()[0];
- Value variable = frame.GetValue (frame.Method.GetLocal ("reflectMe"));
+
+ Assert.IsNotNull (frame);
+ var field = frame.Method.GetLocal ("reflectMe");
+ Assert.IsNotNull (field);
+ Value variable = frame.GetValue (field);
ObjectMirror thisObj = (ObjectMirror)variable;
TypeMirror thisType = thisObj.Type;
}
[Test]
+ [Category ("NotWorking")] // https://bugzilla.xamarin.com/show_bug.cgi?id=44974
public void SingleStepping () {
Event e = run_until ("single_stepping");
req.Disable ();
}
+ [Test]
+ public void SingleSteppingNoFrames () {
+ //
+ // Test what happens when starting a single step operation on a thread
+ // with no managed frames
+ //
+ // Run a delegate on a tp thread
+ var e = run_until ("ss_no_frames_2");
+
+ var this_type = e.Thread.GetFrames ()[0].Method.DeclaringType;
+ this_type.SetValue (this_type.GetField ("static_i"), vm.CreateValue (56));
+
+ var thread = e.Thread;
+ var e2 = run_until ("ss_no_frames_3");
+ // The tp thread should be idle now
+ step_req = vm.CreateStepRequest (thread);
+ step_req.Depth = StepDepth.Over;
+ AssertThrows<Exception> (delegate {
+ step_req.Enable ();
+ });
+ }
+
[Test]
public void MethodEntryExit () {
run_until ("single_stepping");
AssertValue ("T", s ["s"]);
AssertValue (45, s ["k"]);
+ // Test SetThis ()
+ s ["i"] = vm.CreateValue (55);
+ frame.SetThis (s);
+ obj = frame.GetThis ();
+ Assert.IsTrue (obj is StructMirror);
+ s = obj as StructMirror;
+ AssertValue (55, s ["i"]);
+ AssertValue ("T", s ["s"]);
+ AssertValue (45, s ["k"]);
+
// this on static vtype methods
e = run_until ("vtypes3");
e = step_until (e.Thread, "static_foo");
vm.Resume ();
e = GetNextEvent ();
if (e is AssemblyUnloadEvent) {
+ AssertThrows<Exception> (delegate () {
+ var assembly_obj = (e as AssemblyUnloadEvent).Assembly.GetAssemblyObject ();
+ });
continue;
} else {
break;
return;
string srcfile = (e as BreakpointEvent).Method.DeclaringType.GetSourceFiles (true)[0];
+ srcfile = srcfile.Replace ("dtest-app.cs", "TypeLoadClass.cs");
+ Assert.IsTrue (srcfile.Contains ("TypeLoadClass.cs"));
var req = vm.CreateTypeLoadRequest ();
req.SourceFileFilter = new string [] { srcfile.ToUpper () };
req.Disable ();
var frames = e.Thread.GetFrames ();
var locs = frames [0].Method.Locations;
- var next_loc = locs.First (l => (l.LineNumber == frames [0].Location.LineNumber + 2));
+
+ var next_loc = locs.First (l => (l.LineNumber == frames [0].Location.LineNumber + 3));
e.Thread.SetIP (next_loc);
req.Disable ();
var frames = e.Thread.GetFrames ();
var locs = frames [0].Method.Locations;
- var prev_loc = locs.First (l => (l.LineNumber == frames [0].Location.LineNumber - 3));
+ var prev_loc = locs.First (l => (l.LineNumber == frames [0].Location.LineNumber - 1));
AssertValue (2, frames [0].GetValue (frames [0].Method.GetLocal ("i")));
// Set back the ip to the first i ++; line