-/*
- * debug-mono-ppdb.c: Support for the portable PDB symbol
+/**
+ * \file
+ * Support for the portable PDB symbol
* file format
*
*
#include <mono/metadata/tokentype.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mono-debug.h>
-#include <mono/metadata/debug-mono-symfile.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
#include <mono/metadata/mono-endian.h>
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/class-internals.h>
g_free (info);
}
+static MonoPPDBFile*
+create_ppdb_file (MonoImage *ppdb_image)
+{
+ MonoPPDBFile *ppdb;
+
+ ppdb = g_new0 (MonoPPDBFile, 1);
+ ppdb->image = ppdb_image;
+ ppdb->doc_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) doc_free);
+ ppdb->method_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
+ return ppdb;
+}
+
MonoPPDBFile*
mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size)
{
guint8 pe_guid [16];
gint32 pe_age;
gint32 pe_timestamp;
- MonoPPDBFile *ppdb;
+
+ if (image->tables [MONO_TABLE_DOCUMENT].rows) {
+ /* Embedded ppdb */
+ mono_image_addref (image);
+ return create_ppdb_file (image);
+ }
if (!get_pe_debug_guid (image, pe_guid, &pe_age, &pe_timestamp))
return NULL;
return NULL;
}
- ppdb = g_new0 (MonoPPDBFile, 1);
- ppdb->image = ppdb_image;
- ppdb->doc_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) doc_free);
- ppdb->method_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
-
- return ppdb;
+ return create_ppdb_file (ppdb_image);
}
void
/**
* mono_ppdb_lookup_location:
- * @minfo: A `MonoDebugMethodInfo' which can be retrieved by
- * mono_debug_lookup_method().
- * @offset: IL offset within the corresponding method's CIL code.
+ * \param minfo A \c MonoDebugMethodInfo which can be retrieved by mono_debug_lookup_method().
+ * \param offset IL offset within the corresponding method's CIL code.
*
* This function is similar to mono_debug_lookup_location(), but we
* already looked up the method and also already did the
- * `native address -> IL offset' mapping.
+ * native address -> IL offset mapping.
*/
MonoDebugSourceLocation *
mono_ppdb_lookup_location (MonoDebugMethodInfo *minfo, uint32_t offset)
res->move_next_method_token [i] = mono_metadata_decode_value (pointer, &pointer);
}
return res;
-}
\ No newline at end of file
+}