#include <ctype.h>
#include <locale.h>
#include "version.h"
+#include "debugger-agent.h"
static FILE *mini_stats_fd = NULL;
MONO_OPT_INLINE | \
MONO_OPT_CONSPROP | \
MONO_OPT_COPYPROP | \
- MONO_OPT_TREEPROP | \
MONO_OPT_DEADCE | \
MONO_OPT_BRANCH | \
MONO_OPT_LINEARS | \
} else if (!strncmp (p, "mdb-optimizations", 17)) {
opt->mdb_optimizations = TRUE;
p += 17;
+ } else if (!strncmp (p, "gdb", 3)) {
+ opt->gdb = TRUE;
+ p += 3;
} else {
fprintf (stderr, "Invalid debug option `%s', use --help-debug for details\n", p);
return FALSE;
MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION | MONO_OPT_ABCREM,
MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_EXCEPTION | MONO_OPT_ABCREM | MONO_OPT_SSAPRE,
MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_ABCREM,
- MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_TREEPROP,
MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_SSAPRE,
MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_LINEARS | MONO_OPT_COPYPROP | MONO_OPT_CONSPROP | MONO_OPT_DEADCE | MONO_OPT_LOOP | MONO_OPT_INLINE | MONO_OPT_INTRINS | MONO_OPT_ABCREM | MONO_OPT_SHARED,
DEFAULT_OPTIMIZATIONS,
/* load the metadata */
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
- method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ if (!method)
+ continue;
mono_class_init (method->klass);
if (!strncmp (method->name, "test_", 5) && mini_stats_fd) {
if (mini_stats_fd)
fprintf (mini_stats_fd, "[");
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
- method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ if (!method)
+ continue;
if (strncmp (method->name, "test_", 5) == 0) {
expected = atoi (method->name + 5);
run++;
fprintf (stderr, "Can not open image %s\n", main_args->argv [i]);
exit (1);
}
+ /* Check that the assembly loaded matches the filename */
+ {
+ MonoImageOpenStatus status;
+ MonoImage *img;
+
+ img = mono_image_open (main_args->argv [i], &status);
+ if (img && strcmp (img->name, assembly->image->name)) {
+ fprintf (stderr, "Error: Loaded assembly '%s' doesn't match original file name '%s'. Set MONO_PATH to the assembly's location.\n", assembly->image->name, img->name);
+ exit (1);
+ }
+ }
res = mono_compile_assembly (assembly, main_args->opts, main_args->aot_options);
if (res != 0) {
fprintf (stderr, "AOT of image %s failed.\n", main_args->argv [i]);
"Development:\n"
" --aot Compiles the assembly to native code\n"
" --debug[=<options>] Enable debugging support, use --help-debug for details\n"
+ " --debugger-agent=options Enable the debugger agent\n"
" --profile[=profiler] Runs in profiling mode with the specified profiler module\n"
" --trace[=EXPR] Enable tracing, use --help-trace for details\n"
" --help-devel Shows more options available to developers\n"
mini_verbose++;
} else if (strcmp (argv [i], "--version") == 0 || strcmp (argv [i], "-V") == 0) {
char *build = mono_get_runtime_build_info ();
- g_print ("Mono JIT compiler version %s (%s)\nCopyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com\n", VERSION, build);
+ g_print ("Mono JIT compiler version %s (%s)\nCopyright (C) 2002-2009 Novell, Inc and Contributors. www.mono-project.com\n", VERSION, build);
g_free (build);
g_print (info);
if (mini_verbose) {
enable_debugging = TRUE;
if (!parse_debug_options (argv [i] + 8))
return 1;
+ } else if (strncmp (argv [i], "--debugger-agent=", 17) == 0) {
+ MonoDebugOptions *opt = mini_get_debug_options ();
+
+ mono_debugger_agent_parse_options (argv [i] + 17);
+ opt->mdb_optimizations = TRUE;
+ enable_debugging = TRUE;
} else if (strcmp (argv [i], "--security") == 0) {
mono_verifier_set_mode (MONO_VERIFIER_MODE_VERIFIABLE);
mono_security_set_mode (MONO_SECURITY_MODE_CAS);
if (getenv ("MONO_XDEBUG"))
enable_debugging = TRUE;
+#ifdef MONO_CROSS_COMPILE
+ if (!mono_compile_aot) {
+ fprintf (stderr, "This mono runtime is compiled for cross-compiling. Only the --aot option is supported.");
+ exit (1);
+ }
+#if SIZEOF_VOID_P == 8 && defined(TARGET_ARM)
+ fprintf (stderr, "Can't cross-compile on 64 bit platforms to arm.\n");
+ exit (1);
+#endif
+#endif
+
if ((action == DO_EXEC) && mono_debug_using_mono_debugger ())
action = DO_DEBUGGER;
#ifdef MONO_DEBUGGER_SUPPORTED
mono_debug_init (MONO_DEBUG_FORMAT_DEBUGGER);
- mono_debugger_init ();
#else
g_print ("The Mono Debugger is not supported on this platform.\n");
return 1;
} else if (enable_debugging)
mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+#ifdef MONO_DEBUGGER_SUPPORTED
+ if (enable_debugging) {
+ if ((opt & MONO_OPT_GSHARED) == 0)
+ mini_debugger_set_attach_ok ();
+ }
+#endif
+
mono_set_defaults (mini_verbose, opt);
mono_setup_vtable_in_class_init = FALSE;
domain = mini_init (argv [i], forced_version);
exit (1);
}
- mono_debugger_main (domain, assembly, argc - i, argv + i);
+ mini_debugger_main (domain, assembly, argc - i, argv + i);
mini_cleanup (domain);
return 0;
#else
mini_cleanup (domain);
}
+void
+mono_jit_set_aot_only (gboolean val)
+{
+ mono_aot_only = val;
+}
+
/**
* mono_jit_set_trace_options:
* @options: string representing the trace options