Discussion:
[Mingw-users] Generate PDB files
Victor T.
2010-08-26 21:03:19 UTC
Permalink
Besides, it wouldn't be of use anyway since debug information is somewhat
tied to
the internals of the compiler and it's likely that the Microsoft
debugger would not be able to make sense of gcc's debug data even if gcc
could write it in PDB format -- at least for C++ where the mangling and
ABIs are totally different.
Can someone elaborate on this last point? I'm looking to write a tool for
debug format conversion for interoperability but what Brian mentioned here
has me concerned.

When debugging any compiled binary regardless of the compiler used, can't
they all be debugged at the assembly level? So can't a PDB debug format in
theory map the source line to the corresponding assembly address of a binary
built with say MinGW? What possible roadblocks are there that prevents this
idea from working fully?

Thanks
--
View this message in context: http://old.nabble.com/Generate-PDB-files-tp18268068p29546940.html
Sent from the MinGW - User mailing list archive at Nabble.com.
Greg Chicares
2010-08-26 21:36:06 UTC
Permalink
Post by Victor T.
Besides, it wouldn't be of use anyway since debug information is somewhat
tied to
the internals of the compiler and it's likely that the Microsoft
debugger would not be able to make sense of gcc's debug data even if gcc
could write it in PDB format -- at least for C++ where the mangling and
ABIs are totally different.
Can someone elaborate on this last point? I'm looking to write a tool for
debug format conversion for interoperability but what Brian mentioned here
has me concerned.
C++ name-mangling and ABIs differ...see:
http://www.mingw.org/wiki/MixingCompilers
Kai Tietz
2010-08-27 06:57:43 UTC
Permalink
Post by Victor T.
Besides, it wouldn't be of use anyway since debug information is somewhat
tied to
the internals of the compiler and it's likely that the Microsoft
debugger would not be able to make sense of gcc's debug data even if gcc
could write it in PDB format -- at least for C++ where the mangling and
ABIs are totally different.
Can someone elaborate on this last point? I'm looking to write a tool for
debug format conversion for interoperability but what Brian mentioned here
has me concerned.
 http://www.mingw.org/wiki/MixingCompilers
Well, I spent some time on this subject and you can find the results
at http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-libraries/libmangle/
for libmangle (it got a cygwin package already) and
http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/experimental/tools/libmsdebug/
for some work on PDB file format.
The libmangle can already decode MS encoded names back to human
readable names, and it would be possible to extend it so, that it can
transform mangled names (not complete but as far as possible) to gcc's
encoding. I simply didn't found any time here to continue on it. For
symbol aliasing in import-libraries I've added to gcc the thiscall
convention support (4.6) and to binutils dlltool/ld the feature of
'==' statement in .def files for this.
The PDB library is able to interprete some of the content of PDB file
formats (there are two AFAIK), but needs for sure extensions to. But
it can be used as base for a PDB/dwarf2 converted. The bad point about
PDB file format is, that it is pretty less documented, so a lot of
things are guess-works with verification by testing (as usual).

If you have interest on improving these libraries, feel free to contact me.

Kai
--
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Continue reading on narkive:
Loading...