博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cflow察看工程函数调用关系+Linux 0.11 内核实验环境
阅读量:4602 次
发布时间:2019-06-09

本文共 2978 字,大约阅读时间需要 9 分钟。

http://savannah.gnu.org/projects/cflow

http://tinylab.org/linux-0.11-lab/

http://ftp.gnu.org/gnu/cflow/

https://github.com/tinyclub

http://www.tinylab.org/callgraph-draw-the-calltree-of-c-functions/

1.cflow版本:   //Calltree 不更新了,CFLOW还在更新中 ./configure make make install Version 1.5 available     posted by gray, Mon 16 May 2016 09:39:12 PM UTC - 0 repliesGNU cflow version 1.5 is available for download.Changes in this release:    Correctly handle functions returning struct/union (fixes bug #31792)    Gracefully handle invalid inputs (fixes bug #44113)    Debugging output goes to stderr    Add a manpage    Consistent use of exit codesVersion 1.4 released     posted by gray, Tue 11 Oct 2011 09:08:54 PM UTC - 0 repliesGNU cflow version 1.4 is available for download.The most important changes in this version are:    Symbol aliases    New syntactic class: qualifiers    Speed up recursive call detection.    Fix parsing of typedefs after struct.    Fix the output of branch marks in tree mode.    Fix processing of static inline functions (RH bug 650716).  2.yum install graphviz    //得到dot  3.yum install gawk  4.tree2dotx (脚本,和gprof2dot.py一样)转换 .DOT图形格式 wget -c https://github.com/tinyclub/linux-0.11-lab/raw/master/tools/tree2dotx

callgraph = cflow + tree2dotx + dot  (callgraph自动化这个三个工具)

1.cflow:拿到函数调用关系  (calltree可以互换cflow)

  1. cflow -b -m start_kernel init/main.c > start_kernel.txt

2.tree2dotx: 把函数调用树转换成 dot 格式

  1. cat start_kernel.txt | tree2dotx > start_kernel.dot

3.用 dot 工具生成可以渲染的图片格式

这里仅以 svg 格式为例:

  1. $ cat start_kernel.dot | dot -Tsvg -o start_kernel.svg
 

 

[root@server1 l#git clone https://github.com/tinyclub/linux-0.11-lab.git && cd linux-0.11-lab [root@server1 l#cd tool [root@server1 l#cp tree2dotx callgraph /usr/local/bin [root@server1 l#chmod +x /usr/local/bin/{tree2dotx,callgraph} [root@server1 linux-0.11-lab]# make cg f=main      //Makefile.callgraph Func: mainMatch: 3File:     1  ./init/main.c: * main() use the stack at all after fork(). Thus, no function     2  ./init/main.c: * won't be any messing with the stack from main(), but we define     3  ./init/main.c:void main(void)           /* This really IS void, no error here. */Select: 1 ~ 3 ? 3File: ./init/main.cCommand: cflow -b  -m main ./init/main.c | /root/soft/linux-0.11-lab/tools//tree2dotx  2>/dev/null | dot -Tsvg -o /root/soft/linux-0.11-lab/tools//../callgraph/main.__init_main_c.svgcflow:./init/main.c:104: drive_info redefinedcflow:./init/main.c:104: this is the place of previous definitionTarget: ./init/main.c: main -> /root/soft/linux-0.11-lab/tools//../callgraph/main.__init_main_c.svgwhich: no chromium-browser in (/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin) 图像生成: [root@server1 callgraph]# pwd /root/soft/linux-0.11-lab/callgraph [root@server1 callgraph]# ll total 28 -rw-r--r-- 1 root root 22196 Jun  8 15:48 main.__init_main_c.svg -rw-r--r-- 1 root root    34 Jun  8 15:45 Makefile

转载于:https://www.cnblogs.com/zengkefu/p/5570139.html

你可能感兴趣的文章
Sublime Text3 个人使用心得
查看>>
jquery 编程的最佳实践
查看>>
MeetMe
查看>>
IP报文格式及各字段意义
查看>>
(转载)rabbitmq与springboot的安装与集成
查看>>
C2. Power Transmission (Hard Edition)(线段相交)
查看>>
STM32F0使用LL库实现SHT70通讯
查看>>
Atitit. Xss 漏洞的原理and应用xss木马
查看>>
MySQL源码 数据结构array
查看>>
(文件过多时)删除目录下全部文件
查看>>
T-SQL函数总结
查看>>
python 序列:列表
查看>>
web移动端
查看>>
pythonchallenge闯关 第13题
查看>>
linux上很方便的上传下载文件工具rz和sz使用介绍
查看>>
React之特点及常见用法
查看>>
【WEB前端经验之谈】时间一年半,或沉淀、或从零开始。
查看>>
优云软件助阵GOPS·2017全球运维大会北京站
查看>>
linux 装mysql的方法和步骤
查看>>
poj3667(线段树区间合并&区间查询)
查看>>