* tramp-x86.c, tramp-ppc.c: Reenable the debugger breakpoint interface.
* driver.c: Added `--debug' command line argument to enable
debugging support.
svn path=/trunk/mono/; revision=13930
+2003-04-23 Martin Baulig <martin@ximian.com>
+
+ * tramp-x86.c, tramp-ppc.c: Reenable the debugger breakpoint interface.
+
+ * driver.c: Added `--debug' command line argument to enable
+ debugging support.
+
2003-04-23 Martin Baulig <martin@ximian.com>
* debug.[ch]: Removed. The code is now in
liveness.c \
ssa.c \
driver.c \
- debug.c \
- debug-stabs.c \
- debug-dwarf2.c \
debug-mini.c \
linear-scan.c \
aot.c \
#include "mini.h"
#include "mini-x86.h"
-#include "debug-private.h"
+#include <mono/metadata/mono-debug.h>
+#include <mono/metadata/mono-debug-debugger.h>
-void
-mono_debug_codegen_breakpoint (guint8 **buf)
+gpointer
+mono_debugger_create_notification_function (gpointer *notification_address)
{
- x86_breakpoint (*buf);
+ guint8 *ptr, *buf;
+
+ ptr = buf = g_malloc0 (16);
+ x86_breakpoint (buf);
+ if (notification_address)
+ *notification_address = buf;
+ x86_ret (buf);
+
+ return ptr;
}
-void
-mono_debug_codegen_ret (guint8 **buf)
+static void
+record_line_number (MonoDebugMethodJitInfo *jit, guint32 address, guint32 offset)
{
- x86_ret (*buf);
+ MonoDebugLineNumberEntry *lne = g_new0 (MonoDebugLineNumberEntry, 1);
+
+ lne->address = address;
+ lne->offset = offset;
+
+ g_array_append_val (jit->line_numbers, *lne);
}
typedef struct
{
- MonoDebugMethodInfo *minfo;
+ MonoDebugMethodJitInfo *jit;
guint32 has_line_numbers;
} MiniDebugMethodInfo;
MonoMethod *method = cfg->method;
MiniDebugMethodInfo *info;
- if (!mono_debug_handle)
- return;
-
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
mono_class_init (cfg->method->klass);
- info->minfo = _mono_debug_lookup_method (cfg->method);
- if (!info->minfo || info->minfo->jit)
- return;
+ g_assert (((MonoMethodNormal*)cfg->method)->header);
+ header = ((MonoMethodNormal*)cfg->method)->header;
- mono_debug_handle->dirty = TRUE;
-
- g_assert (((MonoMethodNormal*)info->minfo->method)->header);
- header = ((MonoMethodNormal*)info->minfo->method)->header;
-
- info->minfo->jit = jit = g_new0 (MonoDebugMethodJitInfo, 1);
+ info->jit = jit = g_new0 (MonoDebugMethodJitInfo, 1);
jit->line_numbers = g_array_new (FALSE, TRUE, sizeof (MonoDebugLineNumberEntry));
jit->num_locals = header->num_locals;
jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
mono_debug_close_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
- MonoDebugMethodInfo *minfo;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
MonoMethod *method;
int i;
info = (MiniDebugMethodInfo *) cfg->debug_info;
- if (!info || !info->minfo)
+ if (!info || !info->jit)
return;
- minfo = info->minfo;
- method = minfo->method;
+ method = cfg->method;
header = ((MonoMethodNormal*)method)->header;
- jit = minfo->jit;
+ jit = info->jit;
jit->code_start = cfg->native_code;
jit->epilogue_begin = cfg->epilog_begin;
jit->code_size = cfg->code_len;
- _mono_debug_generate_line_number (minfo, jit->epilogue_begin, header->code_size, 0);
+ record_line_number (jit, jit->epilogue_begin, header->code_size);
jit->num_params = method->signature->param_count;
jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
for (i = 0; i < jit->num_params; i++)
write_variable (cfg->varinfo [i + method->signature->hasthis], &jit->params [i]);
- if (minfo->symfile) {
- mono_debug_symfile_add_method (minfo->symfile, minfo->method);
- mono_debugger_event (MONO_DEBUGGER_EVENT_METHOD_ADDED, minfo->symfile, minfo->method);
- }
+ mono_debug_add_method (method, jit);
}
void
guint32 offset;
info = (MiniDebugMethodInfo *) cfg->debug_info;
- if (!info || !info->minfo || !ins->cil_code)
+ if (!info || !info->jit || !ins->cil_code)
return;
- g_assert (((MonoMethodNormal*)info->minfo->method)->header);
- header = ((MonoMethodNormal*)info->minfo->method)->header;
+ g_assert (((MonoMethodNormal*)cfg->method)->header);
+ header = ((MonoMethodNormal*)cfg->method)->header;
if ((ins->cil_code < header->code) ||
(ins->cil_code > header->code + header->code_size))
offset = ins->cil_code - header->code;
if (!info->has_line_numbers) {
- info->minfo->jit->prologue_end = address;
+ info->jit->prologue_end = address;
info->has_line_numbers = TRUE;
}
- _mono_debug_generate_line_number (info->minfo, address, offset, 0);
+ record_line_number (info->jit, address, offset);
}
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-debug.h>
+#include <mono/metadata/mono-debug-debugger.h>
#include "mini.h"
#include <string.h>
#include <ctype.h>
#include "inssel.h"
-#include "debug.h"
static FILE *mini_stats_fd = NULL;
" --compile-all Compiles all the methods in the assembly\n"
" --breakonex Inserts a breakpoint on exceptions\n"
" --break METHOD Inserts a breakpoint at METHOD entry\n"
+ " --debug Enable debugging support\n"
"\n"
"Development:\n"
" --statfile FILE Sets the stat file to FILE\n"
const char* aname, *mname = NULL;
char *config_file = NULL;
int i, count = 1;
+ int enable_debugging = FALSE;
guint32 opt, action = DO_EXEC;
MonoGraphOptions mono_graph_options = 0;
int mini_verbose = 0;
} else if (strcmp (argv [i], "--breakonex") == 0) {
mono_break_on_exc = TRUE;
} else if (strcmp (argv [i], "--break") == 0) {
- if (!mono_insert_breakpoint (argv [++i], FALSE))
+ if (!mono_debugger_insert_breakpoint (argv [++i], FALSE))
g_error ("Invalid method name '%s'", argv [i]);
} else if (strcmp (argv [i], "--print-vtable") == 0) {
mono_print_vtable = TRUE;
mname = argv [++i];
mono_graph_options = MONO_GRAPH_CFG;
action = DO_DRAW;
+ } else if (strcmp (argv [i], "--debug") == 0) {
+ enable_debugging = TRUE;
} else {
fprintf (stderr, "Unknown command line option: %s\n", argv [i]);
return 1;
break;
}
+ if (enable_debugging)
+ mono_debug_init (MONO_DEBUG_FORMAT_MONO);
+
assembly = mono_assembly_open (aname, NULL);
if (!assembly) {
fprintf (stderr, "cannot open assembly %s\n", aname);
return 2;
}
+ if (enable_debugging)
+ mono_debug_init_2 (assembly);
+
if (mono_compile_aot || action == DO_EXEC) {
g_set_prgname (aname);
mono_config_parse (config_file);
#include <mono/metadata/threads.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/exception.h>
+#include <mono/metadata/mono-debug.h>
#include "mini.h"
#include "mini-x86.h"
-#include "debug-private.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# define SC_EAX sc_eax
*managed = TRUE;
if (trace) {
- if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
- mono_debug_make_symbols ();
+ mono_debug_update ();
source_location = mono_debug_source_location_from_address (ji->method, address, NULL);
iloffset = mono_debug_il_offset_from_address (ji->method, address);
- source_location = NULL;
- iloffset = -1;
if (iloffset < 0)
tmpaddr = g_strdup_printf ("<0x%05x>", address);
g_print ("EXCEPTION handling: %s\n", mono_object_class (obj)->name);
if (!mono_arch_handle_exception (&ctx_cp, obj, TRUE)) {
if (mono_break_on_exc) {
- if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
- mono_debug_make_symbols ();
+ mono_debug_update ();
G_BREAKPOINT ();
}
mono_unhandled_exception (obj);
#include <mono/metadata/profiler-private.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-debug.h>
+#include <mono/metadata/mono-debug-debugger.h>
#include "mini.h"
#include <string.h>
#include <ctype.h>
#include "inssel.h"
-#include "debug.h"
#include "jit-icalls.c"
ADD_BBLOCK (cfg, bbhash, bblock);
if (cfg->method == method) {
- if (mono_method_has_breakpoint (method, FALSE)) {
+ if (mono_debugger_method_has_breakpoint (method, FALSE)) {
MONO_INST_NEW (cfg, ins, CEE_BREAK);
MONO_ADD_INS (bblock, ins);
}
#include <mono/metadata/appdomain.h>
#include <mono/metadata/tabledefs.h>
#include <mono/arch/ppc/ppc-codegen.h>
+#include <mono/metadata/mono-debug-debugger.h>
#include "mini.h"
#include "mini-ppc.h"
-/*
- * define for the (broken) debugger breakpoint interface:
- * The debugger should use the hw registers to set the breakpoints.
- */
-#define mono_method_has_breakpoint(a,b) (0)
-#define mono_remove_breakpoint(a)
-
/* adapt to mini later... */
#define mono_jit_share_code (1)
reg = code [1] & 0x07;
disp = *((gint32*)(code + 2));
} else if ((code [1] == 0xe8)) {
- breakpoint_id = mono_method_has_breakpoint (m, TRUE);
+ breakpoint_id = mono_debugger_method_has_breakpoint (m, TRUE);
if (breakpoint_id) {
mono_remove_breakpoint (breakpoint_id);
trampoline = get_breakpoint_trampoline (m, breakpoint_id, addr);
trampoline = *((gpointer *)o) = addr;
}
- breakpoint_id = mono_method_has_breakpoint (m, TRUE);
+ breakpoint_id = mono_debugger_method_has_breakpoint (m, TRUE);
if (breakpoint_id) {
- mono_remove_breakpoint (breakpoint_id);
+ mono_debugger_remove_breakpoint (breakpoint_id);
return get_breakpoint_trampoline (m, breakpoint_id, trampoline);
} else {
return trampoline;
#include <mono/metadata/marshal.h>
#include <mono/metadata/tabledefs.h>
#include <mono/arch/x86/x86-codegen.h>
+#include <mono/metadata/mono-debug-debugger.h>
#include "mini.h"
#include "mini-x86.h"
-/*
- * define for the (broken) debugger breakpoint interface:
- * The debugger should use the hw registers to set the breakpoints.
- */
-#define mono_method_has_breakpoint(a,b) (0)
-#define mono_remove_breakpoint(a)
-
/* adapt to mini later... */
#define mono_jit_share_code (1)
reg = code [1] & 0x07;
disp = *((gint32*)(code + 2));
} else if ((code [1] == 0xe8)) {
- breakpoint_id = mono_method_has_breakpoint (m, TRUE);
+ breakpoint_id = mono_debugger_method_has_breakpoint (m, TRUE);
if (breakpoint_id) {
- mono_remove_breakpoint (breakpoint_id);
+ mono_debugger_remove_breakpoint (breakpoint_id);
trampoline = get_breakpoint_trampoline (m, breakpoint_id, addr);
} else
trampoline = addr;
trampoline = *((gpointer *)o) = addr;
}
- breakpoint_id = mono_method_has_breakpoint (m, TRUE);
+ breakpoint_id = mono_debugger_method_has_breakpoint (m, TRUE);
if (breakpoint_id) {
- mono_remove_breakpoint (breakpoint_id);
+ mono_debugger_remove_breakpoint (breakpoint_id);
return get_breakpoint_trampoline (m, breakpoint_id, trampoline);
} else {
return trampoline;