vim使用之程序调试-Vimgdb

1.下载vim

ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2

 

2.下载vimgdb

http://downloads.sourceforge.net/project/clewn/vimGdb/vimgdb72-1.14/vimgdb72-1.14.tar.gz?use_mirror=ncu&37740109

关于clewn和vimgdb

http://clewn.sourceforge.net/

 

3.阅读vimgdb中的README,给vim打补丁,并编译。

 

INSTALL.txt - VimGdb patch installation notes

This document describes how to install the patch for vimGdb.

 

 

a) You need:

 

    vim-7.2.tar.bz2         Vim 7.2 source tar ball (from www.vim.org)

    vimgdb72-1.14.tar.gz    this patch

 

 

b) Untar all files, apply the patch and make Vim:

 

    tar xjf vim-7.2.tar.bz2

    tar xzf vimgdb72-1.14.tar.gz

 

    patch -d vim72 --backup -p0 < vimgdb/vim72.diff

 

    cd vim72/src

        make            make vim

        make install        install vim (may require root privileges)

 

IMPORTANT NOTE: you must run make (not ./configure), and if you run

./configure then you must add the --enable-gdb command line argument

in order to include the gdb feature (vimgdb) in vim.

 

 

c) Install vimGdb runtime:

Copy the file vimgdb_runtime.tgz found in the vimgdb tarball, to your

runtime path. To find your runtime path location execute the vim

command (this is usually $HOME/.vim):

 

    :set runtimepath?

 

Untar vimgdb_runtime.tgz in your runtime path. After this step, you

should have the following files:

 

    doc/gdb.txt

    macros/gdb_mappings.vim

    syntax/gdb.vim

    syntax/gdbvim.vim

    syntax/gdbvar.vim

 

Change to the doc directory, start Vim and run the ":helptags ."

command to process the taglist help file. Without this step, you

cannot jump to the taglist help topics. You can now use the ":help

vimgdb" command to get the vimGdb documentation.

 

 

 

4、初识vim gdb

 

:help vimgdb阅读帮助文档,学习gdb使用。效果图如下:

 

b 10设置断点,窗口才出现出现源码?

 

5.vimgdb的使用方法及其常用快捷键

 

 

<<<<<<-- Mappings *gdb-mappings-->>>>>>

 

The gdb() function accepts a string as single argument which is sent to GDB as

a GDB command. This can be used to map any command to a key sequence. Examples

of such mappings are given in 'macros/gdb_mappings.vim'. To use those

mappings, source the script: >

 

    :run macros/gdb_mappings.vim

 

The key <F7> is used to toggle between the 'gdb_mappings.vim' mappings and the

default Vim mappings.

 

List of key mappings in 'gdb_mappings.vim':

 

<Space> launch the interactive gdb input-line window

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

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

CTRL-P Normal mode: print value of word under cursor

Visual mode: GDB command "createvar" selected expression, see

|gdb-variables|

CTRL-X print value of data referenced by word under cursor

 

CTRL-B and CTRL-E operate both on source code and on disassembled code in

assembly buffers.

 

6.监控变量

:bel 25vsplit gdb-variables

space启动命令窗口,然后分别执行cr c.a, cr c.b(本例)

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值