+struct LookupMethodAddressData
+{
+ MonoMethod *method;
+ MonoDebugMethodHeader *result;
+};
+
+static void
+lookup_method_address_func (gpointer key, gpointer value, gpointer user_data)
+{
+ MonoDebugDataTable *table = (MonoDebugDataTable *) value;
+ struct LookupMethodAddressData *data = (struct LookupMethodAddressData *) user_data;
+ MonoDebugMethodHeader *header;
+
+ header = g_hash_table_lookup (table->method_hash, data->method);
+ if (header)
+ data->result = header;
+}
+
+MonoDebugMethodAddressList *
+mono_debug_lookup_method_addresses (MonoMethod *method)
+{
+ MonoDebugMethodAddressList *info;
+ MonoDebugMethodHeader *header = NULL;
+ struct LookupMethodAddressData data;
+ MonoMethod *declaring;
+ int count, size;
+ GSList *list;
+ guint8 *ptr;
+
+ g_assert (mono_debug_debugger_version == 2);
+
+ mono_debugger_lock ();
+
+ declaring = method->is_inflated ? ((MonoMethodInflated *) method)->declaring : method;
+
+ data.method = declaring;
+ data.result = NULL;
+
+ g_hash_table_foreach (data_table_hash, lookup_method_address_func, &data);
+ header = data.result;
+
+ if (!header) {
+ mono_debugger_unlock ();
+ return NULL;
+ }
+
+ count = g_slist_length (header->address_list) + 1;
+ size = sizeof (MonoDebugMethodAddressList) + count * sizeof (gpointer);
+
+ info = g_malloc0 (size);
+ info->size = size;
+ info->count = count;
+
+ ptr = info->data;
+
+ WRITE_UNALIGNED (gpointer, ptr, header);
+ ptr += sizeof (gpointer);
+
+ for (list = header->address_list; list; list = list->next) {
+ WRITE_UNALIGNED (gpointer, ptr, list->data);
+ ptr += sizeof (gpointer);
+ }
+
+ mono_debugger_unlock ();
+ return info;
+}
+