#include <mono/metadata/mono-debug.h>
#include <mono/metadata/mono-debug-debugger.h>
#include <mono/metadata/mono-endian.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
#include <mono/metadata/mempool.h>
#include <mono/metadata/debug-mono-ppdb.h>
#include <string.h>
{
MonoDebugDataTable *table;
- table = g_hash_table_lookup (data_table_hash, domain);
+ table = (MonoDebugDataTable *)g_hash_table_lookup (data_table_hash, domain);
if (!table) {
g_error ("lookup_data_table () failed for %p\n", domain);
g_assert (table);
mono_debug_initialized = TRUE;
mono_debug_format = format;
- mono_mutex_init_recursive (&debugger_lock_mutex);
+ mono_os_mutex_init_recursive (&debugger_lock_mutex);
mono_debugger_lock ();
mono_debugger_lock ();
- table = g_hash_table_lookup (data_table_hash, domain);
+ table = (MonoDebugDataTable *)g_hash_table_lookup (data_table_hash, domain);
if (!table) {
g_warning (G_STRLOC ": unloading unknown domain %p / %d",
domain, mono_domain_get_id (domain));
static MonoDebugHandle *
mono_debug_get_image (MonoImage *image)
{
- return g_hash_table_lookup (mono_debug_handles, image);
+ return (MonoDebugHandle *)g_hash_table_lookup (mono_debug_handles, image);
}
void
mono_image_addref (image);
/* Try a ppdb file first */
- handle->ppdb = mono_ppdb_load_file (handle->image);
+ handle->ppdb = mono_ppdb_load_file (handle->image, raw_contents, size);
if (!handle->ppdb)
handle->symfile = mono_debug_open_mono_symbols (handle, raw_contents, size, FALSE);
(25 + sizeof (gpointer)) * (1 + jit->num_params + jit->num_locals);
if (max_size > BUFSIZ)
- ptr = oldptr = g_malloc (max_size);
+ ptr = oldptr = (guint8 *)g_malloc (max_size);
else
ptr = oldptr = buffer;
total_size = size + sizeof (MonoDebugMethodAddress);
if (method_is_dynamic (method)) {
- address = g_malloc0 (total_size);
+ address = (MonoDebugMethodAddress *)g_malloc0 (total_size);
} else {
- address = mono_mempool_alloc (table->mp, total_size);
+ address = (MonoDebugMethodAddress *)mono_mempool_alloc (table->mp, total_size);
}
address->code_start = jit->code_start;
table = lookup_data_table (domain);
- address = g_hash_table_lookup (table->method_address_hash, method);
+ address = (MonoDebugMethodAddress *)g_hash_table_lookup (table->method_address_hash, method);
if (address)
g_free (address);
var->size = read_leb128 (ptr, &ptr);
var->begin_scope = read_leb128 (ptr, &ptr);
var->end_scope = read_leb128 (ptr, &ptr);
- READ_UNALIGNED (gpointer, ptr, var->type);
+ READ_UNALIGNED (MonoType *, ptr, var->type);
ptr += sizeof (gpointer);
*rptr = ptr;
}
MonoDebugMethodAddress *address;
table = lookup_data_table (domain);
- address = g_hash_table_lookup (table->method_address_hash, method);
+ address = (MonoDebugMethodAddress *)g_hash_table_lookup (table->method_address_hash, method);
if (!address)
return NULL;
return location;
}
+MonoDebugSourceLocation *
+mono_debug_method_lookup_location (MonoDebugMethodInfo *minfo, int il_offset)
+{
+ MonoDebugSourceLocation *location;
+
+ mono_debugger_lock ();
+ if (minfo->handle->ppdb)
+ location = mono_ppdb_lookup_location (minfo, il_offset);
+ else
+ location = mono_debug_symfile_lookup_location (minfo, il_offset);
+ mono_debugger_unlock ();
+ return location;
+}
+
/*
* mono_debug_lookup_locals:
*
* Return information about the local variables of MINFO.
- * The result should be freed using mono_debug_symfile_free_locals ().
+ * The result should be freed using mono_debug_free_locals ().
*/
MonoDebugLocalsInfo*
mono_debug_lookup_locals (MonoMethod *method)
mono_debugger_lock ();
minfo = mono_debug_lookup_method_internal (method);
- if (!minfo || !minfo->handle || !minfo->handle->symfile || !mono_debug_symfile_is_loaded (minfo->handle->symfile)) {
+ if (!minfo || !minfo->handle) {
mono_debugger_unlock ();
return NULL;
}
- res = mono_debug_symfile_lookup_locals (minfo);
+ if (minfo->handle->ppdb) {
+ res = mono_ppdb_lookup_locals (minfo);
+ } else {
+ if (!minfo->handle->symfile || !mono_debug_symfile_is_loaded (minfo->handle->symfile))
+ res = NULL;
+ else
+ res = mono_debug_symfile_lookup_locals (minfo);
+ }
mono_debugger_unlock ();
return res;
}
+/*
+ * mono_debug_free_locals:
+ *
+ * Free all the data allocated by mono_debug_lookup_locals ().
+ */
+void
+mono_debug_free_locals (MonoDebugLocalsInfo *info)
+{
+ int i;
+
+ for (i = 0; i < info->num_locals; ++i)
+ g_free (info->locals [i].name);
+ g_free (info->locals);
+ g_free (info->code_blocks);
+ g_free (info);
+}
+
/**
* mono_debug_free_source_location:
* @location: A `MonoDebugSourceLocation'.
mono_debugger_lock (void)
{
g_assert (mono_debug_initialized);
- mono_mutex_lock (&debugger_lock_mutex);
+ mono_os_mutex_lock (&debugger_lock_mutex);
}
void
mono_debugger_unlock (void)
{
g_assert (mono_debug_initialized);
- mono_mutex_unlock (&debugger_lock_mutex);
+ mono_os_mutex_unlock (&debugger_lock_mutex);
}
/**
void
mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points)
{
- mono_debug_symfile_get_seq_points (minfo, source_file, source_file_list, source_files, seq_points, n_seq_points);
+ if (minfo->handle->ppdb)
+ mono_ppdb_get_seq_points (minfo, source_file, source_file_list, source_files, seq_points, n_seq_points);
+ else
+ mono_debug_symfile_get_seq_points (minfo, source_file, source_file_list, source_files, seq_points, n_seq_points);
}