[sdb] Add an attach test, not yet enabled.
[mono.git] / mcs / class / Mono.Debugger.Soft / Test / dtest-app.cs
index 6cfa088437f573e3dab5e173033573e87ecfb7bc..400b43ce34f599f808362bdbeaaac26778451e68 100644 (file)
@@ -13,7 +13,6 @@ using System.Threading.Tasks;
 using System.Collections.Generic;
 using System.Linq;
 using System.Net.Sockets;
-using System.Threading.Tasks;
 using MonoTests.Helpers;
 
 public class TestsBase
@@ -319,6 +318,10 @@ public class Tests : TestsBase, ITest2
                        threadpool_io ();
                        return 0;
                }
+               if (args.Length > 0 && args [0] == "attach") {
+                       new Tests ().attach ();
+                       return 0;
+               }
                assembly_load ();
                breakpoints ();
                single_stepping ();
@@ -1688,6 +1691,26 @@ public class Tests : TestsBase, ITest2
                streamOut.Close ();
                var bsIn = t.Result;
        }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public void attach_break () {
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public void attach () {
+               AppDomain domain = AppDomain.CreateDomain ("domain");
+
+               CrossDomain o = (CrossDomain)domain.CreateInstanceAndUnwrap (
+                                  typeof (CrossDomain).Assembly.FullName, "CrossDomain");
+               o.assembly_load ();
+               o.type_load ();
+
+               // Wait for the client to attach
+               while (true) {
+                       Thread.Sleep (200);
+                       attach_break ();
+               }
+       }
 }
 
 public class SentinelClass : MarshalByRefObject {
@@ -1712,6 +1735,11 @@ public class CrossDomain : MarshalByRefObject
        public void assembly_load () {
                Tests.assembly_load_in_domain ();
        }
+
+       public void type_load () {
+               //Activator.CreateInstance (typeof (int).Assembly.GetType ("Microsoft.Win32.RegistryOptions"));
+               var is_server = System.Runtime.GCSettings.IsServerGC;
+       }
 }      
 
 public class Foo