runtime icon indicating copy to clipboard operation
runtime copied to clipboard

PDB Generation for Crossgen

Open gkhanna79 opened this issue 10 years ago • 16 comments

We need to determine what it means to have PDB/symbol support for crossgen compiled assemblies as part of the open build.

gkhanna79 avatar Feb 11 '16 14:02 gkhanna79

@gkhanna79 @johnchen0 Please keep @kyulee1 and me in the loop on your plans. We have a similar PDB problem with dotnet/runtime#5051, though our needs may only overlap if you're going to support /CreatePDB. At any rate, we should try to share if we can.

RussKeldorph avatar Feb 11 '16 17:02 RussKeldorph

Is there any additional information on this? We'll need this for performance tracing on Windows as well. Thanks.

brianrob avatar Apr 18 '16 18:04 brianrob

@noahfalk Have you had a chance to think about this?

gkhanna79 avatar Apr 18 '16 18:04 gkhanna79

I haven't spent much time on it. Last I heard this wasn't a pressing issue but perhaps something has changed. As far as I knew: a) Debugging scenarios - only need the symbols generated from csc which are already being created b) ICorProfiler scenarios - not officially supported yet and don't depend on symbols directly c) tracing/perf scenarios - we are using perfmap files as a substitute for native symbols. Crossgen is producing PE images rather than native images for Linux/OSX so we'd want to address that first before platform native symbols would be useful.

noahfalk avatar Apr 18 '16 21:04 noahfalk

For tracing/perf, we don’t need PDBs for Linux/OSX, but we do need them for Windows.

From: noahfalk [mailto:[email protected]] Sent: Monday, April 18, 2016 2:44 PM To: dotnet/coreclr [email protected] Cc: Brian Robbins [email protected] Subject: Re: [dotnet/coreclr] PDB Generation for Crossgen (#3131)

I haven't spent much time on it. Last I heard this wasn't a pressing issue but perhaps something has changed. As far as I knew: a) Debugging scenarios - only need the symbols generated from csc which are already being created b) ICorProfiler scenarios - not officially supported yet and don't depend on symbols directly c) tracing/perf scenarios - we are using perfmap files as a substitute for native symbols. Crossgen is producing PE images rather than native images for Linux/OSX so we'd want to address that first before platform native symbols would be useful.

— You are receiving this because you commented. Reply to this email directly or view it on GitHubhttps://github.com/dotnet/coreclr/issues/3131#issuecomment-211595145

brianrob avatar Apr 18 '16 21:04 brianrob

So I'm guessing ngen.exe produces PDBs but for whatever reason crossgen.exe does not? I haven't looked into it at all at this point. Was there anything in particular you were hoping I would look into? I'd imagine its a hopefully straightforward port from ngen.exe to crossgen.exe.

noahfalk avatar Apr 19 '16 01:04 noahfalk

NGEN.exe can produce PDBs. Crossgen.exe produced in legacy internal builds can as well. The open build of crossgen.exe cannot produce PDBs. I'll admit that I don't know why, but I'm sure there's a good reason. @JohnChen0, can you comment on this?

brianrob avatar Apr 19 '16 04:04 brianrob

In order to create PDB, we need to #include <cvinfo.h>, which isn't available to open source. (At least it wasn't available when CrossGen was ported to open source build.)

JohnChen0 avatar Apr 19 '16 05:04 JohnChen0

@noahfalk I'm assuming the unsupported comment is pending confirmation that GetFunctionFromIP on the EIP will work on NGEN and R2R images. The former certainly does on Windows.

While I'm here, is it by design that crossgen doesn't support profile enhanced images? I was thinking of using them to make my life easier to discover FunctionIDs for a profiler test I'm doing. Right now I'll have to do some other hoops to figure out what actually came from an ngen image.

mjsabby avatar Apr 19 '16 07:04 mjsabby

In order to create PDB, we need to #include <cvinfo.h>, which isn't available to open source

@JohnChen0 Is this available in the public VC SDK?

Also, what would be the story for PDB generation for non-Windows for profiling?

gkhanna79 avatar Apr 19 '16 16:04 gkhanna79

With regard to cvinfo.h. it's available in public -- https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h which we're trying to use initially for object writer although we fall back to llvm's header later. BTW aren't we supposed to support portable PDB instead of full PDB for .NET Core consistently working across platforms?

kyulee1 avatar Apr 19 '16 17:04 kyulee1

@mjsabby - by 'the unsupported comment' did you mean 'ICorProfiler scenarios - not officially supported yet and don't depend on symbols directly'? If so what I mean is that there are no tests running which validate that ICorProfiler APIs work as they are supposed to. It might happen that the APIs work, but until we have tests running that can catch regressions and prove the APIs are working I won't claim that the APIs are officially supported.

@gkhanna79 - I hadn't planed to look into generating platform specific symbols formats on non-Windows platforms until crossgen supports platform specific formats for the binary. Right now the binary is still being produced in PE format rendering a platform specific symbols format useless.

@kyulee1 - portable PDB is only capable of representing the symbolic data produced by csc. Once the IL is compiled to a native OS specific format there is additional symbolic data produced that can not be stored in a portable PDB.

noahfalk avatar Apr 19 '16 21:04 noahfalk

@JohnChen0, now that https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h is open source, is there anything blocking us from generating PDBs using crossgen? This is required for profiling on Windows.

@gkhanna79, profiling on Linux is done using PerfMap files. However, we probably could use PDBs if they were possible to generate on Linux (not sure if this is possible or not). That would be a nice thing because it would be one less feature to maintain, and we could potentially teach the Linux perf tool to decode PDBs, which would make it possible to analyze with the perf tool on Linux. Right now, perf can resolve JIT compiled methods, but not pre-compiled methods.

brianrob avatar Apr 22 '16 15:04 brianrob

PR dotnet/coreclr#4572 has added PDB generation to CrossGen for Windows. Still need to investigate how to generate PDB or other type of symbols on other platforms.

JohnChen0 avatar Apr 28 '16 15:04 JohnChen0

Is PDB generation from crossgen only required for profiling scenarios? If so, @brianrob do we expect to enable native profiling support on non-Windows?

gkhanna79 avatar Apr 28 '16 15:04 gkhanna79

Closing as there is no more work required.

gkhanna79 avatar Apr 29 '16 20:04 gkhanna79