[corlib] Lowercase and no '-' in metadata guids.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 8 Jul 2016 10:32:20 +0000 (11:32 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 8 Jul 2016 21:45:49 +0000 (22:45 +0100)
MVID and AOTID stacktrace metadata no longer displays guids with '-'.

Metadata is now also using lowercase instead of uppercase.

Changed mono-symbolicate and mono --aot to use the minimalistic GUIDs.

mcs/class/corlib/System.Diagnostics/StackTrace.cs
mcs/tools/mono-symbolicate/SymbolManager.cs
mono/metadata/metadata.c
mono/metadata/metadata.h
mono/mini/aot-compiler.c

index 64f3eef4814a0e8a76e7fd4aa3e585f5dc9ef363..ba77979609fd9f5e84e98d4a5854fcbcb7648d3b 100644 (file)
@@ -332,9 +332,9 @@ namespace System.Diagnostics {
                {
                        metadataHandlers = new Dictionary<string, Func<StackTrace, string>> (StringComparer.Ordinal);
 
-                       string aotid = Assembly.GetAotId ();
+                       var aotid = Assembly.GetAotId ();
                        if (aotid != null)
-                               AddMetadataHandler ("AOTID", st => { return aotid; });
+                               AddMetadataHandler ("AOTID", st => { return new Guid (aotid).ToString ("N"); });
 
                        AddMetadataHandler ("MVID", st => {
                                var mvidLines = new Dictionary<Guid, List<int>> ();
@@ -358,10 +358,8 @@ namespace System.Diagnostics {
                                mvids.Sort ();
 
                                var sb = new StringBuilder ();
-                               foreach (var mvid in mvids) {
-                                       var mvidStr = mvid.ToString ().ToUpper ();
-                                       sb.AppendLine (string.Format ("{0} {1}", mvid, string.Join (",", mvidLines[mvid])));
-                               }
+                               foreach (var mvid in mvids)
+                                       sb.AppendLine (string.Format ("{0} {1}", mvid.ToString ("N"), string.Join (",", mvidLines[mvid])));
 
                                return sb.ToString ();
                        });
index c2321f523ac48afd0ae618b1c98b1ff9d80b60b6..466f18dc68c82b4bf4fb2d48bd51b7d7faae5540 100644 (file)
@@ -92,7 +92,7 @@ namespace Mono
 
                                        var assembly = AssemblyDefinition.ReadAssembly (assemblyPath);
 
-                                       var mvid = assembly.MainModule.Mvid.ToString ().ToUpper ();
+                                       var mvid = assembly.MainModule.Mvid.ToString ("N");
                                        var mvidDir = Path.Combine (msymDir, mvid);
 
                                        Directory.CreateDirectory (mvidDir);
index ab0911bc677f89e1459c8f7476aff317c5e4eccf..2df6db21ec67febd81d791c9663007b2d3660c01 100644 (file)
@@ -6069,6 +6069,21 @@ mono_guid_to_string (const guint8 *guid)
                                guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
 }
 
+/**
+ * mono_guid_to_string_minimal:
+ *
+ * Converts a 16 byte Microsoft GUID to lower case no '-' representation..
+ */
+char *
+mono_guid_to_string_minimal (const guint8 *guid)
+{
+       return g_strdup_printf ("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+                               guid[3], guid[2], guid[1], guid[0],
+                               guid[5], guid[4],
+                               guid[7], guid[6],
+                               guid[8], guid[9],
+                               guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
+}
 static gboolean
 get_constraints (MonoImage *image, int owner, MonoClass ***constraints, MonoGenericContainer *container, MonoError *error)
 {
index 542f9e108e4c9d4eea8ff0a5fa5ccb556a48a2ca..37c91f1ae80f833f872aee4b8e7f349861d18718 100644 (file)
@@ -480,6 +480,8 @@ MONO_API uint32_t mono_metadata_token_from_dor (uint32_t dor_index);
 
 MONO_API char *mono_guid_to_string (const uint8_t *guid);
 
+MONO_API char *mono_guid_to_string_minimal (const uint8_t *guid);
+
 MONO_API uint32_t mono_metadata_declsec_from_index (MonoImage *meta, uint32_t idx);
 
 MONO_API uint32_t mono_metadata_translate_token_index (MonoImage *image, int table, uint32_t idx);
index 4ce201e75f19a47c06e78b90e98d87492612df37..637e4b61318679686806b910a560a0b666be5538 100644 (file)
@@ -8915,7 +8915,7 @@ emit_exception_info (MonoAotCompile *acfg)
        }
 
        if (seq_points_to_file) {
-               char *aotid = mono_guid_to_string (acfg->image->aotid);
+               char *aotid = mono_guid_to_string_minimal (acfg->image->aotid);
                char *dir = g_build_filename (acfg->aot_opts.gen_msym_dir_path, aotid, NULL);
                char *image_basename = g_path_get_basename (acfg->image->name);
                char *aot_file = g_strdup_printf("%s%s", image_basename, SEQ_POINT_AOT_EXT);