Problem when debugging a solution in Visual Studio Code with GDB (C++)

Revision en3, by Capricornian, 2019-07-04 14:49:31

Hello everyone, I'm Capricornian, and I'm using VS Code to code and build my CP submissions.

I'm now using a debug template and stderr for debugging. But I really want to debug my C++ program with GDB for better performance. (I'm using GNU GCC 8.1.0 (MinGW))

And when I try to configure GDB to use on VS Code, I found a very tricky problem, which I try to solve it for many days but it didn't work at all.

On VS Code, you have to configure .vscode folder, which contains 2 most important files launch.json, tasks.json so you can build and debug the program. And here is my launch.json and tasks.json :

(You can see my compiler path inside this file, and you can change it to test on your local computer).

https://pastebin.com/4ddJ4se1 : tasks.json

https://pastebin.com/vM8TkX9X : launch.json

It may looks good and works perfectly, but when I start debugging my program using F5, then VS Code just build my source code (so I have a .exe file) and after that, the PowerShell pops up and try to start a debug process, and then, the process stucked, and I can't debug anything.

I have tried many ways, searched for many websites and applied many fixes, but it still get stucked.

So, please, I need you test these files and please help me find a problem, or show me how did you configure C++ build and debug process in VS Code with no problem.

I will give everything you need to help me solve this mess, so just ask me in the comment section below, I will try to answer ASAP.

I will be very pleased if anyone can help me solve this tricky problem, and thank you very much for that effort.

Best regard,

Capricornian

UPD: Here are the screenshots of my problem

Tags debugging, vscode, gdb

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English Capricornian 2019-07-04 14:53:22 77
en4 English Capricornian 2019-07-04 14:52:25 184
en3 English Capricornian 2019-07-04 14:49:31 120
en2 English Capricornian 2019-07-04 14:47:50 2 Tiny change: 'sks.json\nhttps:/' -> 'sks.json\n\nhttps:/'
en1 English Capricornian 2019-07-04 14:47:25 1737 Initial revision (published)