villasv
villasv

Reputation: 6861

Debugging Makefile project (mingw-gcc) on Visual Studio

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?

Upvotes: 2

Views: 1830

Answers (1)

Mike Kinghan
Mike Kinghan

Reputation: 61630

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

Upvotes: 3

Related Questions