Vim gdb

What is Clewn ?

Clewn implements full gdb support in the vim editor: breakpoints, watch variables, gdb command completion, assembly windows, etc.

This may be done with clewn or vimGdb. There is also a third way with pyclewn, a python program with more features than clewn and vimGdb, and a tight integration in Vim. See the pyclewn web site for a table listing the differences between all three programs.

Clewn is a program controlling vim through the netBeans socket interface, it runs concurrently with vim and talks to vim. Clewn can only be used with gvim, the graphical implementation of vim, as vim on a terminal does not support netBeans. VimGdb is a vim patch implemented as a vim optional feature.

Both alternatives use the same base source code to interface with gdb. Clewn, as a standalone process, needs its own terminal. This is not the case with vimGdb, but a drawback is that a different patch must be applied to each new Vim version.

They both share the same features set, except clewn supports some features that vimGdb does not have:

  • display of gdb expression values in a balloon
  • gdb `run' commands do input and output on the clewn terminal, while vimgdb users must use the gdb 'tty' or 'attach' commands to control the debuged program input/output


November 28, 2009 - Clewn release 1.15

    Bug fix:
  • Fix clewn hangs on startup with ubuntu 9.10.

October 19, 2008 - Clewn and vimGdb release 1.14

  • Port of vimgdb to Vim 7.2.
  • When printing the "not connected yet" notification because the netbeans socket connection is not established, Clewn hints that Vim may not be compiled with netbeans_intg.
  • ^M characters removed from vimgdb console on Mac OS X.
    Bug fixes:
  • Fix missing headers in obstack.c, when building on freebsd.
  • Suppress signedness warnings when built with gcc 4.1.2.
  • Include stdint.h in obstack to get the definition of uintmax_t on Solaris.

March 28, 2008 - vimGdb 1.13

    Bug Fix:
  • This is a fix for Cygwin platforms: Cygwin libc does not include 'obstack' from GNU libc, and the inclusion in vimgdb of the obstack source code, relies on code in obstack.c that was including missing headers.

December 28, 2007 - Clewn 1.13

  • The clewn 'restart' command is renamed 'cl_restart'.
    Bug Fixes:
  • Find the source when they have been compiled with an absolute path and moved later.
  • Fix: clewn messes up gdb pretty printing.

July 21, 2007 - vimGdb 1.12

    New Feature:
  • This is a retrofit of the changes made in clewn 1.8 to locate source files from the information provided by gdb. When $cdir (for compilation directory) is present in the 'directory' gdb variable, vimgdb attempts to locate the source file by using the debugging information stored in the file that is being debugged.

May 27, 2007 - vimGdb 1.11

  • VimGdb is ported to Vim 7.1.

January 22, 2007 - Clewn 1.10

    New Features:
  • Use GNU automake to build, install and distribute clewn.
  • The project file stores the current gdb settings. They are automatically sourced by clewn on gdb startup and saved by clewn when quitting or when restarting gdb. These settings are the gdb current working directory, the program file to debug, the command line arguments passed to this program when run by gdb, and the list of enabled and disabled breakpoints set in this program.
  • When using a version of vim that supports netbeans 2.4 (vim version 7.0 after the patch 163), clewn saves in the project file the current sign position in the vim buffer instead of the old position that was set in gdb before the source file was edited.
  • When a project file is being used, a message is printed in Vim when the user attempts to quit Vim, to warn him that the breakpoints will not be saved to the project file if he proceeds with the operation.
  • When $cdir is set in the gdb directories variable (the default),clewn uses the source full path name instead of the short name in remote debugging, to map the gdb path name to the vim path name. The list of source full path names can be obtained with the gdb command 'interpreter-exec mi "-file-list-exec-source-files"'. This is only available with GDB 6.2.1 or higher.
  • Close the asm buffers when running netbeans version 2.4 (Vim version 7.0 after the patch 163).
    Bug Fixes:
  • Fix: cannot unmap vim keys set by clewn, when using vim 7.0 or above.
  • Fix: when '-va -g' is missing from the command line, vim does not start the GUI.
  • Get the source file list from gdb after a 'source' command, in case the sourced command file includes a command loading a new program.
  • Fix: the error message "Clewn cannot find file foobar.c in GDB source directories" is printed at each prompt instead of once.

August 27, 2006 - Clewn 1.9 - vimGdb 1.9

    New Features:
  • The 'restart' command allows to fork from clewn a fresh instance of gdb while retaining the existing netbeans connection to vim.
  • Configuring the mapping of a vim key to a gdb command with clewn is much simpler. Only one entry in the .clewn_keys file is needed now. This requires vim 7.0 or above.
  • New clewn command line arguments:
    -vc    gvim_cmd
    gvim shell command or pathname to gvim (default 'gvim')
    -va    gvim_args
    gvim command line arguments
    -gc    gdb_cmd
    gdb shell command or pathname to gdb (default 'gdb')
    -ga    gdb_args
    gdb command line arguments
  • When clewn exits, a 'saveAndExit' netbeans command is sent to vim. This command performs the equivalent of closing vim with ":confirm qall".
  • When doing remote debugging with clewn, the parameter of the '-x' command line argument, lists the pathname substitution rules to be applied from target to host and vice-versa.
    Bug Fix:
  • Fix regression in level 2 mode with gdb 5.3 in clewn and vimgdb, the breakpoints signs cannot be set in vim.
  • Fix completion in the gdb console after having sourced the mswin.vim macro.
  • Fix getting "Command terminated" in vimgdb, for programs started by vim, instead of the shell exit status (see sourceforge bug tracker item 1543384)

July 23, 2006 - Clewn 1.8.1 - vimGdb 1.8.1

    Bug Fixes:
  • Fixed jumping back to last gdb frame sign after displaying a balloon evaluation (clewn) or after clearing a breakpoint.
  • Fixed extra new line after gdb 'step' command.
  • Clewn: the gdb `run' commands do input and output on the clewn terminal.

