First set of licensing changes
[mono.git] / mono / mini / driver.c
index 2bf88c38789259da84e3417fc7d62f2e1b3f60e8..a84cd2f6ab049bf3bde009f94c6c947ece646446 100644 (file)
@@ -7,6 +7,7 @@
  *
  * (C) 2002-2003 Ximian, Inc.
  * (C) 2003-2006 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
 #include <config.h>
@@ -1019,7 +1020,20 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[
                return 1;
        }
        
-       return mono_runtime_run_main (method, argc, argv, NULL);
+       if (mono_llvm_only) {
+               MonoObject *exc;
+               int res;
+
+               res = mono_runtime_run_main (method, argc, argv, &exc);
+               if (exc) {
+                       mono_unhandled_exception (exc);
+                       mono_invoke_unhandled_exception_hook (exc);
+                       return 1;
+               }
+               return res;
+       } else {
+               return mono_runtime_run_main (method, argc, argv, NULL);
+       }
 }
 
 typedef struct 
@@ -1145,7 +1159,8 @@ load_agent (MonoDomain *domain, char *desc)
 
        pa [0] = main_args;
        /* Pass NULL as 'exc' so unhandled exceptions abort the runtime */
-       mono_runtime_invoke (method, NULL, pa, NULL);
+       mono_runtime_invoke_checked (method, NULL, pa, &error);
+       mono_error_raise_exception (&error); /* FIXME don't raise here */
 
        return 0;
 }
@@ -1914,6 +1929,14 @@ mono_main (int argc, char* argv[])
        }
 #endif
 
+#ifdef DISABLE_HW_TRAPS
+       // Signal handlers not available
+       {
+               MonoDebugOptions *opt = mini_get_debug_options ();
+               opt->explicit_null_checks = TRUE;
+       }
+#endif
+
        if (!argv [i]) {
                mini_usage ();
                return 1;