You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
@@ -33,12 +33,31 @@ namespace Pdb2Mdb {
|
||||
var pdb = asm.Name.Name + ".pdb";
|
||||
pdb = Path.Combine (Path.GetDirectoryName (filename), pdb);
|
||||
|
||||
if (!File.Exists (pdb))
|
||||
throw new FileNotFoundException ("PDB file doesn't exist: " + pdb);
|
||||
|
||||
using (var stream = File.OpenRead (pdb)) {
|
||||
if (IsPortablePdb (stream))
|
||||
throw new PortablePdbNotSupportedException ();
|
||||
|
||||
var funcs = PdbFile.LoadFunctions (stream, true);
|
||||
Converter.Convert (asm, funcs, new MonoSymbolWriter (filename));
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsPortablePdb (FileStream stream)
|
||||
{
|
||||
const uint ppdb_signature = 0x424a5342;
|
||||
|
||||
var position = stream.Position;
|
||||
try {
|
||||
var reader = new BinaryReader (stream);
|
||||
return reader.ReadUInt32 () == ppdb_signature;
|
||||
} finally {
|
||||
stream.Position = position;
|
||||
}
|
||||
}
|
||||
|
||||
internal Converter (MonoSymbolWriter mdb)
|
||||
{
|
||||
this.mdb = mdb;
|
||||
@@ -158,6 +177,9 @@ namespace Pdb2Mdb {
|
||||
}
|
||||
}
|
||||
|
||||
public class PortablePdbNotSupportedException : Exception {
|
||||
}
|
||||
|
||||
class Driver {
|
||||
|
||||
static void Main (string [] args)
|
||||
@@ -170,25 +192,16 @@ namespace Pdb2Mdb {
|
||||
if (!File.Exists (asm))
|
||||
Usage ();
|
||||
|
||||
var assembly = AssemblyDefinition.ReadAssembly (asm);
|
||||
|
||||
var pdb = assembly.Name.Name + ".pdb";
|
||||
pdb = Path.Combine (Path.GetDirectoryName (asm), pdb);
|
||||
|
||||
if (!File.Exists (pdb))
|
||||
Usage ();
|
||||
|
||||
using (var stream = File.OpenRead (pdb)) {
|
||||
Convert (assembly, stream, new MonoSymbolWriter (asm));
|
||||
}
|
||||
}
|
||||
|
||||
static void Convert (AssemblyDefinition assembly, Stream pdb, MonoSymbolWriter mdb)
|
||||
{
|
||||
try {
|
||||
Converter.Convert (assembly, PdbFile.LoadFunctions (pdb, true), mdb);
|
||||
} catch (Exception e) {
|
||||
Error (e);
|
||||
Converter.Convert (asm);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Usage ();
|
||||
} catch (PortablePdbNotSupportedException) {
|
||||
Console.WriteLine ("Error: A portable PDB can't be converted to mdb.");
|
||||
Environment.Exit (2);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Error (ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +217,8 @@ namespace Pdb2Mdb {
|
||||
{
|
||||
Console.WriteLine ("Fatal error:");
|
||||
Console.WriteLine (e);
|
||||
|
||||
Environment.Exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user