简体   繁体   中英

Vscode C++ debugging code built with cl.exe and / link.exe - debugger doesn't attach

So I have built my build system for my c++ game with gulp.js calling cl.exe and link.exe in order to build the game. I'm producing a build that outputs a pdb file, pretty sure I have all the debugging symbol stuff turned on.

Game builds fine, but I'd like to hook it up to the vscode debugger.

Now the vast majority of setups I've seen online where someone setups a launch.json for the debugger, they are using gdb. I don't mind using gdb, really only care that it works. But i am producing binaries with cl.exe and link.exe. Anyway my launcher will launch the executable just fine, but it's like the debugger doesn't attach. No breakpoints for instance.

Previously I was building with mingw and all was good. I'd like to cl.exe and link.exe instead, but I suspect that this is the reason the debugger isn't attaching.

GDB is not the vscode debugger ; it is a debugger that you might specify in vscode provided you are also using a compiler and linker that generate binaries containing debug info in a form that GDB recognizes.

Microsoft cl and link are not such a compiler and linker. GDB is the GNU debugger , and is supported by GNU GCC compilers - gcc , g++ , gfortran , gnat , gccgo - and GNU binutils linkers . A Microsoft .pdb debugging database does not mean anything to GDB: it is usable only by the MS Visual Studio debugger.

If you compile with cl option /Z7 , then PE/COFF debugging info will be embedded in your object files, and if you link with option /DEBUG:NONE the linker will not generate a .pdb . You might then find that GDB is able to debug your executable satisfactorily, but I can't vouch for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM