[sdb] Fix invokes to string ctors. Fixes #57197.
authorZoltan Varga <vargaz@gmail.com>
Sat, 17 Jun 2017 05:32:34 +0000 (01:32 -0400)
committerZoltan Varga <vargaz@gmail.com>
Sat, 17 Jun 2017 05:32:34 +0000 (01:32 -0400)
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mono/mini/debugger-agent.c

index 7a16e5dcb83b1927bff434a6abb6604646d2845e..671293df18574599f9d98298adaabbb04fed78b2 100644 (file)
@@ -2640,19 +2640,6 @@ public class DebuggerTests
                v = this_obj.InvokeMethod (e.Thread, m, new Value [] { s });
                AssertValue (2, v);
 
-               return;
-
-               // string constructor
-               var stringType = vm.RootDomain.Corlib.GetType ("System.String");
-               var stringConstructor = stringType.GetMethods ().Single (c=>
-                       c.Name == ".ctor" &&
-                       c.GetParameters ().Length == 2 &&
-                       c.GetParameters ()[0].ParameterType.Name == "Char" &&
-                       c.GetParameters ()[1].ParameterType.Name == "Int32");
-               var str = stringType.NewInstance (e.Thread, stringConstructor,  new Value [] { vm.CreateValue ('a'), vm.CreateValue (3)});
-
-               AssertValue("aaa", str);
-
                // pass primitive
                m = t.GetMethod ("invoke_pass_primitive");
                Value[] args = new Value [] {
@@ -2746,6 +2733,17 @@ public class DebuggerTests
                task = t.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
                AssertValue ("ABC", task.Result);
 
+               // string constructor
+               var stringType = vm.RootDomain.Corlib.GetType ("System.String");
+               var stringConstructor = stringType.GetMethods ().Single (c=>
+                       c.Name == ".ctor" &&
+                       c.GetParameters ().Length == 2 &&
+                       c.GetParameters ()[0].ParameterType.Name == "Char" &&
+                       c.GetParameters ()[1].ParameterType.Name == "Int32");
+               var str = stringType.NewInstance (e.Thread, stringConstructor,  new Value [] { vm.CreateValue ('a'), vm.CreateValue (3)});
+
+               AssertValue("aaa", str);
+
                // Argument checking
                
                // null thread
index 88b1b18b68b8e0492dc328d8b4347d14843a43b8..b887931ac0e37c068ecbe2fd58899c7e60c2dd04 100644 (file)
@@ -7159,7 +7159,9 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8
                if ((invoke->flags & INVOKE_FLAG_RETURN_OUT_ARGS) && CHECK_PROTOCOL_VERSION (2, 35))
                        out_args = TRUE;
                buffer_add_byte (buf, 1 + (out_this ? 2 : 0) + (out_args ? 4 : 0));
-               if (sig->ret->type == MONO_TYPE_VOID) {
+               if (m->string_ctor) {
+                       buffer_add_value (buf, &mono_get_string_class ()->byval_arg, &res, domain);
+               } else if (sig->ret->type == MONO_TYPE_VOID && !m->string_ctor) {
                        if (!strcmp (m->name, ".ctor")) {
                                if (!m->klass->valuetype)
                                        buffer_add_value (buf, &mono_defaults.object_class->byval_arg, &this_arg, domain);