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)
{
- if (debugger_lock_level <= 0) {
- g_warning (G_STRLOC ": Attempting to release a lock which you do not own.");
- /*
- * Turn the assertion into a warning if we're not running in the debugger.
- * This should never happen, though. See bug #74830.
- */
- g_assert (!mono_debugger_initialized);
- return;
- }
-
- 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);