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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThays Grazia <thaystg@gmail.com>2019-09-24 00:16:59 +0300
committerGitHub <noreply@github.com>2019-09-24 00:16:59 +0300
commit7e6d863686af20509f4a0dc7cd4fca351e295347 (patch)
tree6b7d02cd981e39d33c32534ddcb1555854b6235e /mcs/class/Mono.Debugger.Soft
parent9b98db9ca949bbb706a3d647662985347816d9f7 (diff)
[debugger] New way to filter exceptions to support VSWin features (#16825)
* Creating a new version of MOD_KIND_EXCEPTION_ONLY to support VsWin features, discussed with Joaquin Jares. Because we don't have this functionality of get every other exception that is not specified, VsWin was getting every exception and filtering later. But this causes a slowness during the debugger because we stop all thread on each exception that we get, even if they are caught and we don't want to stop. * Fixing other unit test because now we have 2 nested classes. Fixing indentation. * Creating a flag in the MOD_KIND_EXCEPTION_ONLY protocol event and not creating a new protocol event. * Changing what was suggested by Zoltan. * Coding style * Bump API snapshot submodule
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs13
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ExceptionEventRequest.cs8
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs7
-rw-r--r--mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs57
-rw-r--r--mcs/class/Mono.Debugger.Soft/Test/dtest.cs42
5 files changed, 122 insertions, 5 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
index febf383b2a2..7e895773bc2 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
@@ -307,8 +307,15 @@ namespace Mono.Debugger.Soft
public bool Subclasses {
get; set;
}
+ public bool NotFilteredFeature {
+ get; set;
+ }
+ public bool EverythingElse {
+ get; set;
+ }
}
+
class AssemblyModifier : Modifier {
public long[] Assemblies {
get; set;
@@ -429,7 +436,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
- internal const int MINOR_VERSION = 53;
+ internal const int MINOR_VERSION = 54;
enum WPSuspendPolicy {
NONE = 0,
@@ -2632,6 +2639,10 @@ namespace Mono.Debugger.Soft
} else if (!em.Subclasses) {
throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
}
+ if (Version.MajorVersion > 2 || Version.MinorVersion >= 54) {
+ w.WriteBool (em.NotFilteredFeature);
+ w.WriteBool (em.EverythingElse);
+ }
} else if (mod is AssemblyModifier) {
w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
var amod = (mod as AssemblyModifier);
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ExceptionEventRequest.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ExceptionEventRequest.cs
index 906b43fd839..869bd5f23c6 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ExceptionEventRequest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ExceptionEventRequest.cs
@@ -6,9 +6,9 @@ namespace Mono.Debugger.Soft
public sealed class ExceptionEventRequest : EventRequest {
TypeMirror exc_type;
- bool caught, uncaught, subclasses;
+ bool caught, uncaught, subclasses, not_filtered_feature, everything_else;
- internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught) : base (vm, EventType.Exception) {
+ internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught, bool not_filtered_feature = false, bool everything_else = false) : base (vm, EventType.Exception) {
if (exc_type != null) {
CheckMirror (vm, exc_type);
TypeMirror exception_type = vm.RootDomain.Corlib.GetType ("System.Exception", false, false);
@@ -19,6 +19,8 @@ namespace Mono.Debugger.Soft
this.caught = caught;
this.uncaught = uncaught;
this.subclasses = true;
+ this.not_filtered_feature = not_filtered_feature;
+ this.everything_else = everything_else;
}
public TypeMirror ExceptionType {
@@ -41,7 +43,7 @@ namespace Mono.Debugger.Soft
public override void Enable () {
var mods = new List <Modifier> ();
- mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses });
+ mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses, NotFilteredFeature = not_filtered_feature, EverythingElse = everything_else });
SendReq (mods);
}
}
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
index 8cbe54a697c..1912626d228 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs
@@ -277,6 +277,13 @@ namespace Mono.Debugger.Soft
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
}
+ public ExceptionEventRequest CreateExceptionRequest (TypeMirror exc_type, bool caught, bool uncaught, bool everything_else) {
+ if (Version.AtLeast (2, 54))
+ return new ExceptionEventRequest (this, exc_type, caught, uncaught, true, everything_else);
+ else
+ return new ExceptionEventRequest (this, exc_type, caught, uncaught);
+ }
+
public AssemblyLoadEventRequest CreateAssemblyLoadRequest () {
return new AssemblyLoadEventRequest (this);
}
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
index d6894d3ca92..37dd0e3e6ad 100644
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
@@ -584,6 +584,7 @@ public class Tests : TestsBase, ITest2
inspect_enumerator_in_generic_struct();
if_property_stepping();
fixed_size_array();
+ test_new_exception_filter();
return 3;
}
@@ -595,6 +596,11 @@ public class Tests : TestsBase, ITest2
}
}
+ public class MyException : Exception {
+ public MyException(string message) : base(message) {
+ }
+ }
+
public static void if_property_stepping() {
var test = new TestClass();
if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")
@@ -828,6 +834,57 @@ public class Tests : TestsBase, ITest2
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void test_new_exception_filter () {
+ test_new_exception_filter1();
+ test_new_exception_filter2();
+ test_new_exception_filter3();
+ test_new_exception_filter4();
+ }
+
+
+ public static void test_new_exception_filter1 () {
+ try {
+ throw new Exception("excp");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public static void test_new_exception_filter2 () {
+ try {
+ throw new MyException("excp");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public static void test_new_exception_filter3 () {
+ try {
+ throw new ArgumentException();
+ }
+ catch (Exception e) {
+ }
+ try {
+ throw new Exception("excp");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ public static void test_new_exception_filter4 () {
+ try {
+ throw new ArgumentException();
+ }
+ catch (Exception e) {
+ }
+ try {
+ throw new Exception("excp");
+ }
+ catch (Exception e) {
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void inspect_enumerator_in_generic_struct() {
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
}
diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
index 177b80867d6..7e066570d5a 100644
--- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
+++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs
@@ -1767,7 +1767,7 @@ public class DebuggerTests
t = frame.Method.GetParameters ()[7].ParameterType;
Assert.AreEqual ("Tests", t.Name);
var nested = (from nt in t.GetNestedTypes () where nt.IsNestedPublic select nt).ToArray ();
- Assert.AreEqual (1, nested.Length);
+ Assert.AreEqual (2, nested.Length);
Assert.AreEqual ("NestedClass", nested [0].Name);
Assert.IsTrue (t.BaseType.IsAssignableFrom (t));
Assert.IsTrue (!t.IsAssignableFrom (t.BaseType));
@@ -5085,6 +5085,46 @@ public class DebuggerTests
Assert.AreEqual("d", min.Value);
}
+ [Test]
+ public void TestExceptionFilterWin () {
+ Event e = run_until ("test_new_exception_filter1");
+ var req2 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.Exception"), true, true, false);
+ req2.Enable ();
+ vm.Resume ();
+ Event ev = GetNextEvent ();
+ var l = ev.Thread.GetFrames ()[0].Location;
+
+ Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
+ req2.Disable ();
+ run_until ("test_new_exception_filter2");
+ req2 = vm.CreateExceptionRequest (null, true, true, false);
+ req2.Enable ();
+ vm.Resume ();
+ ev = GetNextEvent ();
+
+ Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
+ req2.Disable ();
+ run_until ("test_new_exception_filter3");
+ var req3 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.ArgumentException"), false, true, false);
+ req3.Enable ();
+ req2 = vm.CreateExceptionRequest (null, true, true, true);
+ req2.Enable ();
+ vm.Resume ();
+ ev = GetNextEvent ();
+
+ Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
+ req2.Disable ();
+ req3.Disable ();
+ run_until ("test_new_exception_filter4");
+ req2 = vm.CreateExceptionRequest (null, true, true, true);
+ req2.Enable ();
+ req2 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.ArgumentException"), false, true, false);
+ req2.Enable ();
+ vm.Resume ();
+ ev = GetNextEvent ();
+ }
+
+
#endif
} // class DebuggerTests
} // namespace