Skip to content

Conversation

@KevinRansom
Copy link
Contributor

This PR implements support for portable pdbs.

  1. The coreclr version of the compiler will produce portable pdbs only
  2. The desktop version of the compiler will produce desktop, or portable pdbs

I am still trying to decide how to support full pdbs on the coreclr compiler, originally I thought that we would desktop PDBs from the coreclr compiler on Linux and osx, even though the pdbs would only be useful on the windows desktop. However the format for desktop pdbs is pretty complex and not well documented. And so I may move to a model where the coreclr compiler only supports producing full pdbs on the windows desktop.

From CLR v2.0 the CLR ignores jittracking field of DebuggableAttribute. there is a bug on CORECLR when this attribute is set to true, internals visible doesn't work. The CoreClr bug fix will be to also ignore it, so, I have also removed the compiler control over this setting.

There is some additional clean up with namespaces and related PDB functions.

I value your thoughts on this.

The PR also includes a number of minor changes, to enable the coreclr build to work on a machine with VS2015 and VS v.Next.

@Microsoft/fsharp-compiler
Kevin

@smoothdeveloper
Copy link
Contributor

And so I may move to a model where the coreclr compiler only supports producing full pdbs on the windows desktop.

I don't know the differences between full and coreclr pdbs, if full pdbs aren't usable outside of windows, why would we want the coreclr compiler to support emitting them even on windows?

I guess it would help the debugging story on windows, maybe you can give few hints on what are the implication / benefits of supporting full pdb in this case.

I'm just thinking to start out, supporting the compiler's target type of pdb should be good enough first target, but I'm probably very oblivious of the myriad of considerations against this first stance.

Please give us more insight on matter of the choice!

// From ECMA for UserStrings:
// This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following:
// 0x010x08, 0x0E0x1F, 0x27, 0x2D,
// 0x010x08, 0x0E0x1F, 0x27, 0x2D,
Copy link
Contributor

Choose a reason for hiding this comment

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

probably not intended

@smoothdeveloper
Copy link
Contributor

Made few stylistics comments over a short review that can be discarded if not relevant.

Though, it seems there is code going to be duplicated to support both full pdb and portable pdb, WritePdbInfo / WritePortablePdbInfo. I believe it should warrant either simple factorization, or even maybe a higher level of abstraction to give the overview of stages/steps relevant to both implementations.

I know this comes with a risk while making changes to either of supported pdb formats, but on the other hand, extending the support for both formats would will be easier if the top level structure is more apparent and parts of implementation that needs to stay identical are properly factorized.

@jaredpar
Copy link
Member

jaredpar commented Mar 5, 2016

CC @tmat

let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length

let s1, s2 = '/', '\\'
let separator = if (count name s1) >= (count name s2) then s1 else s2
Copy link

Choose a reason for hiding this comment

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

let separator = System.IO.Path.DirectorySeparatorChar

docs.[i].File

let getDocumentHandle d =
if docs.Length = 0 || d < 0 || d > docs.Length then
Copy link

Choose a reason for hiding this comment

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

if d < 0 || d >= docs.Length then or remove the if entirely.


<!-- 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.

src/absil/il.fs Outdated
[ILAttribElem.Int32(
(* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
(if jitTracking then 1 else 0) |||
(0) |||
Copy link
Contributor

Choose a reason for hiding this comment

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

Just remove this line :) However I have to ask: would it reduce risk to leave this in, just in case some tool (e.g. Mono?) pays attention to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh!!!! I couldn't see the wood for the trees.

@dsyme
Copy link
Contributor

dsyme commented Mar 8, 2016

This looks great!

My main comment is this one: #999

Thanks
don

KevinRansom added a commit that referenced this pull request Mar 9, 2016
Implement Support for portable pdbs
@KevinRansom KevinRansom merged commit 74ef502 into dotnet:coreclr Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants