Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Emacs能告诉我调用特定函数的位置吗?_C_Emacs - Fatal编程技术网

Emacs能告诉我调用特定函数的位置吗?

Emacs能告诉我调用特定函数的位置吗?,c,emacs,C,Emacs,在Emacs中是否有办法找出代码中的哪些其他地方调用特定函数?在我当前的设置(GNU emacs 23.1.1,C代码库)中,我通常必须在整个代码库中搜索函数名,以查看其他函数调用它。如果我能有效地显示调用我正在查看的特定函数的所有函数名,那就太好了。我使用xcscope。它是一个使Emacs与外部cscope工具交互的库 安装后,您可以使用cscope find functions调用此函数获取调用特定函数的源代码目标列表 您可以使用CEDET软件包中的语义symref函数(C-C,G)。它

在Emacs中是否有办法找出代码中的哪些其他地方调用特定函数?在我当前的设置(GNU emacs 23.1.1,C代码库)中,我通常必须在整个代码库中搜索函数名,以查看其他函数调用它。如果我能有效地显示调用我正在查看的特定函数的所有函数名,那就太好了。

我使用
xcscope
。它是一个使Emacs与外部
cscope
工具交互的库

安装后,您可以使用
cscope find functions调用此函数
获取调用特定函数的源代码目标列表


您可以使用CEDET软件包中的
语义symref
函数(
C-C,G
)。它可以使用GNUGlobal或CTags数据库查找存在的呼叫者。它还可以解析源代码以查找事件。

这里是我的旧.emacs文件中的一个片段

它的作用是:从etags标记文件中请求要查找的内容(find tag tag) 根据模式对其进行grep

(defun find-caller (tagname)
  "Find occurences of tagname in files in the current directory
matching extension of current file."
  (interactive (list (find-tag-tag "Find caller: ")))
  (let ((cmd "grep -n "))
    (cond
     ((member major-mode '(lisp-mode cmulisp-mode))
      (grep (concat cmd "-i '" tagname "' *.lisp")))
     ((eq major-mode 'c-mode)
      (grep (concat cmd "'" tagname "' *.[ch]")))
     ((member major-mode '(latex-mode tex-mode))
      (grep (concat cmd "-i '" tagname "' *.tex")))
     ((eq major-mode 'emacs-lisp-mode)
      (grep (concat cmd "'" tagname "' *.el")))
     (t (grep (concat cmd "'" tagname "' *"))))))

我使用Emacs在Linuxjust上使用GCC4.4.3进行C编程编译仅供参考:CEDET可以使用grep查找调用者