June 17, 2006 - Clewn 1.8 - vimGdb 1.8 on Vim 6.4 - vimGdb 1.8 on Vim 7.0

    New Features:
  • Clewn: When $cdir (for compilation directory) is present in the 'directory' gdb variable, clewn attempts to locate the source file by using the debugging information stored in the file that is being debugged. This is useful when the program to debug is the result of multiple compilation units located in different directories, or when the program has been moved to a different location.
  • VimGdb: The position of the gdb window on the screen left-right-top-bottom is setup according to the values of the Vim options 'splitbelow' and 'splitright' (see the gdb-window section of the documentation).
  • VimGdb is ported to Vim 7.0.
  • VimGdb: The gdb window is created with the option 'nowrap' set.
    Bug Fix:
  • Fixed browsing the gdb frame stack after an assertion failure, when assembly support is enabled.
  • Fixed out of sync frame stack after printing an expression that causes the evaluation of one of the debugged program functions.
  • Fixed parsing of a long (greater than 1024 characters) gdb 'directory' list.
  • Fixed the garbled display by clewn of very long lines output by gdb, as for example in the output of the gdb command 'show directory'

April 9, 2006 - Clewn and vimGdb release 1.7

    New Features:
  • Clewn: an expression value or a variable value as provided by gdb, is displayed in a balloon in Vim, when the mouse pointer is hovering over the selected expression or the variable.
  • Clewn and vimGdb: this release supports gdb 6.4 and all previous gdb versions starting from gdb 5.3.
  • The runtime files are packaged in a tarball, and the .clewn_keys file is not required.
  • Key mappings are enabled after sourcing the .vim runtime file.
  • Clewn: the clewn user is warned when the Vim socket is not yet established.
  • Clewn: set balloondelay to 100 msec for better response when setting a watched variable.
    Bug Fix:
  • Quote file names to allow for spaces in set/delete breakpoints.
  • Header obstack.h is not a system header.

February 19, 2006 - Clewn and vimGdb release 1.6

    New Features:
  • Vim is forked by clewn when starting. A new command line option '-f', can be used to customize how vim is run.
  • The gdb program that is forked by clewn can have command line arguments, as for example in: clewn -p 'gdb --args foobar "this is foobar argument"'
  • Support for cross compilation in clewn.
  • The new clewn command line option '-x' allows to do remote debugging of a target where clewn and gdb are running, from a host where the development is done and where vim is running.
  • The gdb program that is forked by vimGdb can have command line arguments. For example, you can set the Vim gdbprg variable to: :set gdbprg=gdb\ --args\ foobar\ \"this\ is\ foobar\ argument\"
  • Clewn option '-r' has its meaning reverted, now clewn set the SO_REUSEADDR socket option by default.
  • Clewn option '-v' (disable variables watching) has been removed.
  • Clewn option '-i' (disable saving history in .clewn_history) has been removed.
  • Clewn option '-m' (enable GDB prompt for more messages) has been removed.
    Bug Fix:
  • The following bug has been fixed in clewn: when a watched variable is deleted, the watched variables feature is not functionnal anymore.

November 17, 2005 - Clewn and vimGdb release 1.5 on Vim 6.4

  • vimGdb has been ported to Vim 6.4.
  • VimGdb installation procedure has been simplified, autoconf is no longer required and it is not necessary anymore to download clewn source files.
  • Minor corrections to the clewn documentation on keys mappings have been made.
    Bug Fix:
  • The following problem has been fixed: Vim hangs while gdb is running after the grep command has been started.

August 29, 2004 - Clewn release 1.4 - vimGdb patch 2 on Vim 6.3

  • Use of gnu obstacks for memory allocations.
    Bug Fix:
  • The gdb --async option has been removed (not supported anymore by gdb 6.2).

June 8, 2004 - vimGdb patch 6 on Vim 6.2

    New Features:
  • Clewn initial release.
  • Implementation of modes level 2 and level 3.
  • Support of gdb annotations level 3.

March 15, 2004 - vimGdb patch 5 on Vim 6.2

    New Feature:
  • Watched variables are displayed in a Vim window.
  • When looking for an address in asm buffers, search only those buffers whose name starts with function name.

February 15, 2004 - vimGdb patch 3 on Vim 6.2

    New Features:
  • Support of breakpoints annotations, providing the following features:
    • The breakpoint sign text is the last two digits of the breakpoint number.
    • Disabled breakpoints: gdb commands tbreak, thbreak, disable, enable once and enable delete are supported. Disabled breakpoints are highlighted with a different color. An enable once bp that is hit becomes disabled.
    • Breakpoints in assembly buffers. If the assembly buffer does not exist yet at the time the breakpoint is set, the sign will be placed the next time it is disassembled.
    • When receiving a frame annotation do not edit this buffer if the related breakpoint contains a commands with the continue statement.
  • Management of breakpoints in source and assembly code through gdb annotations.

January 12, 2004 - vimGdb initial release