gdb front end to use with vim?

20,896

Solution 1

Google is your friend. http://clewn.sourceforge.net/

Honestly, I think that you're better off sticking with cgdb.

Solution 2

Look at pyclewn. As written on vim.org:

Pyclewn - an extension for Vim that supports full use of gdb from Vim. With breakpoints, watch variables, gdb command completion, etc. Uses the NetBeans interface.

Maybe it's not so easy to start use it as cgdb, but it's easy to use it.

First you need to compile vim with +netbeans_intg feature and +python/dyn or +python3/dyn For example you use python3. Configure vim like this:

./configure --with-features=huge --enable-python3interp

Don't forget to install python header files (package python3-dev). Then download pyclewn-1.7.py3.tar.gz and install.

You can use installation manual from site or install it with pathogen. To install with pathogen:

tar zxvf pyclewn-1.7.py3.tar.gz
vimdir=$HOME/.vim/bundle/pyclewn python3 setup.py install --force --home=$HOME/.vim/local

Change line $HOME/.vim/local/lib/python/clewn/vim.py:343 from 'runtime plugin/pyclewn.vim' to 'runtime bundle/pyclewn/plugin/pyclewn.vim'

Add path $HOME/.vim/local/bin (or any other that you use) to your PATH.

Add variable

export CLEWNDIR=$HOME/.vim/bundle/pyclewn/macros

You can change key mapping in file $HOME/.vim/bundle/pyclewn/macros/.pyclewn_keys.gdb

For easy pyclewn running I use next bash file: $HOME/.vim/local/bin/pclewn

#!/bin/bash
pyclewn --gdb="async" --args="--args $@" --cargs='-c "runtime misc/pclewn.vim" -c "call PyClewnPre()"'

and vim script $HOME/.vim/misc/pclewn.vim

function! PyClewnInit()
    C tbreak main
    Cmapkeys
    unmap <CR>
endfunction

function! PyClewnPre()
    map <CR> :call PyClewnInit()<CR>
    0put ='Press <Enter> to start'
    setlocal buftype=nofile
endfunction

So, to start debugging I use command:

pclewn my_program arg1 arg2 argN

UPD: Your C++ program probably uses STL containers. To display them nicely download dbinit_stl_views-1.03.txt and rename this file to ~/.gdbinit. After this you can use commands like:

pstring stl_variable
pvector stl_variable

Help available from gdb, for example by command 'help pmap'. Read more here

And of course you can map key to print string under cursor like this:

nmap <F1> :exe "C pstring " . expand("<cword>")<CR>

Solution 3

Conque GDB is very similar to cgdb. It is a terminal emulator which turns a vim buffer into a gdb command line interface. See http://www.vim.org/scripts/script.php?script_id=4582

Share:
20,896
Letholdrus
Author by

Letholdrus

Updated on July 09, 2022

Comments

  • Letholdrus
    Letholdrus almost 2 years

    What gdb frontends can I use with vim for debugging C and C++ code? Currently I use cgdb and am satisfied with it. Was just wondering what else is out there?