Example #1
0
static guint64
debugger_insert_source_breakpoint (guint64 image_argument, guint64 token, guint64 index,
				   const gchar *class_name)
{
	MonoImage *image = GUINT_TO_POINTER ((gsize) image_argument);
	MonoDebugMethodAddressList *info;
	MonoClass *klass;
	int i;

	mono_debugger_lock ();

	klass = mono_debugger_register_class_init_callback (image, class_name, token, index);
	if (!klass || !klass->inited || !klass->methods) {
		mono_debugger_unlock ();
		return 0;
	}

	for (i = 0; i < klass->method.count; i++) {
		MonoMethod *method = klass->methods [i];

		if (method->token != token)
			continue;

		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_debug_lookup_method_addresses (method);
		mono_debugger_unlock ();
		return (guint64) (gsize) info;
	}

	mono_debugger_unlock ();
	return 0;
}
Example #2
0
MonoDebugMethodAddressList *
mono_debugger_insert_method_breakpoint (MonoMethod *method, guint64 index)
{
	MethodBreakpointInfo *info;

	info = g_new0 (MethodBreakpointInfo, 1);
	info->method = method;
	info->index = index;

	info->address_list = mono_debug_lookup_method_addresses (method);

	if (!method_breakpoints)
		method_breakpoints = g_ptr_array_new ();

	g_ptr_array_add (method_breakpoints, info);

	return info->address_list;
}