Exemple #1
0
static guint64
debugger_insert_method_breakpoint (guint64 method_argument, guint64 index)
{
	MonoMethod *method = GUINT_TO_POINTER ((gsize) method_argument);
	MonoDebugMethodAddressList *info;

	mono_debugger_lock ();

	if (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
		const char *name = method->name;
		MonoMethod *nm = NULL;

		if (method->klass->parent == mono_defaults.multicastdelegate_class) {
			if (*name == 'I' && (strcmp (name, "Invoke") == 0))
			        nm = mono_marshal_get_delegate_invoke (method, NULL);
			else if (*name == 'B' && (strcmp (name, "BeginInvoke") == 0))
				nm = mono_marshal_get_delegate_begin_invoke (method);
			else if (*name == 'E' && (strcmp (name, "EndInvoke") == 0))
				nm = mono_marshal_get_delegate_end_invoke (method);
		}

		if (!nm) {
			mono_debugger_unlock ();
			return 0;
		}

		method = nm;
	}

	info = mono_debugger_insert_method_breakpoint (method, index);

	mono_debugger_unlock ();
	return (guint64) (gsize) info;
}
Exemple #2
0
void
mono_debugger_class_initialized (MonoClass *klass)
{
	int i;

	if (!class_init_callbacks)
		return;

 again:
	for (i = 0; i < class_init_callbacks->len; i++) {
		ClassInitCallback *info = g_ptr_array_index (class_init_callbacks, i);

		if (info->name_space && strcmp (info->name_space, klass->name_space))
			continue;
		if (strcmp (info->name, klass->name))
			continue;

		mono_debugger_event (MONO_DEBUGGER_EVENT_CLASS_INITIALIZED,
				     (guint64) (gsize) klass, info->index);

		if (info->token) {
			int j;

			for (j = 0; j < klass->method.count; j++) {
				if (klass->methods [j]->token != info->token)
					continue;

				mono_debugger_insert_method_breakpoint (klass->methods [j], info->index);
			}
		}

		g_ptr_array_remove (class_init_callbacks, info);
		if (info->name_space)
			g_free (info->name_space);
		else
			g_free (info->name);
		g_free (info);
		goto again;
	}
}