-/*
- * lldb.c: Mono support for LLDB.
+/**
+ * \file
+ * Mono support for LLDB.
*
* Author:
* Zoltan Varga (vargaz@gmail.com)
#include "lldb.h"
#include "seq-points.h"
-#include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
+#include <mono/utils/mono-counters.h>
#if !defined(DISABLE_JIT) && !defined(DISABLE_LLDB)
guint32 version;
/* Align */
guint32 dummy;
- /* Keep these as pointers so accessing them is atomic */
DebugEntry *entry;
/* List of all entries */
+ /* Keep this as a pointer so accessing it is atomic */
DebugEntry *all_entries;
+ /* The current entry embedded here to reduce the amount of roundtrips */
+ guint32 type;
+ guint32 dummy2;
+ guint64 size;
+ guint64 addr;
} JitDescriptor;
/*
static DebugEntry *last_entry;
static mono_mutex_t mutex;
static GHashTable *dyn_codegen_regions;
+static double register_time;
+static int num_entries;
#define lldb_lock() mono_os_mutex_lock (&mutex)
#define lldb_unlock() mono_os_mutex_unlock (&mutex)
}
__mono_jit_debug_descriptor.entry = entry;
+
+ __mono_jit_debug_descriptor.type = entry->type;
+ __mono_jit_debug_descriptor.size = entry->size;
+ __mono_jit_debug_descriptor.addr = entry->addr;
+ mono_memory_barrier ();
+
+ GTimer *timer = mono_time_track_start ();
__mono_jit_debug_register_code ();
+ mono_time_track_end (®ister_time, timer);
+ num_entries ++;
+ //printf ("%lf %d %d\n", register_time, num_entries, entry->type);
lldb_unlock ();
}
{
enabled = TRUE;
mono_os_mutex_init_recursive (&mutex);
+
+ mono_counters_register ("Time spent in LLDB", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, ®ister_time);
}
typedef struct
mono_global_codeman_foreach (find_code_region, &udata);
if (!udata.found)
mono_domain_code_foreach (mono_get_root_domain (), find_code_region, &udata);
- g_assert (udata.found);
+ if (!udata.found)
+ /* Can happen with AOT */
+ return;
region_id = register_codegen_region (udata.region_start, udata.region_size, FALSE);
void
mono_lldb_save_specific_trampoline_info (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, gpointer code, guint32 code_len)
{
+ /*
+ * Avoid emitting these for now,
+ * they slow down execution too much, and they are
+ * only needed during single stepping which doesn't
+ * work anyway.
+ */
+#if 0
TrampolineEntry *entry;
UserData udata;
int region_id;
add_entry (ENTRY_TRAMPOLINE, buf);
buffer_free (buf);
+#endif
}
/*