diff --git a/tools/mtouch/Application.cs b/tools/mtouch/Application.cs index 1d6e4e699c2f..15c4bf5f71d5 100644 --- a/tools/mtouch/Application.cs +++ b/tools/mtouch/Application.cs @@ -87,10 +87,10 @@ public partial class Application public bool EnableCxx; public bool EnableProfiling; - bool? package_mdb; - public bool PackageMdb { - get { return package_mdb.Value; } - set { package_mdb = value; } + bool? package_managed_debug_symbols; + public bool PackageManagedDebugSymbols { + get { return package_managed_debug_symbols.Value; } + set { package_managed_debug_symbols = value; } } bool? enable_msym; public bool EnableMSym { @@ -1222,10 +1222,10 @@ void Initialize () DeploymentTarget = new Version (8, 0); } - if (!package_mdb.HasValue) { - package_mdb = EnableDebug; - } else if (package_mdb.Value && IsLLVM) { - ErrorHelper.Warning (3007, "Debug info files (*.mdb) will not be loaded when llvm is enabled."); + if (!package_managed_debug_symbols.HasValue) { + package_managed_debug_symbols = EnableDebug; + } else if (package_managed_debug_symbols.Value && IsLLVM) { + ErrorHelper.Warning (3007, "Debug info files (*.mdb / *.pdb) will not be loaded when llvm is enabled."); } if (!enable_msym.HasValue) @@ -1875,7 +1875,7 @@ public void BuildMSymDirectory () // copy aot data must be done BEFORE we do copy the msym one CopyAotData (msymdir, target_directory); - // copy all assemblies under mvid and with the dll and mdb + // copy all assemblies under mvid and with the dll and mdb/pdb var tmpdir = Path.Combine (msymdir, "Msym", "tmp"); if (!Directory.Exists (tmpdir)) Directory.CreateDirectory (tmpdir); @@ -1969,7 +1969,7 @@ public void StripNativeCode () public void BundleAssemblies () { - var strip = ManagedStrip && IsDeviceBuild && !EnableDebug && !PackageMdb; + var strip = ManagedStrip && IsDeviceBuild && !EnableDebug && !PackageManagedDebugSymbols; var grouped = Targets.SelectMany ((Target t) => t.Assemblies).GroupBy ((Assembly asm) => asm.Identity); foreach (var @group in grouped) { @@ -1993,10 +1993,10 @@ public void BundleAssemblies () case AssemblyBuildTarget.StaticObject: case AssemblyBuildTarget.DynamicLibrary: if (size_specific) { - assemblies [0].CopyToDirectory (assemblies [0].Target.AppTargetDirectory, copy_mdb: PackageMdb, strip: strip, only_copy: true); - assemblies [1].CopyToDirectory (assemblies [1].Target.AppTargetDirectory, copy_mdb: PackageMdb, strip: strip, only_copy: true); + assemblies [0].CopyToDirectory (assemblies [0].Target.AppTargetDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); + assemblies [1].CopyToDirectory (assemblies [1].Target.AppTargetDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } else { - assemblies [0].CopyToDirectory (AppDirectory, copy_mdb: PackageMdb, strip: strip, only_copy: true); + assemblies [0].CopyToDirectory (AppDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } foreach (var asm in assemblies) asm.CopyAotDataFilesToDirectory (size_specific ? asm.Target.AppTargetDirectory : AppDirectory); @@ -2008,10 +2008,10 @@ public void BundleAssemblies () var target_name = assemblies [0].BuildTargetName; var resource_directory = Path.Combine (AppDirectory, "Frameworks", $"{target_name}.framework", "MonoBundle"); if (size_specific) { - assemblies [0].CopyToDirectory (Path.Combine (resource_directory, Path.GetFileName (assemblies [0].Target.AppTargetDirectory)), copy_mdb: PackageMdb, strip: strip, only_copy: true); - assemblies [1].CopyToDirectory (Path.Combine (resource_directory, Path.GetFileName (assemblies [1].Target.AppTargetDirectory)), copy_mdb: PackageMdb, strip: strip, only_copy: true); + assemblies [0].CopyToDirectory (Path.Combine (resource_directory, Path.GetFileName (assemblies [0].Target.AppTargetDirectory)), copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); + assemblies [1].CopyToDirectory (Path.Combine (resource_directory, Path.GetFileName (assemblies [1].Target.AppTargetDirectory)), copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } else { - assemblies [0].CopyToDirectory (resource_directory, copy_mdb: PackageMdb, strip: strip, only_copy: true); + assemblies [0].CopyToDirectory (resource_directory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } foreach (var asm in assemblies) asm.CopyAotDataFilesToDirectory (size_specific ? Path.Combine (resource_directory, Path.GetFileName (asm.Target.AppTargetDirectory)) : resource_directory); diff --git a/tools/mtouch/Assembly.cs b/tools/mtouch/Assembly.cs index 2ba232581f67..abda0df8a79e 100644 --- a/tools/mtouch/Assembly.cs +++ b/tools/mtouch/Assembly.cs @@ -98,7 +98,7 @@ public void ComputeDependencyMap (List exceptions) } // returns false if the assembly was not copied (because it was already up-to-date). - public bool CopyAssembly (string source, string target, bool copy_mdb = true, bool strip = false) + public bool CopyAssembly (string source, string target, bool copy_debug_symbols = true, bool strip = false) { var copied = false; @@ -117,7 +117,7 @@ public bool CopyAssembly (string source, string target, bool copy_mdb = true, bo } // Update the debug symbols file even if the assembly didn't change. - if (copy_mdb) { + if (copy_debug_symbols) { if (File.Exists (source + ".mdb")) Application.UpdateFile (source + ".mdb", target + ".mdb", true); @@ -134,7 +134,7 @@ public bool CopyAssembly (string source, string target, bool copy_mdb = true, bo return copied; } - public void CopyMdbToDirectory (string directory) + public void CopyDebugSymbolsToDirectory (string directory) { string mdb_src = FullPath + ".mdb"; if (File.Exists (mdb_src)) { @@ -184,7 +184,7 @@ public void CopyConfigToDirectory (string directory) // Aot data is copied separately, because we might want to copy aot data // even if we don't want to copy the assembly (if 32/64-bit assemblies are identical, // only one is copied, but we still want the aotdata for both). - public void CopyToDirectory (string directory, bool reload = true, bool check_case = false, bool only_copy = false, bool copy_mdb = true, bool strip = false) + public void CopyToDirectory (string directory, bool reload = true, bool check_case = false, bool only_copy = false, bool copy_debug_symbols = true, bool strip = false) { var target = Path.Combine (directory, FileName); @@ -197,7 +197,7 @@ public void CopyToDirectory (string directory, bool reload = true, bool check_ca // our Copy code deletes the target (so copy'ing over itself is a bad idea) if (directory != Path.GetDirectoryName (FullPath)) - CopyAssembly (FullPath, target, copy_mdb: copy_mdb, strip: strip); + CopyAssembly (FullPath, target, copy_debug_symbols: copy_debug_symbols, strip: strip); CopySatellitesToDirectory (directory); diff --git a/tools/mtouch/BuildTasks.mtouch.cs b/tools/mtouch/BuildTasks.mtouch.cs index 3eebc2ac71d8..64f137d36f95 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -208,6 +208,9 @@ public override IEnumerable FileDependencies { var mdb = Assembly.FullPath + ".mdb"; if (File.Exists (mdb)) inputs.Add (mdb); + var pdb = Path.ChangeExtension (Assembly.FullPath, ".pdb"); + if (File.Exists (pdb)) + inputs.Add (pdb); var config = Assembly.FullPath + ".config"; if (File.Exists (config)) inputs.Add (config); diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs index d58d6dea14cd..0635defb5cdf 100644 --- a/tools/mtouch/mtouch.cs +++ b/tools/mtouch/mtouch.cs @@ -1,4 +1,4 @@ -// +// // mtouch.cs: A tool to generate the necessary code to boot a Mono // application on the iPhone // @@ -58,7 +58,7 @@ using Mono.Options; using Mono.Cecil; -using Mono.Cecil.Mdb; +using Mono.Cecil.Cil; using Mono.Tuner; using MonoTouch.Tuner; @@ -130,13 +130,6 @@ public static bool Dot { } } - // - // We need to put a hard dep on Mono.Cecil.Mdb.dll so that it get's mkbundled - // -#pragma warning disable 169 - static MdbReader mdb_reader; -#pragma warning restore 169 - static int GetDefaultVerbosity () { var v = 0; @@ -460,7 +453,7 @@ public static string GetAotArguments (Application app, string filename, Abi abi, bool enable_llvm = (abi & Abi.LLVM) != 0; bool enable_thumb = (abi & Abi.Thumb) != 0; bool enable_debug = app.EnableDebug; - bool enable_mdb = app.PackageMdb; + bool enable_debug_symbols = app.PackageManagedDebugSymbols; bool llvm_only = app.EnableLLVMOnlyBitCode; string arch = abi.AsArchString (); @@ -487,7 +480,7 @@ public static string GetAotArguments (Application app, string filename, Abi abi, if (enable_llvm) args.Append ("nodebug,"); - else if (!(enable_debug || enable_mdb)) + else if (!(enable_debug || enable_debug_symbols)) args.Append ("nodebug,"); else if (app.DebugAll || app.DebugAssemblies.Contains (fname) || !sdk_or_product) args.Append ("soft-debug,"); @@ -662,7 +655,7 @@ public static string GenerateMain (Application app, IEnumerable assemb if (app.EnableDebug) sw.WriteLine ("\txamarin_gc_pump = {0};", app.DebugTrack.Value ? "TRUE" : "FALSE"); - sw.WriteLine ("\txamarin_init_mono_debug = {0};", app.PackageMdb ? "TRUE" : "FALSE"); + sw.WriteLine ("\txamarin_init_mono_debug = {0};", app.PackageManagedDebugSymbols ? "TRUE" : "FALSE"); sw.WriteLine ("\txamarin_executable_name = \"{0}\";", assembly_name); sw.WriteLine ("\tmono_use_llvm = {0};", enable_llvm ? "TRUE" : "FALSE"); sw.WriteLine ("\txamarin_log_level = {0};", verbose); @@ -1161,7 +1154,8 @@ static Application ParseArguments (string [] args, out Action a) } } }, - { "package-mdb:", "Specify whether debug info files (*.mdb) should be packaged in the app. Default is 'true' for debug builds and 'false' for release builds.", v => app.PackageMdb = ParseBool (v, "package-mdb") }, + { "package-mdb:", "Specify whether debug info files (*.mdb) should be packaged in the app. Default is 'true' for debug builds and 'false' for release builds.", v => app.PackageManagedDebugSymbols = ParseBool (v, "package-mdb"), true }, + { "package-debug-symbols:", "Specify whether debug info files (*.mdb / *.pdb) should be packaged in the app. Default is 'true' for debug builds and 'false' for release builds.", v => app.PackageManagedDebugSymbols = ParseBool (v, "package-debug-symbols") }, { "msym:", "Specify whether managed symbolication files (*.msym) should be created. Default is 'false' for debug builds and 'true' for release builds.", v => app.EnableMSym = ParseBool (v, "msym") }, { "extension", v => app.IsExtension = true }, { "app-extension=", "The path of app extensions that are included in the app. This must be specified once for each app extension.", v => app.Extensions.Add (v), true /* MSBuild-internal for now */ },