static guint32 debugger_lock_level = 0;
static CRITICAL_SECTION debugger_lock_mutex;
static gboolean must_reload_symtabs = FALSE;
-static gboolean mono_debugger_initialized = FALSE;
+static gboolean mono_debugger_use_debugger = FALSE;
static MonoObject *last_exception = NULL;
struct _MonoDebuggerMetadataInfo {
void
mono_debugger_lock (void)
{
- if (!mono_debugger_initialized) {
- debugger_lock_level++;
- return;
- }
-
EnterCriticalSection (&debugger_lock_mutex);
debugger_lock_level++;
}
void
mono_debugger_unlock (void)
{
- g_assert (debugger_lock_level > 0);
-
- if (!mono_debugger_initialized) {
- debugger_lock_level--;
- return;
- }
-
if (debugger_lock_level == 1) {
- if (must_reload_symtabs) {
+ if (must_reload_symtabs && mono_debugger_use_debugger) {
mono_debugger_event (MONO_DEBUGGER_EVENT_RELOAD_SYMTABS, 0, 0);
must_reload_symtabs = FALSE;
}
}
void
-mono_debugger_initialize (void)
+mono_debugger_initialize (gboolean use_debugger)
{
MONO_GC_REGISTER_ROOT (last_exception);
- g_assert (!mono_debugger_initialized);
+ g_assert (!mono_debugger_use_debugger);
InitializeCriticalSection (&debugger_lock_mutex);
- mono_debugger_initialized = TRUE;
+ mono_debugger_use_debugger = use_debugger;
}
void
mono_debugger_add_symbol_file (MonoDebugHandle *handle)
{
- g_assert (mono_debugger_initialized);
+ g_assert (mono_debugger_use_debugger);
mono_debugger_lock ();
mono_debugger_event (MONO_DEBUGGER_EVENT_ADD_MODULE, GPOINTER_TO_UINT (handle), 0);
gboolean
mono_debugger_unhandled_exception (gpointer addr, gpointer stack, MonoObject *exc)
{
- if (!mono_debugger_initialized)
+ if (!mono_debugger_use_debugger)
return FALSE;
// Prevent the object from being finalized.
{
MonoDebuggerExceptionInfo info;
- if (!mono_debugger_initialized)
+ if (!mono_debugger_use_debugger)
return;
// Prevent the object from being finalized.
{
MonoDebuggerExceptionInfo info;
- if (!mono_debugger_initialized)
+ if (!mono_debugger_use_debugger)
return FALSE;
// Prevent the object from being finalized.
MonoObject *retval;
gchar *message;
- // g_message (G_STRLOC ": %p - %p - %p - %p", method, obj, params, exc);
- // g_message (G_STRLOC ": %s.%s", method->klass->name, method->name);
-
if (!strcmp (method->name, ".ctor")) {
retval = obj = mono_object_new (mono_domain_get (), method->klass);
return retval;
}
+gboolean
+mono_debugger_lookup_type (const gchar *type_name)
+{
+ int i;
+ mono_debugger_lock ();
+
+ for (i = 0; i < mono_symbol_table->num_symbol_files; i++) {
+ MonoDebugHandle *symfile = mono_symbol_table->symbol_files [i];
+ MonoType *type;
+ MonoClass* klass;
+ gchar *name;
+
+ name = g_strdup (type_name);
+ type = mono_reflection_type_from_name (name, symfile->image);
+ g_free (name);
+ if (!type)
+ continue;
+
+ klass = mono_class_from_mono_type (type);
+ if (klass)
+ mono_class_init (klass);
+
+ mono_debugger_unlock ();
+ return TRUE;
+ }
+
+ mono_debugger_unlock ();
+ return FALSE;
+}
+
gint32
mono_debugger_lookup_assembly (const gchar *name)
{