Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ echo BUILD_CONFIG=%BUILD_CONFIG%
echo BUILD_CONFIG_LOWERCASE=%BUILD_CONFIG_LOWERCASE%
echo.

REM Remove lingering copies of the OSS FSharp.Core from the GAC
gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"

if "%RestorePackages%"=="" (
set RestorePackages=true
set RestorePackages=true
)

@echo on
Expand Down Expand Up @@ -210,10 +213,12 @@ set msbuildflags=/maxcpucount
set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe"
if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure

%_ngenexe% install .\.nuget\NuGet.exe
if '%RestorePackages%' == 'true' (
%_ngenexe% install .\.nuget\NuGet.exe

.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config
@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure
)

set DOTNET_HOME .\packages\dotnet

Expand Down Expand Up @@ -253,14 +258,14 @@ if '%BUILD_PROTO%' == '1' (
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure
)

%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure

%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG%
%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure

%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: library build failed && goto :failure

if '%BUILD_FSHARP_DATA_TYPEPROVIDERS%' == '1' (
%_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG%
%_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: type provider build failed && goto :failure
)

Expand All @@ -270,6 +275,11 @@ if '%BUILD_CORECLR%' == '1' (

%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages%
@if ERRORLEVEL 1 echo Error: compiler coreclr build failed && goto :failure

if '%TEST_CORECLR%' == '1' (
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG%
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure
)
)

if '%BUILD_PORTABLE%' == '1' (
Expand Down Expand Up @@ -318,9 +328,6 @@ if '%BUILD_VS%' == '1' (
@echo on
call src\update.cmd %BUILD_CONFIG_LOWERCASE% -ngen

REM Remove lingering copies of the OSS FSharp.Core from the GAC
gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"

REM This clobbers the installed F# SDK on the machine
REM call vsintegration\update-vsintegration.cmd %BUILD_CONFIG_LOWERCASE%
pushd tests
Expand Down
4 changes: 4 additions & 0 deletions packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
<package id="NUnit" version="3.0.0" targetFramework="net45" />
<package id="NUnit.Console" version="3.0.0" targetFramework="net45" />
<package id="NUnitLite" version="3.0.0" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.2.0-rc3-23805" />
<package id="System.Reflection.Metadata" version="1.3.0-beta-23816" />
<package id="Microsoft.DiaSymReader.PortablePdb" version="1.0.0-rc-60301" />
<package id="Microsoft.DiaSymReader" version="1.0.7" />
</packages>
5 changes: 5 additions & 0 deletions src/FSharpSource.targets
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
<IntermediateOutputPath>obj\$(Configuration)\$(TargetFramework)\</IntermediateOutputPath>
</PropertyGroup>

<!-- Produce portable pdbs -->
<PropertyGroup Condition="'$(Configuration)'!='Proto'">
<OtherFlags>$(OtherFlags) --debug:portable</OtherFlags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it should be possible to produce multiple different debug formats in a single compilation. It seems that would be very useful in build-server situations for library packages. Have you considered this? Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not possible. PE file can only reference a single PDB. Once implemented our symbol server publishing tool will however be able to publish both Windows and Portable PDB into the symbol store so that consumer (debuggers) can fetch the most appropriate format for their platform. To publish both PDBs you'd compile your project with Windows PDB (on Windows machine). The symbol publishing tool will have an option to translate Windows PDB to Portable PDB and upload both.

</PropertyGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);OPEN_BUILD</DefineConstants>
<!-- Disable uwa toolchain nuget package resolve logic. -->
Expand Down
16 changes: 7 additions & 9 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4504,20 +4504,18 @@ type ILGlobals with
| Some res -> res

member this.mkDebuggerStepThroughAttribute() = mkILCustomAttribute this (mkSystemDiagnosticsDebugTypeRef this tname_DebuggerStepThroughAttribute, [], [], [])
member this.mkDebuggableAttribute (jitTracking, jitOptimizerDisabled) =
mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool jitTracking; ILAttribElem.Bool jitOptimizerDisabled], [])
member this.mkDebuggableAttribute (jitOptimizerDisabled) =
mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool false; ILAttribElem.Bool jitOptimizerDisabled], [])


