Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

[Mdb] Mdb(Mono debug symbols file) emitting support added #4

Merged
merged 1 commit into from
Dec 22, 2014
Merged

[Mdb] Mdb(Mono debug symbols file) emitting support added #4

merged 1 commit into from
Dec 22, 2014

Conversation

DavidKarlas
Copy link
Member

First I will explain files...

  • Files MonoSymbolFile.cs, MonoSymbolTable.cs, MonoSymbolWriter.cs and SourceMethodBuilder.cs are copy pastes from mono/Mono.CompilerServices.SymbolWriter. There are minimal modifications like MD5 creation, opening files with PclFileAccess, added method SetMethodUnit to be able to set unit later because in ISymUnmanagedWriter2 it's not know at time of opening...
  • PclFileAccess.cs file is workaround Pcl limitations to access file operations...
  • PdbWriter.cs detect if we are on Mono and if we are use MdbWriter instead of pdb...
  • MdbWriter.cs is implementation of ISymUnmanagedWriter2 which is basiclly just proxy between Roslyn .pdb emitting and MonoSymbolWriter.cs

Ok so... Lets list problems...

  • MdbWriter is used automaticlly(always) when running on Mono and never on .Net... Could be improved with some flag like /debugformat:pdb/mdb but would require many changes in Roslyn files(problems with future merging)
  • Use of reflection... "Initialize (object emitter, string filename, object ptrIStream, bool fullBuild)" call us with COMWrapped objects and so I didn't want to access stupid COM API so I just reflection extract .Net private field objects... I could probably achieve same thing without reflection(not 100% will investigate if this is problem)...
  • I couldn't find way where I can access assembly GUID which must be same in MDB/PDB and assembly... I had to use reflection again to access "guidIndex" inside "writer" and fetch GUID with id 1.
  • Roslyn send us Stream of PDB file and we don't use it... which creates empty(0 bytes) .pdb next to assembly and our .mdb file...
  • See methods in "Used by Roslyn but not implemented" region... I'm mostly unsure about "UsingNamespace" and what is used for because some namespaces are in .mdb but Mono Runtime is not using those values...
  • Also method GetDebugInfo returns 0 and I'm not sure if this is ok...
  • Exception NotUsedInRoslynException is used to detect some changes if Roslyn start using some methods that we are not aware...

I tested this output with XS unit tests and all tests passed. I used a bit different version(one which removes "hidden"(0xfeefee lines) SequencePoints because MonoRuntime atm handles this seqPoints wrong(it should just ignore... will open PR on Runtime). I like to think this implementation is better then mcs.exe(Bug 25358) or pdb2mdb(Bug 25357) since this works :)

marek-safar added a commit that referenced this pull request Dec 22, 2014
[Mdb] Mdb(Mono debug symbols file) emitting support added
@marek-safar marek-safar merged commit 6e57a05 into mono:master Dec 22, 2014
marek-safar pushed a commit that referenced this pull request Feb 17, 2015
added a space to experience e2e getting sources, making change, and subm...
@davidfowl
Copy link

@DavidKarlas @marek-safar Are you guys producing builds of this anywhere?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants