Merge pull request #4316 from mono/work-51562
authorMartin Baulig <martin.baulig@xamarin.com>
Thu, 2 Feb 2017 11:06:23 +0000 (12:06 +0100)
committerGitHub <noreply@github.com>
Thu, 2 Feb 2017 11:06:23 +0000 (12:06 +0100)
[btls]: Allow importing a null `byte[]`.  Fixes #51562.

mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/AssemblyMirror.cs
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mono/metadata/mono-debug-debugger.h
mono/mini/cpu-x86.md
mono/mini/debugger-agent.c
mono/mini/mini-x86.c
scripts/ci/run-jenkins.sh
scripts/ci/run-test-winaot.sh [new file with mode: 0755]

index 9b0af4c77d2d6aa0f09a12aaa2d7dacfa2ef586c..a83daab43cbfee31f48ab8f5654f196a791b03ca 100644 (file)
@@ -14,6 +14,7 @@ namespace Mono.Debugger.Soft
                ModuleMirror main_module;
                AssemblyName aname;
                AssemblyDefinition meta;
+               AppDomainMirror domain;
                Dictionary<string, long> typeCacheIgnoreCase = new Dictionary<string, long> (StringComparer.InvariantCultureIgnoreCase);
                Dictionary<string, long> typeCache = new Dictionary<string, long> ();
 
@@ -50,6 +51,17 @@ namespace Mono.Debugger.Soft
                        }
                }
 
+               // Since Protocol version 2.45
+               public AppDomainMirror Domain {
+                       get {
+                               if (domain == null) {
+                                       vm.CheckProtocolVersion (2, 45);
+                                       domain = vm.GetDomain (vm.conn.Assembly_GetIdDomain (id));
+                               }
+                               return domain;
+                       }
+               }
+
                public virtual AssemblyName GetName () {
                        if (aname == null) {
                                string name = vm.conn.Assembly_GetName (id);
index 3a1af2dc08861aba4cce94d7e7fafc0146460749..e09132e27985b8c67eb2f725f4bdb5f120c1b7b9 100644 (file)
@@ -420,7 +420,7 @@ namespace Mono.Debugger.Soft
                 * with newer runtimes, and vice versa.
                 */
                internal const int MAJOR_VERSION = 2;
-               internal const int MINOR_VERSION = 44;
+               internal const int MINOR_VERSION = 45;
 
                enum WPSuspendPolicy {
                        NONE = 0,
@@ -532,7 +532,8 @@ namespace Mono.Debugger.Soft
                        GET_MANIFEST_MODULE = 3,
                        GET_OBJECT = 4,
                        GET_TYPE = 5,
-                       GET_NAME = 6
+                       GET_NAME = 6,
+                       GET_DOMAIN = 7
                }
 
                enum CmdModule {
@@ -2114,6 +2115,10 @@ namespace Mono.Debugger.Soft
                        return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_NAME, new PacketWriter ().WriteId (id)).ReadString ();
                }
 
+               internal long Assembly_GetIdDomain (long id) {
+                       return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_DOMAIN, new PacketWriter ().WriteId (id)).ReadId ();
+               }
+
                /*
                 * TYPE
                 */
index ce74b4fd5fb3f5852c1c1aa2679e72c8af45b364..61b3e31088102e4ffffb6bdae168636c1356d2de 100644 (file)
@@ -3490,6 +3490,7 @@ public class DebuggerTests
                // d_method is from another domain
                MethodMirror d_method = (e as BreakpointEvent).Method;
                Assert.IsTrue (m != d_method);
+               Assert.AreEqual (domain, d_method.DeclaringType.Assembly.Domain);
 
                var frames = e.Thread.GetFrames ();
                Assert.AreEqual ("invoke_in_domain", frames [0].Method.Name);
