Skip to content

Commit

Permalink
[mmp] Update code that only considered .mdb (not .pdb) (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
spouliot authored Apr 12, 2017
1 parent 0fe6c07 commit d3d7e67
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
7 changes: 5 additions & 2 deletions tools/common/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Runtime.InteropServices;

using Mono.Cecil;
using Mono.Cecil.Mdb;
using Mono.Cecil.Cil;

using Xamarin.Utils;

Expand Down Expand Up @@ -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));
}

Expand All @@ -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);
}
}

Expand Down
3 changes: 2 additions & 1 deletion tools/common/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions tools/mmp/Tuning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using Xamarin.Utils;

using Mono.Cecil;
using Mono.Cecil.Mdb;
using Mono.Cecil.Cil;

namespace MonoMac.Tuner {

Expand Down Expand Up @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions tools/mmp/driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down

0 comments on commit d3d7e67

Please sign in to comment.