[exdoc] Handle punctuation better in code formatting.
[mono.git] / mono / metadata / debug-mono-ppdb.c
index 581f364423a0253df449a44810cb3bfa611ffe19..ab302a084d325e7437551da00004a201a154406f 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * debug-mono-ppdb.c: Support for the portable PDB symbol
+/**
+ * \file
+ * Support for the portable PDB symbol
  * file format
  *
  *
@@ -20,8 +21,7 @@
 #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>
@@ -96,6 +96,18 @@ doc_free (gpointer key)
        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)
 {
@@ -106,7 +118,12 @@ 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;
@@ -150,12 +167,7 @@ mono_ppdb_load_file (MonoImage *image, const guint8 *raw_contents, int size)
                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
@@ -272,13 +284,12 @@ get_docname (MonoPPDBFile *ppdb, MonoImage *image, int docidx)
 
 /**
  * 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)
@@ -718,4 +729,4 @@ mono_ppdb_lookup_method_async_debug_info (MonoDebugMethodInfo *minfo)
                res->move_next_method_token [i] = mono_metadata_decode_value (pointer, &pointer);
        }
        return res;
-}
\ No newline at end of file
+}