从源代码项目中提取所有功能的工具

时间:2023-01-19 00:25:24

I'm trying to build a list of available tools for parsing a complete source code package and extracting all of the functions/methods as separate pieces. My goal is to run a tool or script, immediately know how many functions are in the package, and to easily examine the complete set of segmented functions one-by-one as needed.

我正在尝试构建一个可用工具列表,用于解析完整的源代码包并将所有函数/方法作为单独的部分进行提取。我的目标是运行一个工具或脚本,立即知道包中有多少函数,并根据需要方便地检查完整的分段函数集。

Right now I'm using the NiCad clone detection tool, which includes an extract script written in TXL (a tree transformation language). Each function is pulled out and stored as a unique entity in an XML document, so handling the list of functions is very convenient. NiCad included extract tools for C, Java, and Python. I'm mostly concerned with C, but it's also nice to have the rest available. We don't have a C++ parser set up yet - that would be handy.

现在我正在使用NiCad克隆检测工具,它包含用TXL(一种树转换语言)编写的提取脚本。每个函数都被取出并作为XML文档中惟一的实体存储,因此处理函数列表非常方便。NiCad包括用于C、Java和Python的提取工具。我最关心的是C,但是有其他的也很好。我们还没有建立一个c++解析器,这是很方便的。

I've also used Doxygen, which has the added bonus of identifying the call graph. There's a lot of markup in these files though, so it's a bit of extra work to parse Doxygen's output to get them into a plain list of functions.

我还使用了Doxygen,它有识别呼叫图的额外好处。但是这些文件中有很多标记,所以解析Doxygen的输出以使它们成为一个简单的函数列表需要额外的工作。

Has anyone used a tool that extracts the full set of functions/methods? Do you have recommendations or warnings? If you've written your own, is it available somewhere?

是否有人使用一个工具来提取完整的函数/方法集?你有什么建议或警告吗?如果你自己写过,有什么地方可以买到吗?

Thanks!

谢谢!

1 个解决方案

#1


0  

You can use nm tool of linux. "nm is used to list symbols from object files". See man page of nm to get more details; The sample nm is copied here for your reference.

您可以使用linux的nm工具。“nm用于从对象文件中列出符号”。详见nm的man page;样品nm在这里复制,供您参考。

void fun1() {
    return;
}

void fun() {
     fun1();
}
int main()
{
     fun();
     return 0;
}

Nm of the above program on running "nm a.out | grep T"

以上程序的Nm用于运行“Nm a”。| grep T”

08048470 T __libc_csu_fini
08048400 T __libc_csu_init
080484ac T _fini
080482b8 T _init
08048320 T _start
080483d9 T fun
080483d4 T fun1
080483e3 T main

#1


0  

You can use nm tool of linux. "nm is used to list symbols from object files". See man page of nm to get more details; The sample nm is copied here for your reference.

您可以使用linux的nm工具。“nm用于从对象文件中列出符号”。详见nm的man page;样品nm在这里复制,供您参考。

void fun1() {
    return;
}

void fun() {
     fun1();
}
int main()
{
     fun();
     return 0;
}

Nm of the above program on running "nm a.out | grep T"

以上程序的Nm用于运行“Nm a”。| grep T”

08048470 T __libc_csu_fini
08048400 T __libc_csu_init
080484ac T _fini
080482b8 T _init
08048320 T _start
080483d9 T fun
080483d4 T fun1
080483e3 T main