首页 文章

使用vim / cscope在linux内核中查找符号定义

提问于
浏览
3

我正在使用gvim / vim和cscope / ctags在linux内核中查找符号定义 . 源代码很大 . 当我想用“标签设备”命令搜索结构设备时,vim会向我提出数百次出现 . 因为它会提出名为device的全局变量,名为device的结构成员 . 反正有没有改善这个?有可能告诉vim / cscope / tag只查看结构定义吗?

1 回答

  • 1

    你可能已经知道了 . 我通过cscope vim命令缩小范围

    :cs f e struct device {
    

    请参考cscope vim命令的用法

    cscope commands:
    add  : Add a new database             (Usage: add file|dir [pre-path] [flags])
    find : Query for a pattern            (Usage: find c|d|e|f|g|i|s|t name)
           c: Find functions calling this function
           d: Find functions called by this function
           e: Find this egrep pattern
           f: Find this file
           g: Find this definition
           i: Find files #including this file
           s: Find this C symbol
           t: Find assignments to
    help : Show this message              (Usage: help)
    kill : Kill a connection              (Usage: kill #)
    reset: Reinit all connections         (Usage: reset)
    show : Show connections               (Usage: show)
    

相关问题