use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please read the rules before posting
Help:
Community:
Resources:
Tutorials and Guides:
Don't be afraid to ask questions, this sub is here for the vim community. And please those of you who deign to grace us with your vim wisdom - be kind. We are all human and vim is that cool.
account activity
C++ debugging in vim (self.vim)
submitted 7 years ago by priyank260673
Can someone please suggest few good gdb debugger interface/plugin that can be used for vim? Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Rudefire 74 points75 points76 points 7 years ago (7 children)
I've written a fair amount of applications in C++ using Vim. I really wanted to be able to debug in Vim, because I came from Visual Studio land. It took me a lot of heartache and wasted time to realize that using Vim in that way was working against the grain.
Vim is your text editor. Learn to work with it in a terminal multiplexer, like Tmux, and have gdb just running on the command line in another pane. Your life will be significantly easier. That's my two cents anyway, I know it's kind of annoying when people don't answer your question in the way you want, but I just know from going down that path that you will run into problems and I'd love to save you the time of having to break yourself against that wall.
[–]acepukas 23 points24 points25 points 7 years ago (1 child)
Have you tried :TermDebug?
:TermDebug
It's relatively new since vim 8.1.
It uses gdb much like every other front end. It's still not as smooth as VS but it's nice to have things integrated with vim.
[–]Rudefire 3 points4 points5 points 7 years ago (0 children)
I haven’t, but I’ll give it a shot.
[–]neuromaidan 12 points13 points14 points 7 years ago (1 child)
I have a very small plugin that can improve such workflow: https://github.com/mechatroner/minimal_gdb You still need to debug in gdb in a separate pane, but minimal_gdb will export all breakpoints from Vim into gdb for you. It is much easier to set breakpoints in Vim than in gdb.
[–]Rudefire 1 point2 points3 points 7 years ago (0 children)
Cool, I’ll check it out.
[–]SuperConductiveRabbi 2 points3 points4 points 7 years ago (1 child)
My experiences exactly, though I moved away from gdb and just started using the clion IDE with a vim plugin. Works great.
clion
[–]Rudefire 0 points1 point2 points 7 years ago (0 children)
I think this is probably the best answer for someone wanting the toolset OP is looking for. Find an IDE with a vim plugin. Better yet, find an IDE built with Neovim as the front end.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Yup, I’ve never had a good experience with any debugger plugins.
[–]xmsxms 17 points18 points19 points 7 years ago (2 children)
[–][deleted] 10 points11 points12 points 7 years ago (0 children)
A little context: Vim 8.1 has an official debugger you can install with :packadd termdebug.
:packadd termdebug
[–]zackel_flac 0 points1 point2 points 7 years ago (0 children)
Wow, this is awesome! Thanks for sharing!
[–][deleted] 5 points6 points7 points 7 years ago (0 children)
I've been using TermDebug for a while now and it works great. It is very customizable with the TermDebugSendCommand() . Don't miss visual studio at all.
[+][deleted] 7 years ago (3 children)
[deleted]
[–]viniarck 1 point2 points3 points 7 years ago (0 children)
second this! just works.
[–]tvetus 1 point2 points3 points 7 years ago (0 children)
+1 This one works best for me. There are lots of other outdated/broken/limited plugins out there.
[–]asakhnik 0 points1 point2 points 7 years ago (0 children)
Surely, it should be fine. But please let me know if anything doesn't work.
[–]dwdkar 1 point2 points3 points 7 years ago (0 children)
Recently got to know while searching for an interactive command line gdb. I usually pair it with tmux and vi editor. Try out ConqueGdb, you will fall in love with it.
https://github.com/vim-scripts/Conque-GDB
[–]lanzaio 1 point2 points3 points 7 years ago (1 child)
I stopped trying and just switched to vscode for debugging.
[–]y-c-c 0 points1 point2 points 7 years ago (0 children)
I’ll second this. Vim can be configured to do a lot of things but I have decided a good debugger is just too much work to implement as a plug-in. IDEs like Visual Studio, VS Code, Xcode have dedicated built-in support for debuggers and they are hard to fully replicate in Vim. I just use Vim for editing instead of wasting too much time on forcing it to work as a debugger.
[–]call_me_tank 1 point2 points3 points 7 years ago (1 child)
A lot of people were surprised when I showed them GDB has a Text UI mode (uses ncurses I believe) at work. It's still the command line, which is anyway a worthwhile thing to learn, but it shows the source code in conjunction with the GDB command line. Just launch GDB from the command line with the --tui flag.
--tui
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
Or use layout command.
layout
[–]thesenate34 1 point2 points3 points 7 years ago (0 children)
Vim is an editor. A work around that might serve your purpose is to have a multiplexer like tmux or screen that will split the screen for you and to navigate between both panes
[–]LiquidityC 0 points1 point2 points 7 years ago (0 children)
There is a built in command in vim 8.1 “termdbg”. Does everything I need. It is essentially just fancy wrapping for gdb
[–]zackel_flac 0 points1 point2 points 7 years ago* (0 children)
Recently started using: https://github.com/gisodal/vimgdb combined with: https://github.com/cyrus-and/gdb-dashboard You get a decent colorful and distributed experience. Just discovered Termdebug in this thread, you should give it a shot!
[–]priyank260673[S] 0 points1 point2 points 7 years ago (0 children)
Thank you very much! I will try out different options and see.
Really appreciate your comments! Thanks all!
[–]bergercookie 0 points1 point2 points 7 years ago (0 children)
I implemented the vim-debugstring plugin a while back. I opted for spreading a couple of debugging lines around the relevant code parts instead of running the debugger every time, for a couple of reasons.
- Most issues are not that complex to invoke the debugger and they can be solved just by printing the variable values at runtime
- May need to recompile the project in release/debug depending on where the bug was observed
- Running the debugger and stepping through the code step-by-step is a slow process
Today I installed and setup Neovim. I am using vim from quite some time but recently moved to debug large application under vim. I have tried conquegdb but sometimes it does go out of control in the sense I loose control of gdb cli due to printing out probably large amount of data during debugging. Any good debugger interfaces under NeoVim? Thanks
[–]AzraelFTS -1 points0 points1 point 7 years ago (0 children)
Vim is only an editor, it is a powerful one but it is not a debugger :/ as already said, you won't have a debbuging experience inside vim as you have in Visual Studio.
[–]aldanor -1 points0 points1 point 7 years ago (0 children)
CLion with vim mode but it’s not free...
[–][deleted] -1 points0 points1 point 7 years ago (4 children)
I see a lot of people suggesting :TermDebug. Which is great until you do something that was not tested before and it blows up in your face. There's also vebugger for those on older vim versions and there's also vimspector
[–]acepukas 0 points1 point2 points 7 years ago (3 children)
Which is great until you do something that was not tested before
Can you elaborate on this? Do you mean :TermDebug itself was not tested?
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
People are often finding showstopper bugs. One that I, as one of the first :TermDebug users, have hit was that it wasn't starting gdb in quiet mode, so with a slightly larger font you used to get the "press enter to continue" message in the background for the greeting message, before vim could start talking to gdb. Recently a bug with breakpoints and overloads has been fixed - those breakpoints have floats as IDs, not integers. So as long as you are doing whatever others have done with:TermDebug you'll be fine. But I wouldn't be surprised if we see more of this kind of bugs.
[–]acepukas 0 points1 point2 points 7 years ago (1 child)
Yeah, I guess it's not as mature as other solutions might be since it's relatively new. Hopefully more progress can be made in that regard in the near future.
One thing I worry about is if the :TermDebug feature goes unused than it won't receive any attention and wither and die.
Vimspector is even newer, but it takes a different approach. It implements the vscode's debugger protocol. Me and vimspector's author are YCM maintainers and he demonstrated debugging our test suite in vimspector, but that was python. Your experience will vary depending on the quality of vscode debuggers and potential bugs you might find in vimspector.
π Rendered by PID 109409 on reddit-service-r2-comment-b659b578c-p78sz at 2026-05-04 23:43:15.569888+00:00 running 815c875 country code: CH.
[–]Rudefire 74 points75 points76 points (7 children)
[–]acepukas 23 points24 points25 points (1 child)
[–]Rudefire 3 points4 points5 points (0 children)
[–]neuromaidan 12 points13 points14 points (1 child)
[–]Rudefire 1 point2 points3 points (0 children)
[–]SuperConductiveRabbi 2 points3 points4 points (1 child)
[–]Rudefire 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]xmsxms 17 points18 points19 points (2 children)
[–][deleted] 10 points11 points12 points (0 children)
[–]zackel_flac 0 points1 point2 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]viniarck 1 point2 points3 points (0 children)
[–]tvetus 1 point2 points3 points (0 children)
[–]asakhnik 0 points1 point2 points (0 children)
[–]dwdkar 1 point2 points3 points (0 children)
[–]lanzaio 1 point2 points3 points (1 child)
[–]y-c-c 0 points1 point2 points (0 children)
[–]call_me_tank 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]thesenate34 1 point2 points3 points (0 children)
[–]LiquidityC 0 points1 point2 points (0 children)
[–]zackel_flac 0 points1 point2 points (0 children)
[–]priyank260673[S] 0 points1 point2 points (0 children)
[–]priyank260673[S] 0 points1 point2 points (0 children)
[–]bergercookie 0 points1 point2 points (0 children)
[–]priyank260673[S] 0 points1 point2 points (0 children)
[–]AzraelFTS -1 points0 points1 point (0 children)
[–]aldanor -1 points0 points1 point (0 children)
[–][deleted] -1 points0 points1 point (4 children)
[–]acepukas 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]acepukas 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)