index c7e5385f933a1589f0a1863f8bbfc394e89c1acf..740b2dbe6fba93ba138e1ef394a3bacb8401f63a 100644 (file)
@@ -1,9 +1,3 @@
-/*
- * This is a private header file.
- * The API in here is undocumented and may only be used by the JIT to
- * communicate with the debugger.
- */
-
 #ifndef __MONO_DEBUG_DEBUGGER_H__
 #define __MONO_DEBUG_DEBUGGER_H__
 
index df978e0ae9277944b8b5542ed56c481b53b0f82a..adecdd3837d0157643054c9aff01e7b8f87d86be 100644 (file)
@@ -66,7 +66,7 @@ break: len:1
 call: dest:a clob:c len:17
 tailcall: len:120 clob:c
 br: len:5
-seq_point: len:24 clob:c
+seq_point: len:26 clob:c
 il_seq_point: len:0
 
 int_beq: len:6
index 7b0b052f4503743808c91874901a3e239398ae27..f64481d661fc599ae756a683e236674d61ba2d7d 100644 (file)
@@ -273,7 +273,7 @@ typedef struct {
 #define HEADER_LENGTH 11
 
 #define MAJOR_VERSION 2
-#define MINOR_VERSION 44
+#define MINOR_VERSION 45
 
 typedef enum {
        CMD_SET_VM = 1,
@@ -450,7 +450,8 @@ typedef enum {
        CMD_ASSEMBLY_GET_MANIFEST_MODULE = 3,
        CMD_ASSEMBLY_GET_OBJECT = 4,
        CMD_ASSEMBLY_GET_TYPE = 5,
-       CMD_ASSEMBLY_GET_NAME = 6
+       CMD_ASSEMBLY_GET_NAME = 6,
+       CMD_ASSEMBLY_GET_DOMAIN = 7
 } CmdAssembly;
 
 typedef enum {
@@ -4019,14 +4020,41 @@ send_type_load (MonoClass *klass)
 static void
 send_types_for_domain (MonoDomain *domain, void *user_data)
 {
+       MonoDomain* old_domain;
        AgentDomainInfo *info = NULL;
 
        info = get_agent_domain_info (domain);
        g_assert (info);
+
+       old_domain = mono_domain_get ();
+
+       mono_domain_set (domain, TRUE);
        
        mono_loader_lock ();
        g_hash_table_foreach (info->loaded_classes, emit_type_load, NULL);
        mono_loader_unlock ();
+
+       mono_domain_set (old_domain, TRUE);
+}
+
+static void
+send_assemblies_for_domain (MonoDomain *domain, void *user_data)
+{
+       GSList *tmp;
+       MonoDomain* old_domain;
+
+       old_domain = mono_domain_get ();
+
+       mono_domain_set (domain, TRUE);
+
+       mono_domain_assemblies_lock (domain);
+       for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
+               MonoAssembly* ass = (MonoAssembly *)tmp->data;
+               emit_assembly_load (ass, NULL);
+       }
+       mono_domain_assemblies_unlock (domain);
+
+       mono_domain_set (old_domain, TRUE);
 }
 
 static void
@@ -7821,7 +7849,7 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
                                break;
                        case EVENT_KIND_ASSEMBLY_LOAD:
                                /* Emit load events for currently loaded assemblies */
-                               mono_assembly_foreach (emit_assembly_load, NULL);
+                               mono_domain_foreach (send_assemblies_for_domain, NULL);
                                break;
                        case EVENT_KIND_THREAD_START:
                                /* Emit start events for currently started threads */
@@ -8041,6 +8069,10 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
                mono_error_cleanup (&error);
                return err;
        }
+       case CMD_ASSEMBLY_GET_DOMAIN: {
+               buffer_add_domainid (buf, domain);
+               break;
+       }
        case CMD_ASSEMBLY_GET_TYPE: {
                MonoError error;
                char *s = decode_string (p, &p, end);
@@ -9901,7 +9933,8 @@ static const char* assembly_cmds_str[] = {
        "GET_MANIFEST_MODULE",
        "GET_OBJECT",
        "GET_TYPE",
-       "GET_NAME"
+       "GET_NAME",
+       "GET_DOMAIN"
 };
 
 static const char* module_cmds_str[] = {
index b616059dfb6d2f836b2d702ac380d3b54ddb1c6a..b85c2242c69e8fc7fb8e2b4ddfce4cb25bdcd6ab 100644 (file)
@@ -2646,9 +2646,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                /* Load ss_tramp_var */
                                /* This is equal to &ss_trampoline */
                                x86_mov_reg_membase (code, X86_ECX, var->inst_basereg, var->inst_offset, sizeof (mgreg_t));
-                               x86_alu_membase_imm (code, X86_CMP, X86_ECX, 0, 0);
+                               x86_mov_reg_membase (code, X86_ECX, X86_ECX, 0, sizeof (mgreg_t));
+                               x86_alu_reg_imm (code, X86_CMP, X86_ECX, 0);
                                br[0] = code; x86_branch8 (code, X86_CC_EQ, 0, FALSE);
-                               x86_call_membase (code, X86_ECX, 0);
+                               x86_call_reg (code, X86_ECX);
                                x86_patch (br [0], code);
                        }
 
index 6aecd45ad20578f7adb42116ddd3d32b263b7d90..f8e2f2d79dec35f64fb31ef629b043b73f6135c8 100755 (executable)
@@ -29,6 +29,7 @@ elif [[ ${CI_TAGS} == *'hybridaot_llvm'* ]];     then EXTRA_CONF_FLAGS="${EXTRA_
 elif [[ ${CI_TAGS} == *'aot_llvm'* ]];           then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --enable-llvm=yes --with-runtime_preset=aot ";
 elif [[ ${CI_TAGS} == *'fullaot'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=fullaot";
 elif [[ ${CI_TAGS} == *'hybridaot'* ]];          then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=hybridaot";
+elif [[ ${CI_TAGS} == *'winaot'* ]];             then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=winaot";
 elif [[ ${CI_TAGS} == *'aot'* ]];                then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=aot";
 elif [[ ${CI_TAGS} == *'bitcode'* ]];            then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=bitcode";
 elif [[ ${CI_TAGS} == *'interpreter'* ]];        then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-interpreter=yes";
@@ -52,7 +53,6 @@ if [ -x "/usr/bin/dpkg-architecture" ];
        wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
 fi
 
-
 ${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh $EXTRA_CONF_FLAGS
 if [[ ${label} == 'w32' ]];
     then
@@ -64,6 +64,14 @@ if [[ ${label} == w* ]];
     ${TESTCMD} --label=make-msvc-sgen --timeout=60m --fatal /cygdrive/c/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=${PLATFORM} /p:Configuration=Release /p:MONO_TARGET_GC=sgen msvc/mono.sln
 fi
 
+if [[ ${CI_TAGS} == *'winaot'* ]];
+    then
+    # The AOT compiler on Windows requires Visual Studio's clang.exe and link.exe in $PATH
+    # and we must make sure Visual Studio's link.exe comes before Cygwin's link.exe
+    VC_ROOT="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC"
+    export PATH="$VC_ROOT/ClangC2/bin/amd64:$VC_ROOT/bin/amd64":$PATH
+fi
+
 if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
 
 make_parallelism=-j4
diff --git a/scripts/ci/run-test-winaot.sh b/scripts/ci/run-test-winaot.sh
new file mode 100755 (executable)
index 0000000..c8b5d79
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash -e
+
+if test -n "${MONO_LLVMONLY}";
+then
+${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k llvmonlycheck
+else
+${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k fullaotcheck
+fi
+
+${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1
+${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
+${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
+${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
+${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test
+${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test
+${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test
+${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test
+${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test
+${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test
+${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test
+${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test
+${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
+${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test
+${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test
+${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test
+${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test
+${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test
+${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test
+${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test
+${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test
+${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test
+${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test
+
+rm -fr /tmp/jenkins-temp-aspnet*