简体   繁体   English

使用cl.exe和/ link.exe构建的Vscode C ++调试代码-调试器未附加

[英]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. 因此,我使用gulp.js调用cl.exe和link.exe为我的c ++游戏构建了构建系统,以构建游戏。 I'm producing a build that outputs a pdb file, pretty sure I have all the debugging symbol stuff turned on. 我正在生成一个输出pdb文件的构建,很确定我已打开所有调试符号。

Game builds fine, but I'd like to hook it up to the vscode debugger. 游戏构建良好,但我想将其连接到vscode调试器。

Now the vast majority of setups I've seen online where someone setups a launch.json for the debugger, they are using gdb. 现在,我在网上看到了绝大多数设置,其中有人为调试器设置了launch.json,他们正在使用gdb。 I don't mind using gdb, really only care that it works. 我不介意使用gdb,实际上只是在乎它是否有效。 But i am producing binaries with cl.exe and link.exe. 但是我正在用cl.exe和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. 以前我是与mingw一起建造的,一切都很好。 I'd like to cl.exe and link.exe instead, but I suspect that this is the reason the debugger isn't attaching. 我想改用cl.exe和link.exe,但是我怀疑这是调试器未附加的原因。

GDB is not the vscode debugger ; GDB不是vscode调试器 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. 如果您还使用编译器和链接器,则可以在vscode中指定它是一个调试器,该编译器和链接器会以GDB识别的形式生成包含调试信息的二进制文件。

Microsoft cl and link are not such a compiler and linker. Microsoft cllink并不是这样的编译器和链接器。 GDB is the GNU debugger , and is supported by GNU GCC compilers - gcc , g++ , gfortran , gnat , gccgo - and GNU binutils linkers . GDB是GNU调试器 ,并且受GNU GCC编译器( gccg++gfortrangnatgccgoGNU binutils链接器)支持 A Microsoft .pdb debugging database does not mean anything to GDB: it is usable only by the MS Visual Studio debugger. Microsoft .pdb调试数据库对GDB没有任何意义:它仅可由MS Visual Studio调试器使用。

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 . 如果使用cl选项/Z7编译,则PE/COFF调试信息将嵌入在目标文件中,并且如果使用选项/DEBUG:NONE链接,则链接器将不会生成.pdb You might then find that GDB is able to debug your executable satisfactorily, but I can't vouch for this. 然后,您可能会发现GDB能够令人满意地调试可执行文件,但是我不能为此提供担保。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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