Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -307,6 +307,7 @@ public class Tests : TestsBase, ITest2
regress ();
gc_suspend ();
set_ip ();
step_filters ();
if (args.Length > 0 && args [0] == "domain-test")
/* This takes a lot of time, so execute it conditionally */
domains ();
@@ -1162,6 +1163,12 @@ public class Tests : TestsBase, ITest2
AppDomain.Unload (domain);
domains_3 ();
typeof (Tests).GetMethod ("called_from_invoke").Invoke (null, null);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void called_from_invoke () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
@@ -1361,15 +1368,33 @@ public class Tests : TestsBase, ITest2
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void set_ip () {
int i, j;
int i = 0, j;
i = 1;
i ++;
i ++;
set_ip_1 ();
i = 5;
i ++;
j = 5;
set_ip_2 ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void step_filters () {
ClassWithCctor.cctor_filter ();
}
class ClassWithCctor {
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static ClassWithCctor () {
int i = 1;
int j = 2;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void cctor_filter () {
}
}
public override string virtual_method () {
return "V2";
}

View File

@@ -420,6 +420,10 @@ public class DebuggerTests
e = step_out ();
assert_location (e, "single_stepping");
// Step into next line
e = step_into ();
assert_location (e, "single_stepping");
// Step into ss3_2 ()
e = step_into ();
assert_location (e, "ss3_2");
@@ -2142,6 +2146,11 @@ public class DebuggerTests
v = this_obj.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
AssertValue ("V2", v);
// virtual call on static method
m = t.GetMethod ("invoke_static_pass_ref");
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") }, InvokeOptions.Virtual);
AssertValue ("ABC", v);
#if NET_4_5
// instance
m = t.GetMethod ("invoke_pass_ref");
@@ -2912,6 +2921,13 @@ public class DebuggerTests
AssertThrows<Exception> (delegate {
d_method.DeclaringType.GetValue (d_method.DeclaringType.GetField ("static_i"));
});
// Check that .Domain is accessible for stack frames with native transitions
e = run_until ("called_from_invoke");
ThreadMirror.NativeTransitions = true;
foreach (var f in e.Thread.GetFrames ()) {
var dom = f.Domain;
}
}
[Test]
@@ -3536,10 +3552,10 @@ public class DebuggerTests
e.Thread.SetIP (next_loc);
/* Check that i = 5; j = 5; was skipped */
/* Check that i ++; j = 5; was skipped */
bevent = run_until ("set_ip_2");
var f = bevent.Thread.GetFrames ()[1];
AssertValue (1, f.GetValue (f.Method.GetLocal ("i")));
AssertValue (2, f.GetValue (f.Method.GetLocal ("i")));
AssertValue (0, f.GetValue (f.Method.GetLocal ("j")));
// Error handling
@@ -3552,6 +3568,32 @@ public class DebuggerTests
});
}
[Test]
public void SetIPSingleStep () {
// Check that single stepping after set-ip steps from the new ip
var bevent = run_until ("set_ip_1");
var invalid_loc = bevent.Thread.GetFrames ()[0].Location;
var req = create_step (bevent);
req.Size = StepSize.Line;
var e = step_out ();
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));
AssertValue (2, frames [0].GetValue (frames [0].Method.GetLocal ("i")));
Console.WriteLine ("X: " + frames [0].Location.LineNumber);
// Set back the ip to the first i ++; line
e.Thread.SetIP (prev_loc);
e = step_over ();
var f = e.Thread.GetFrames ()[0];
Console.WriteLine (f.GetValue (f.Method.GetLocal ("i")));
AssertValue (3, f.GetValue (f.Method.GetLocal ("i")));
}
[Test]
public void NewInstanceNoCtor () {
var bevent = run_until ("Main");
@@ -3561,6 +3603,28 @@ public class DebuggerTests
Assert.IsTrue (obj is ObjectMirror);
Assert.AreEqual ("AStruct", (obj as ObjectMirror).Type.Name);
}
[Test]
public void StaticCtorFilterInCctor () {
// Check that single stepping when in a cctor only ignores
// other cctors, not the current one
var bevent = run_until ("step_filters");
var assembly = entry_point.DeclaringType.Assembly;
var type = assembly.GetType ("Tests/ClassWithCctor");
var cctor = type.GetMethod (".cctor");
vm.SetBreakpoint (cctor, 0);
vm.Resume ();
var e = vm.GetNextEvent ();
Assert.IsTrue (e is BreakpointEvent);
var req = create_step (e);
req.Filter = StepFilter.StaticCtor;
e = step_into ();
// Make sure we are still in the cctor
Assert.AreEqual (".cctor", e.Thread.GetFrames ()[0].Location.Method.Name);
}
}
}