member this.mkDebuggableAttributeV2(jitTracking, ignoreSymbolStoreSequencePoints, jitOptimizerDisabled,enableEnC) =
member this.mkDebuggableAttributeV2(ignoreSymbolStoreSequencePoints, jitOptimizerDisabled, enableEnC) =
let tref = mkSystemDiagnosticsDebuggableTypeRef this
mkILCustomAttribute this
(tref,[mkILNonGenericValueTy (tref_DebuggableAttribute_DebuggingModes this)],
[ILAttribElem.Int32(
(* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
(if jitTracking then 1 else 0) |||
(if jitOptimizerDisabled then 256 else 0) |||
(if ignoreSymbolStoreSequencePoints then 2 else 0) |||
(if enableEnC then 4 else 0))],[])
(* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
[ILAttribElem.Int32( (if jitOptimizerDisabled then 256 else 0) |||
(if ignoreSymbolStoreSequencePoints then 2 else 0) |||
(if enableEnC then 4 else 0))],[])

member this.mkCompilerGeneratedAttribute () = mkILCustomAttribute this (tref_CompilerGeneratedAttribute this, [], [], [])

Expand Down
6 changes: 3 additions & 3 deletions src/absil/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1775,9 +1775,9 @@ type ILGlobals =
mutable debuggerTypeProxyAttributeCache : ILAttribute option }

with
member mkDebuggableAttribute: bool (* debug tracking *) * bool (* disable JIT optimizations *) -> ILAttribute
/// Some commonly used custom attibutes
member mkDebuggableAttributeV2 : bool (* jitTracking *) * bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute
member mkDebuggableAttribute: bool (* disable JIT optimizations *) -> ILAttribute
/// Some commonly used custom attibutes
member mkDebuggableAttributeV2 : bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute
member mkCompilerGeneratedAttribute : unit -> ILAttribute
member mkDebuggerNonUserCodeAttribute : unit -> ILAttribute
member mkDebuggerStepThroughAttribute : unit -> ILAttribute
Expand Down
10 changes: 3 additions & 7 deletions src/absil/ildiag.fs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

/// Configurable AppDomain-global diagnostics channel for the Abstract IL library
///
/// REVIEW: review if we should just switch to System.Diagnostics
/// Configurable Diagnostics channel for the Abstract IL library

module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics

open Internal.Utilities

open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.Internal

let diagnosticsLog = ref (Some stdout)
let dflushn () = match !diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush()
let dflush () = match !diagnosticsLog with None -> () | Some d -> d.Flush()
let dprintn (s:string) =
match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()
match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush()

let dprintf (fmt: Format<_,_,_,_>) =
Printf.kfprintf dflush (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt
Expand Down
3 changes: 0 additions & 3 deletions src/absil/ildiag.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics

open System.IO
open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.Internal
open Microsoft.FSharp.Core.Printf

val public setDiagnosticsChannel: TextWriter option -> unit
Expand All @@ -19,4 +17,3 @@ val public dprintfn: TextWriterFormat<'a> -> 'a
val public dprintf: TextWriterFormat<'a> -> 'a

val public dprintn: string -> unit

15 changes: 15 additions & 0 deletions src/absil/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open System.Collections
open System.Collections.Generic
open Internal.Utilities
open Internal.Utilities.Collections
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics

// Logical shift right treating int32 as unsigned integer.
// Code that uses this should probably be adjusted to use unsigned integer types.
Expand All @@ -25,6 +26,20 @@ let isNonNull (x : 'T) = match (x :> obj) with null -> false | _ -> true
let nonNull msg x = if isNonNull x then x else failwith ("null: " ^ msg)
let (===) x y = LanguagePrimitives.PhysicalEquality x y

//---------------------------------------------------------------------
// Library: ReportTime
//---------------------------------------------------------------------
let reportTime =
let tFirst = ref None
let tPrev = ref None
fun showTimes descr ->
if showTimes then
let t = System.Diagnostics.Process.GetCurrentProcess().UserProcessorTime.TotalSeconds
let prev = match !tPrev with None -> 0.0 | Some t -> t
let first = match !tFirst with None -> (tFirst := Some t; t) | Some t -> t
dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr
tPrev := Some t

//-------------------------------------------------------------------------
// Library: projections
//------------------------------------------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions src/absil/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ let readBlobHeapAsDouble ctxt vidx = fst (sigptrGetDouble (readBlobHeap ctxt vid
// (e) the start of the native resources attached to the binary if any
// ----------------------------------------------------------------------*)

#if FX_NO_PDB_READER
#if FX_NO_LINKEDRESOURCES
let readNativeResources _ctxt = []
#else
let readNativeResources ctxt =
Expand Down Expand Up @@ -3959,10 +3959,11 @@ let mkDefault ilg =
pdbPath= None;
ilGlobals = ilg }

let ClosePdbReader pdb =
#if FX_NO_PDB_READER
let ClosePdbReader _x = ()
ignore pdb
()
#else
let ClosePdbReader pdb =
match pdb with
| Some (pdbr,_) -> pdbReadClose pdbr
| None -> ()
Expand Down
14 changes: 2 additions & 12 deletions src/absil/ilsupp.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ let check _action (hresult) =
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult)
//printf "action = %s, hresult = 0x%nx \n" action hresult

