2

I installed MinGW and created a makefile project on Visual Studio Community 2015 today and got it working for compilation.

Still two things are bugging me:

Interface

I can't tell Visual Studio to prevent closing the console window after running the program. Even Start Without Debugging closes the window and the project properties are not the same as a normal VS project, so I don't know how to configure this.

Debugging

Setting breakpoints is hopeless. Apparently the debugger won't understand debug info from files compiled with other compilers. I get Module was built without symbols..

I've tried setting up gdb according to this answer, but then starting the debugger lead me to this window: enter image description here which indicates that the executable has indeed debugging symbols (I'm compiling with -g)

I can feel I'm getting pretty close. What am I missing?

Community
  • 1
  • 1
villasv
  • 6,304
  • 2
  • 44
  • 78

1 Answers1

3

mingw-gcc generates DWARF format debugging information in its executables. The Visual Studio debugger expects separate PDB debugging files as produced by Microsoft's compilers. It can't recognize DWARF.

You can debug MinGW executables either with the gdb console, as you have almost started to do, or for "visual" debugging you can do it in an IDE that supports gdb, on Windows, such as CodeLite, Eclipse-CDT, CodeBlocks. If you are wedded to Visual Studio you might try your luck with Microsoft's open sourced Visual Studio MI Debug Engine , which according to its blurb "enables debugging with debuggers that support the gdb Machine Interface ("MI") specification such as GDB, LLDB, and CLRDBG". I know nothing more about it

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
  • So the bottom line is: it can't be done? If that is the case, I'll accept this as an answer anyway... :( – villasv Oct 17 '15 at 15:07
  • 2
    You can't use the VS debugger when the debugging info in the target is in dwarf format or anything but pdb. You can't direct GCC to generate pdb debugging info. The Microsoft and GCC toolchains are from different worlds. [cv2pdb](https://github.com/rainers/cv2pdb) is an open-source tool that might correctly generate a pdb database from your dwarf executables, but you'd have to rerun it after every change. – Mike Kinghan Oct 17 '15 at 16:10