From 29b2f65d082aa42ca5b5153b0fb82999bff265ad Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Wed, 12 Apr 2017 15:58:16 -0400 Subject: [PATCH] [mmp] Update code that only considered .mdb (not .pdb) --- tools/common/Application.cs | 7 +++++-- tools/common/Assembly.cs | 3 ++- tools/mmp/Tuning.cs | 6 +++--- tools/mmp/driver.cs | 11 ++++++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/common/Application.cs b/tools/common/Application.cs index f6c2217212c2..28b4d92fc8cd 100644 --- a/tools/common/Application.cs +++ b/tools/common/Application.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using Mono.Cecil; -using Mono.Cecil.Mdb; +using Mono.Cecil.Cil; using Xamarin.Utils; @@ -153,7 +153,7 @@ public static void SaveAssembly (AssemblyDefinition assembly, string destination var main = assembly.MainModule; bool symbols = main.HasSymbols; if (symbols) { - var provider = new MdbReaderProvider (); + var provider = new DefaultSymbolReaderProvider (); main.ReadSymbols (provider.GetSymbolReader (main, main.FileName)); } @@ -166,6 +166,9 @@ public static void SaveAssembly (AssemblyDefinition assembly, string destination string dest_mdb = destination + ".mdb"; if (File.Exists (dest_mdb)) File.Delete (dest_mdb); + string dest_pdb = Path.ChangeExtension (destination, ".pdb"); + if (File.Exists (dest_pdb)) + File.Delete (dest_pdb); } } diff --git a/tools/common/Assembly.cs b/tools/common/Assembly.cs index 4901b9dd77f3..8cf82a75b424 100644 --- a/tools/common/Assembly.cs +++ b/tools/common/Assembly.cs @@ -87,7 +87,8 @@ public void LoadSymbols () symbols_loaded = false; try { - if (File.Exists (FullPath + ".mdb")) { + var pdb = Path.ChangeExtension (FullPath, ".pdb"); + if (File.Exists (pdb) || File.Exists (FullPath + ".mdb")) { AssemblyDefinition.MainModule.ReadSymbols (); symbols_loaded = true; } diff --git a/tools/mmp/Tuning.cs b/tools/mmp/Tuning.cs index 92e5410be903..5825f52db8ab 100644 --- a/tools/mmp/Tuning.cs +++ b/tools/mmp/Tuning.cs @@ -16,7 +16,7 @@ using Xamarin.Utils; using Mono.Cecil; -using Mono.Cecil.Mdb; +using Mono.Cecil.Cil; namespace MonoMac.Tuner { @@ -131,8 +131,8 @@ static LinkContext CreateLinkContext (LinkerOptions options, Pipeline pipeline) context.CoreAction = AssemblyAction.Link; context.LinkSymbols = options.LinkSymbols; if (options.LinkSymbols) { - context.SymbolReaderProvider = new MdbReaderProvider (); - context.SymbolWriterProvider = new MdbWriterProvider (); + context.SymbolReaderProvider = new DefaultSymbolReaderProvider (); + context.SymbolWriterProvider = new DefaultSymbolWriterProvider (); } context.OutputDirectory = options.OutputDirectory; return context; diff --git a/tools/mmp/driver.cs b/tools/mmp/driver.cs index a657e9eb86a3..5960431b30af 100644 --- a/tools/mmp/driver.cs +++ b/tools/mmp/driver.cs @@ -1760,7 +1760,6 @@ static void CopyFileAndRemoveReadOnly (string src, string dest) { static void CopyAssemblies () { foreach (string asm in resolved_assemblies) { - var mdbfile = string.Format ("{0}.mdb", asm); var configfile = string.Format ("{0}.config", asm); string filename = Path.GetFileName (asm); @@ -1770,8 +1769,14 @@ static void CopyAssemblies () { if (verbose > 0) Console.WriteLine ("Added assembly {0}", asm); - if (App.EnableDebug && File.Exists (mdbfile)) - File.Copy (mdbfile, Path.Combine (mmp_dir, Path.GetFileName (mdbfile)), true); + if (App.EnableDebug) { + var mdbfile = asm + ".mdb"; + if (File.Exists (mdbfile)) + File.Copy (mdbfile, Path.Combine (mmp_dir, Path.GetFileName (mdbfile)), true); + var pdbfile = Path.ChangeExtension (asm, ".pdb"); + if (File.Exists (pdbfile)) + File.Copy (pdbfile, Path.Combine (mmp_dir, Path.GetFileName (pdbfile)), true); + } if (File.Exists (configfile)) File.Copy (configfile, Path.Combine (mmp_dir, Path.GetFileName (configfile)), true); }