-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to populate Win64 COFF objects with CodeView dbginfo? #167
Comments
This is a question for @redstar – these sorts of issues are exactly where my Windows dev knowledge is lacking… |
This has a key limitation though; you can't link VC and LDC objects together, since VC produces a PDB for the stuff it compiles, and then cv2pdb overwrites it. The resulting debug info is mutually exclusive. It would certainly be much better if the objects had CV debuginfo, and let link.exe do what it's supposed to do. |
As already discussed on the LLVM list the way to go is to convert the dwarf debugging information to CV or PDB format while writing the COFF file. |
Okay cool. Yeah that's where the LLVM guys ended up too. It seems very indirect. |
Perhaps worth mentioning that Walter has preliminary CV8 support written in DMD-Win64 already, and is continuing to work on it. Perhaps this is a good reference for the debuginfo format. Nice documents! I hope Walter knows about all of those... or have the 2 of you been talking? :) |
I started to implement this. It seems to be easier then expected. The construction of DWARF debug symbols is encapsulated in class If you are curious then you can look at this diff. But there is still a lot to do - the debug symbol encoding is anything than simple. |
Awesome, nice work. |
I still fight with the results of a hard disk failure... Nevertheless I can report some progress here. I started to write the first bits to `.debug$T´ section. And yes, I am aware of the code produced by Walter and I am studying it in case of questions. |
Awesome! I really think this will do a lot of good for Windows users! |
As promise I posted first code to the LLVM commit list. I can already generate the right type information for simple signatures like I now try to emit line information. Then it should be possible to really 'see' something in a debugger. |
@redstar Great and really needed work! |
You sir, are rocking a full jar of awesome sauce! :P .. Walter had some trouble with the call stack too, how's that looking? |
What's the current state of this? |
There is only one improvement. The last missing piece (a special relocation) has been added to LLVM 2 month ago by the Google people. I'll restart work on this as soon as I have some more time. BTW: LLVM has now COFF line number support. I don't know if this helps much... |
That motion from Clang to output objects that were fully compatible with MSVC, how is that going? Will we see MSVC compatible objects from LDC any time soon? :) |
http://clang.llvm.org/docs/MSVCCompatibility.html |
Any recent motion on this issue? |
That and EH. No news on dbginfo. |
I don't use EH, but some libraries (including phobos) use it. Personally, I can work-around EH. Although I'm sure it'll be a massive win for Windows too, I think the debuginfo is the biggest blocker. Nobody I've ever met would dev on Windows without the debugger. People are utterly accustomed to visual studio :) |
Sure, users can avoid EH, but it is a big development issue cause it results in most druntime/phobos unittests crashing which masks potential real ldc problems. Well naturally, the VS debugger kicks ass. I don't know any other one that comes even close. |
Ok now that EH is working this is the number 1 roadblock. |
lists.cs.uiuc.edu/pipermail/cfe-dev/2014-January/034747.html |
Hello, |
Are you able to get source code interleaved with disassembly? https://android.googlesource.com/toolchain/yasm/+/master/modules/dbgfmts/codeview/cv8.txt |
Yeah, I may have some small problems as I still have to setup function prolog/epilog correctly, but I can display disassembly and it seems to correspond to the code. There was not much missing to the existing line table generation to do this in fact, they were juste missing the symbol function declaration. |
The function symbols have just landed in llvm: http://reviews.llvm.org/D5772 |
There is still work on this topic in LLVM: http://reviews.llvm.org/D7153 |
Some more news: Microsoft is going to provide CodeView symbols to LLVM. |
Oh, god almighty, thank you! :P |
I just discover the announcement. It says that they want to introduce new metadata nodes. This could mean that we have to create a 2nd DIBuilder. But I hope that a more generic design emerges. Debug info generation is centralized in the DIBuilder class which should therefore the only class which needs to be enhanced. |
Reading those articles, it looks like they generate CV metadata in Clang independently from DWARF. Kinda looks like the Clang patch is significant, and also requires full duplication in LDC... :/ |
Yes, that's the approach of the RFC. But the first comments in the discussion about the RFC points out that it is better to have an uniform solution. |
That's nice, I didn't read that far. Do you know what this means for de-mangling? Does VS use the prettyName field he refers to to display function names, which we can populate correctly, or would some work be required by MS to have good support? |
I have a different understanding here: he changed the Microsoft Mangler in clang, see http://reviews.llvm.org/D14210#e4b48f2a. |
See #1716 for current state. |
Let's close this then and continue with #1716, as (incomplete) debuginfos are already generated. |
Since LLVM doesn't look like it will support PDB any time soon, and DWARF isn't particularly useful to most windows dev environments, is it possible to populate the COFF objects with CodeView debug info?
MSVC has the (legacy) /Z7 option, which populates the objects with CV debuginfo, which the MS link.exe is still capable if parsing and inserting into the final PDB while linking...
If LLVM/LDC were able to populate the windows objects with CV debuginfo, they may be much more useful when used in typical MSVC dev environments.
The text was updated successfully, but these errors were encountered: