Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would like to try it for native development. How do you run and debug your C++ programs from VSCode?


https://code.visualstudio.com/docs/languages/cpp

> VS Code supports tasks that you can configure to build your application, and natively understands the output of MSBuild, CSC, and XBuild.


Yes, building works well. But how do you run your application?

(To be clear I'm asking what workflow users use personally, since it seems like nobody else has this issue.)


For me, I build on the command line, because I have a funky build process, and then when I want to debug it I just press the 'debug' button.

There's a big JSON file with the debug configurations, and a drop-down to allow you to select which one is active. Each gdb debug configuration lets you specify the usual binary path and command line arguments, plus a whole lot of other configuration I haven't looked at. I haven't had to do any project-style setup --- it just magically finds all my source files.

It looks like it supports gdb on Windows and Linux and lldb on OSX (only ever tested on Linux, though). Out-of-the-box you get sample configurations to both run and attach to a C/C++ binary.

gdb integration is pretty seamless; breakpoints, conditional breakpoints, stack traces, local and global variables. Haven't seen threads, watchpoints, or an assembly window yet. There's a debug console, but entering commands doesn't appear to send them to gdb.

It's one of the best Linux gdb environments I've seen (even though most gdb integrations are terrible).


Threads are part of stack trace - if you look closely, it has nodes for threads, if you have more than one thread running.

If you attach or launch more than one process, that's where they will appear also, as top-level tree nodes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: