這以 GNU GLOBAL 6.5.6 為示範

1:

install GNU GLOBAL

https://www.gnu.org/software/global/download.html

sudo ./configure;

若有以下 error,請看更下方的 Q5 說明。

configure: checking "location of ncurses.h file"...
configure: error: curses library is required but not found.
If you are not going to use gtags-cscope, please try ./configure --disable-gtagscscope

sudo make;

sudo make install

----------------------------------------------------------------------------------------------------

Q5. What is the message? What should I do?

'configure: error: curses library is required but not found."

A5. gtags-cscope(1) requires curses library. There are two choices of yours.

If you use gtags-cscope(1)

Please install curses library. You can get it here:

http://www.gnu.org/software/ncurses/

else

You can install GLOBAL without gtags-cscope(1) like follows:

$ ./configure --disable-gtagscscope

$ make

因為這裡要使用 gtags-cscope,

所以要 install curses library. 參考下方

-------------------------------------------------------------------------------------------------------

2:

install curses library

http://www.gnu.org/software/ncurses/

sudo ./configure; sudo make; sudo make install;

3 :

install vundle

https://github.com/VundleVim/Vundle.vim

sudo apt-get install git curl

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

請看 https://github.com/VundleVim/Vundle.vim 的 Quick Start 的 第3步驟 Configure Plugins:

4 :

以下要依照 user 當時所安裝的 gnu global 版本,plugin 對應版本的 gtags.vim、gtags-cscope.vim,

可以下載 gnu global source code,裡面就有對應版本的 gtags.vim、gtags-cscope.vim

或是在網路上搜尋對應版本的 gtags.vim,gtags-cscope.vim 並使用以下的 Vundle plugin 方式

Plugin 'bbchung/gtags.vim'
Plugin 'multilobyte/gtags-cscope'

5:

在您要 tag 的 source code 的資料夾下,

執行

gtags

6:

假如您在 source code 找一個定義,

:cs find g the_definition_you_want_find

若出現以下訊息

E567: no cscope connections

需在 ~/.vimrc 加入以下

let g:GtagsCscope_Auto_Load = 

若需要使用 cscope 的快捷鍵,       ===〉  注意,VirtualBox 4.3.36 無法使用組合鍵,如 ctrl 加上 \ 再加上 s

快捷鍵在 gtags-cscope.vim 有說明,

需在 ~/.vimrc 加入以下 code 。

let g:GtagsCscope_Auto_Map = 

cscope command

 "       explanation             command
" ----------------------------------------------------------
" Find symbol :cs find 0 or s
" Find definition :cs find 1 or g
" Find functions called by this function (not implemented)
" Find reference :cs find 3 or c
" Find text string :cs find 4 or t
" Find egrep pattern :cs find 6 or e
" Find path :cs find 7 or f ===> 跳至 include 的 file。如:#include "t.h",跳至 t.h
" Find include file :cs find 8 or i ===> 找尋有那些 source code 有 include 這個 文件。 如: a.c b.c 都有 include "c.h"

快捷鍵

ctrl + \ + s | g | c | t | e | f | i

             " normal command
:nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
:nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
:nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
:nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
:nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
:nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
:nmap <C-\>i :cs find i <C-R>=expand("<cfile>")<CR><CR>

Gnu Global :

好用功能

1。尋找在一個 Project中 被 Gnu Global tag 的檔案。

global -P file_name

若有加入 Unite 相關的 plugins

Plugin 'Shougo/unite.vim'
Plugin 'hewes/unite-gtags'

則可在 .vimrc 加入以下的快速鍵。

key : control + g (gnu global) + f (file)

:nmap <C-g>f :Unite gtags/path:

示範:

vim 按下 control + g + f,

若輸入 battery。

如下

:Unite gtags/path:battery

顯示搜尋到的結果

看到好多的搜尋結果,

如何縮小範圍呢?

按下 i,

鍵入您的 keyword 即可。

若不輸入,直接 press enter,

:Unite gtags/path:

則列出所有被 tag 的 file,並且可以輸入 keyword,從中搜尋您所要編輯的 file 。

set up trace code tool的更多相关文章

  1. Service Trace Viewer Tool (SvcTraceViewer.exe)

    Service Trace Viewer Tool <?xml version="1.0" encoding="utf-8" ?> <conf ...

  2. Trace & Error log in file

    1. Log机制 做一些大型项目的时候,对代码的调试最有效的办法往往是最直接.最简单的log机制: 即对可以出设置打印店,对应打印信息进行调试(当然是有gdb也许你会觉得很高大上,但是实际项目中,gd ...

  3. How to anti-Obfuscated code

    Author:jin can zhu from China Source:http://blog.csdn.net/clever101 Now many software makers have us ...

  4. 微信网页授权报code been used, hints: [ req_id: XYv1Ha07042046 ]

    先贴上代码: public function index() { $code = input('get.code'); $tool = new Wxtool(); if (empty($code)) ...

  5. Analyzing UI Performance with Systrace 使用systrace工具分析ui性能

    While developing your application, you should check that user interactions are buttery smooth, runni ...

  6. graphterm 0.40.1 : Python Package Index

    graphterm 0.40.1 : Python Package Index graphterm 0.40.1 Downloads ↓ A Graphical Terminal Interface ...

  7. Get started with Google Analytics

    What is Google Analytics Google Analytics is a Google official analytics tool that is primarily used ...

  8. 内核调试神器SystemTap — 更多功能与原理(三)

    a linux trace/probe tool. 官网:https://sourceware.org/systemtap/ 用户空间 SystemTap探测用户空间程序需要utrace的支持,3.5 ...

  9. 内核调试神器SystemTap — 探测点与语法(二)

    a linux trace/probe tool. 官网:https://sourceware.org/systemtap/ 探测点 SystemTap脚本主要是由探测点和探测点处理函数组成的,来看下 ...

随机推荐

  1. C/C++字符串笔试知识点及实例

    一.C字符串与C++字符串的深入理解 对于C语言,需要区分C字符串和C字符数组.  C字符串:以字符NULL('\0')结尾的字符数组:  C字符数组:数组元素类型为字符类型. C字符串的的初始化:c ...

  2. python源码剖析学习记录-01

    学习<Python源码剖析-深度探索动态语言核心技术>教程         Python总体架构,运行流程   File Group: 1.Core Modules 内部模块,例如:imp ...

  3. Voyager下的Media Manager文件管理与Menu Builder

    Media Manager 默认存储位置在storage/app/public 上传文件,新建文件夹,移动,重命名,删除等等等功能 Menu Builder 创建新的Main菜单 创建一个shop菜单 ...

  4. Python3 S.join() 个人笔记

    S.join(iterable) S:需要的分隔符 iterable:被分割对象 . 注意括号里必须只能有一个成员,比如 ','.join('a','b') 这种写法是行不通的 实例:'-'.join ...

  5. 针对NM_CUSTOMDRAW消息的学习

    消息的形式:1 窗口消息,2 命令消息,3 WM_NOTIFY消息,4 自定义消息 我们的NM_CUSTOMDRAW消息就是就属于第三种WM_NOTIFY消息,而添加消息映射的方法分为两种: BEGI ...

  6. HDU 5525 Product 数论

    题意: 给出一个长度为\(n(1 \leq n \leq 10^5)\)的序列\(A_i\),\(N=\prod\limits_{i=1}^{n}i^{A_i}\).求\(N\)的所有约数的乘积. 分 ...

  7. python基础学习笔记——网络编程(协议篇)

    一 互联网的本质 咱们先不说互联网是如何通信的(发送数据,文件等),先用一个经典的例子,给大家说明什么是互联网通信. 现在追溯到八九十年代,当时电话刚刚兴起,还没有手机的概念,只是有线电话,那么此时你 ...

  8. Asp.net HttpWebRequest和HttpWebResponse发送和接受任何类型数据

    发送字符串数据发送数据 string strId = "guest"; "; string postData = "userid=" + strId; ...

  9. Notepad++ 使用正则表达式查找替换字符串

        最近在改一些别人写的PHP代码,由于之前的代码可维护性比较差,因此工作量比较多,因此想找一些高效的方式改一些有规律的代码. 比如: 我想将一些类似$rowss[MaxGetCash_num], ...

  10. SDOJ 3696 Tree

    描述 给你一个无向带权连通图,每条边是黑色或白色.让你求一棵最小权的恰好有need条白色边的生成树. 题目保证有解. 输入 第一行V,E,need分别表示点数,边数和需要的白色边数. 接下来E行 每行 ...