// Depending on the configuration, we may want to include the output file extension in the name
// of the debug symbols file. This function takes output file name and returns debug file name.
let getDebugFileName outfile =
#if ENABLE_MONO_SUPPORT
if IL.runningOnMono then
outfile+".mdb"
else
#endif
(Filename.chopExtension outfile)+".pdb"

type PEFileType = X86 | X64

let MAX_PATH = 260
Expand Down Expand Up @@ -1018,13 +1008,13 @@ type ISymUnmanagedWriter2 =

type PdbWriter = { symWriter : ISymUnmanagedWriter2 }
type PdbDocumentWriter = { symDocWriter : ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *)
#endif
type idd =
{ iddCharacteristics: int32;
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddType: int32;
iddData: byte[];}
#endif

#if FX_NO_PDB_WRITER
#else
Expand Down Expand Up @@ -1147,7 +1137,7 @@ let pdbDefineSequencePoints (writer:PdbWriter) (docWriter: PdbDocumentWriter) (p
let endColumns = (Array.map (fun (_,_,_,_,x) -> x) pts)
writer.symWriter.DefineSequencePoints(docWriter.symDocWriter, pts.Length, offsets, lines, columns, endLines, endColumns)

let pdbGetDebugInfo (writer: PdbWriter) =
let pdbWriteDebugInfo (writer: PdbWriter) =
let mutable iDD = new ImageDebugDirectory()
let mutable length = 0
writer.symWriter.GetDebugInfo(&iDD, 0, &length, null)
Expand Down
14 changes: 2 additions & 12 deletions src/absil/ilsupp.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ val pdbReadClose: PdbReader -> unit

val absilWriteGetTimeStamp: unit -> int32


open System
open System.Runtime.InteropServices
#if FX_NO_SYMBOLSTORE
Expand All @@ -37,10 +36,6 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL
type IStream = System.Runtime.InteropServices.ComTypes.IStream
#endif


/// Takes the output file name and returns debug file name.
val getDebugFileName: string -> string

/// Unmanaged resource file linker - for native resources (not managed ones).
/// The function may be called twice, once with a zero-RVA and
/// arbitrary buffer, and once with the real buffer. The size of the
Expand Down Expand Up @@ -102,19 +97,14 @@ val pdbVariableGetAddressAttributes: PdbVariable -> int32 (* kind *) * int32 (*
//---------------------------------------------------------------------

type PdbDocumentWriter
#endif

#if FX_NO_LINKEDRESOURCES
#else
type idd =
{ iddCharacteristics: int32;
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddType: int32;
iddData: byte[];}
#endif
#if FX_NO_PDB_WRITER
#else

val pdbInitialize:
string (* .exe/.dll already written and closed *) ->
string (* .pdb to write *) ->
Expand All @@ -130,7 +120,7 @@ val pdbCloseScope: PdbWriter -> int -> unit
val pdbDefineLocalVariable: PdbWriter -> string -> byte[] -> int32 -> unit
val pdbSetMethodRange: PdbWriter -> PdbDocumentWriter -> int -> int -> PdbDocumentWriter -> int -> int -> unit
val pdbDefineSequencePoints: PdbWriter -> PdbDocumentWriter -> (int * int * int * int * int) array -> unit
val pdbGetDebugInfo: PdbWriter -> idd
val pdbWriteDebugInfo: PdbWriter -> idd
#endif

//---------------------------------------------------------------------
Expand Down
Loading