Capricornian's blog

By Capricornian, history, 5 years ago, In English

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

My build process (successful)

My debug process (failed, and it keeps getting this state for 2 minutes, then I turn off)

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I had the same problem. When you select your debug type, there are two types of debuggers. The gdb that you were having trouble debugging with, and the lldb. If you use the lldb, your problem will be solved.