#include "image-writer.h"
#include "dwarfwriter.h"
+#include "mono/utils/mono-compiler.h"
+
#define USE_GDB_JIT_INTERFACE
/* The recommended gdb macro is: */
struct jit_code_entry *first_entry;
};
-
-#ifdef _MSC_VER
-#define MONO_NOINLINE __declspec (noinline)
-#else
-#define MONO_NOINLINE __attribute__((noinline))
-#endif
-
/* GDB puts a breakpoint in this function. */
-void MONO_NOINLINE __jit_debug_register_code(void);
+void MONO_NEVER_INLINE __jit_debug_register_code(void);
-#if !defined(MONO_LLVM_LOADED) && defined(ENABLE_LLVM) && ((LLVM_MAJOR_VERSION == 2 && LLVM_MINOR_VERSION >= 7) || LLVM_MAJOR_VERSION > 2)
+#if !defined(MONO_LLVM_LOADED) && defined(ENABLE_LLVM) && !defined(MONO_CROSS_COMPILE)
/* LLVM already defines these */
+
extern struct jit_descriptor __jit_debug_descriptor;
#else
-/* Make sure to specify the version statically, because the
- debugger may check the version before we can set it. */
-struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
-
/* gcc seems to inline/eliminate calls to noinline functions, thus the asm () */
-void MONO_NOINLINE __jit_debug_register_code(void) {
+void MONO_NEVER_INLINE __jit_debug_register_code(void) {
#if defined(__GNUC__)
asm ("");
#endif
}
+/* Make sure to specify the version statically, because the
+ debugger may check the version before we can set it. */
+struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
+
#endif
static MonoImageWriter *xdebug_w;
static GHashTable *xdebug_syms;
void
-mono_xdebug_init (char *options)
+mono_xdebug_init (const char *options)
{
MonoImageWriter *w;
char **args, **ptr;
img_writer_emit_start (w);
- xdebug_writer = mono_dwarf_writer_create (w, il_file, 0, TRUE);
+ xdebug_writer = mono_dwarf_writer_create (w, il_file, 0, TRUE, TRUE);
/* Emit something so the file has a text segment */
img_writer_emit_section_change (w, ".text", 0);
img_writer_emit_string (w, "");
- mono_dwarf_writer_emit_base_info (xdebug_writer, mono_unwind_get_cie_program ());
+ mono_dwarf_writer_emit_base_info (xdebug_writer, "JITted code", mono_unwind_get_cie_program ());
}
static void
if (!il_file)
il_file = fopen ("xdb.il", "w");
- dw = mono_dwarf_writer_create (w, il_file, il_file_line_index, FALSE);
+ dw = mono_dwarf_writer_create (w, il_file, il_file_line_index, FALSE, TRUE);
- mono_dwarf_writer_emit_base_info (dw, mono_unwind_get_cie_program ());
+ mono_dwarf_writer_emit_base_info (dw, "JITted code", mono_unwind_get_cie_program ());
*out_w = w;
*out_dw = dw;
xdebug_method_count ++;
- dmji = mono_debug_find_method (cfg->jit_info->method, mono_domain_get ());;
- mono_dwarf_writer_emit_method (xdebug_writer, cfg, cfg->jit_info->method, NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
+ dmji = mono_debug_find_method (jinfo_get_method (cfg->jit_info), mono_domain_get ());;
+ mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
mono_debug_free_method_jit_info (dmji);
#if 0
return;
mono_loader_lock ();
- dmji = mono_debug_find_method (cfg->jit_info->method, mono_domain_get ());;
- mono_dwarf_writer_emit_method (xdebug_writer, cfg, cfg->jit_info->method, NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
+ dmji = mono_debug_find_method (jinfo_get_method (cfg->jit_info), mono_domain_get ());
+ mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
mono_debug_free_method_jit_info (dmji);
fflush (xdebug_fp);
mono_loader_unlock ();
#else /* !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */
void
-mono_xdebug_init (char *options)
+mono_xdebug_init (const char *options)
{
}