Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gvim and gdb for C?

Tags:

c

vim

gdb

In emacs there is a handy way to launch the gdb and gui options for gdb, the C debugger.

Is there a similar option in gvim?

like image 803
zxcv Avatar asked Oct 08 '08 21:10

zxcv


People also ask

Does vim have a debugger?

Vim added a built-in debugger officially in version 8.1, released in May 2018. The feature had been present in some of the version 8.0 releases as well, as early as August 2017. The following vim commands load the plugin and start the debugger.

How to use breakpoints in Vim?

Breakpoints can be set in the gdb window using ordinary gdb commands. Alternatively, breakpoints can be set by navigating to a line of code in the editor window and entering :Break . Lines with breakpoints are indicated by >> in the editor window.

What does GVim mean?

GVim is Vim with a built-in GUI, whereas plain Vim needs a terminal emulator (like GNOME Terminal, for example) to run. The built-in GUI provides several extra features to GVim.


2 Answers

There's a project called cgdb which aims to provide this exact behavior. While it doesn't launch from vim the way emacs does, it provides vim like keybindings and behavior. Its features include a separate syntax highlighted source window which is kept up-to-date with the currently executing instruction.

like image 56
pk. Avatar answered Oct 02 '22 22:10

pk.


Have a look at the Vim script search. I see at least 5 plugins that do what you want.

like image 22
jkramer Avatar answered Oct 02 '22 20:10

jkramer