Chinaunix首页 | 论坛 | 博客
  • 博客访问: 206331
  • 博文数量: 32
  • 博客积分: 1415
  • 博客等级: 上尉
  • 技术积分: 295
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-06 20:47
文章分类

全部博文(32)

文章存档

2009年(11)

2008年(21)

我的朋友

分类: LINUX

2008-12-28 15:37:02

   Clewn是一个把gvim和gdb连接起来的工具,使得在调试时代码可以显示在gvim中,得到类似在IDE中的效果。使用Clewn不需要修改vim 源代码。另外一个把vim和gdb结合起来的工具:vimgdb则需要修改vim源代码,并重新编译vim。但是Clewn必须需要有GUI的 gvim,vimgdb则在gvim和vim中都可以达到效果。

使用Clewn一般步骤如下:

$clewn -va your_source.cpp

此时进入gdb命令行界面,并且gvim自动打开your_source.cpp文件。

(gdb)file your_execute

获得要调试文件的symbols

然后就可以在(gdb)中使用b main等命令设置断点。也可以在gvim中使用ctrl+b来设置断点(第一次设断点的时候ctrl+b要按两下才有效,不知道是不是bug)。
clewn在gvim中设置的快捷键:

List of default key mappings:

    CTRL-Z send an interrupt to GDB and the program it is running

    B info breakpoints

    L info locals

    A info args

    S step

    I stepi

    CTRL-N next: next source line, skipping all function calls

    X nexti

    F finish

    R run

    Q quit

    C continue

    W where

    CTRL-U up: go up one frame

    CTRL-D down: go down one frame


cursor position:

    CTRL-B set a breakpoint on the line where the cursor is located

    CTRL-E clear all breakpoints on the line where the cursor is located

mouse pointer position:

    CTRL-P print the value of the variable defined by the mouse pointer position

    CTRL-X print the value that is referenced by the address whose value is that of the variable defined by the mouse pointer position

    CTRL-K set a breakpoint at assembly address shown by mouse position

    CTRL-H clear a breakpoint at assembly address shown by mouse position

    CTRL-J add the selected variable at mouse position to the watched variables window







阅读(2209) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~