提交 86a81b9a 编写于 作者: J Jason Imison 提交者: Kevin Ransom (msft)

Allow the creation of portable pdb files on Mono (#2808)

* Allow the creation of portable pdb files on Mono

Allows the generation of .pdb files when `--debug:portable` is specified
on the command line. `--debug:full` continues to  generate .mdb files as
before.

* Mono expects major version 0x100, minor version 0x504d

https://github.com/mono/mono/blob/47ca2c886d0ba4ed5cd7bf90a085c7c2f539d0f1/mono/metadata/debug-mono-ppdb.c#L76

CoreCLR expects minor version 0x504d
https://github.com/dotnet/coreclr/blob/a50348830471e9d821da525ed862e72e061b0766/src/ToolBox/SOS/NETCore/SymbolReader.cs#L673

* Update ilwritepdb.fs

* Update ilwritepdb.fs
上级 4dba9f76
......@@ -4189,7 +4189,7 @@ let writeBinaryAndReportMappings (outfile,
begin match pdbfile with
| None -> ()
#if ENABLE_MONO_SUPPORT
| Some fmdb when runningOnMono ->
| Some fmdb when runningOnMono && not portablePDB ->
writeMdbInfo fmdb outfile pdbData
#endif
| Some fpdb ->
......
......@@ -144,8 +144,8 @@ let pdbGetCvDebugInfo (mvid:byte[]) (timestamp:int32) (filepath:string) (cvChunk
Buffer.BlockCopy(path, 0, buffer, offset, size)
buffer
{ iddCharacteristics = 0; // Reserved
iddMajorVersion = 0; // VersionMajor should be 0
iddMinorVersion = 0; // VersionMinor should be 0
iddMajorVersion = 0x0100; // VersionMajor should be 0x0100
iddMinorVersion = 0x504d; // VersionMinor should be 0x504d
iddType = 2; // IMAGE_DEBUG_TYPE_CODEVIEW
iddTimestamp = timestamp;
iddData = iddCvBuffer; // Path name to the pdb file when built
......@@ -198,11 +198,13 @@ let checkSum (url:string) =
//------------------------------------------------------------------------------
// This function takes output file name and returns debug file name.
let getDebugFileName outfile =
let getDebugFileName outfile (portablePDB: bool) =
#if ENABLE_MONO_SUPPORT
if IL.runningOnMono then
if IL.runningOnMono && not portablePDB then
outfile + ".mdb"
else
#else
ignore portablePDB
#endif
(Filename.chopExtension outfile) + ".pdb"
......
......@@ -59,7 +59,7 @@ type PdbData =
/// Takes the output file name and returns debug file name.
val getDebugFileName: string -> string
val getDebugFileName: string -> bool -> string
/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h
val sizeof_IMAGE_DEBUG_DIRECTORY : System.Int32
......
......@@ -2332,12 +2332,12 @@ type TcConfigBuilder =
let pdbfile =
if tcConfigB.debuginfo then
Some (match tcConfigB.debugSymbolFile with
| None -> Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile
| None -> Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile tcConfigB.portablePDB
#if ENABLE_MONO_SUPPORT
| Some _ when runningOnMono ->
// On Mono, the name of the debug file has to be "<assemblyname>.mdb" so specifying it explicitly is an error
warning(Error(FSComp.SR.ilwriteMDBFileNameCannotBeChangedWarning(),rangeCmdArgs))
Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile
Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile tcConfigB.portablePDB
#endif
| Some f -> f)
elif (tcConfigB.debugSymbolFile <> None) && (not (tcConfigB.debuginfo)) then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册