如何快速搜索所有包含的头文件在项目中的特定功能或宏? [英] How can I quickly search all included header files in a project for a specific function or macro?

查看:335
本文介绍了如何快速搜索所有包含的头文件在项目中的特定功能或宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一个问题,我最近已经成为这里的其他人的共同的痛苦。

Here's a problem I've had recently that just HAS to be a common pain to others here.

我正在使用其他人的旧版C代码,需要找到函数或宏定义的位置。代码 #include 除了来自特定项目的那些库外,还有一堆不同的标准系统库。

I'm working with someone else's legacy C code and need to find where a function or macro was defined. The code #includes a bunch of different standard system libraries in addition to those from the specific project.

有没有工具或技术可以快速找到特定函数,宏(或其他全局)的定义?

Is there a tool or technique to quickly find where a specific function, macro, (or other global for that matter) was defined?

我试过:

grep -R 'function' /usr/lib

和其他类似的* nix / bash-fu只有有限的成功和大量令人讨厌的剔除。其中一个你的圣人编码器必须有一个很好的解决方案这个看起来常见的情况。

and other similar *nix/bash-fu with only limited success and lots of annoying chaff to cull. One of you sage coders out there must have a good solution to this seemingly common scenario.

我很惊讶没有找到另一个问题这里或在我的搜索interwebs。 (我敢肯定如果我错过了一个会有愤怒的意见...;))

I was very surprised to not find another question on this particular pain here or in my searches of the interwebs. (I'm sure there will be angry comments if I missed one... ;-))

事先感谢任何提示!

推荐答案

使用 etags / ctags exuberant ctags项目与理解它们的编辑器(emacs,vim)相结合,或 GNU GLOBAL

Use etags/ctags from the exuberant ctags project in conjunction with an editor (emacs, vim) that understands them, or GNU GLOBAL.

哦,如果你碰巧使用automake它生成一个目标 TAGS 。因此,不需要复杂的手动调用 {c,e}标签

Oh, and if you happen to use automake it generates a target TAGS. So no need for complicated manual calls to {c,e}tags.

这篇关于如何快速搜索所有包含的头文件在项目中的特定功能或宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