How to use calltree and Graphviz/CodeViz
2011-09-01 23:14
381 查看
1. calltree
Download source codes from Ref(1) or (2), and compile it.
Then copy the "calltree" utility to /usr/local/bin/
You also need a special script which called tree2dot-filter.sh
to make life easy, and it can be get from Ref(3).
By using the following example, you will get fuction calling relations
in a picture test_calltree.jpg.
sandbox$ which calltree tree2dot-filter.sh
/usr/local/bin/calltree
/usr/local/bin/tree2dot-filter.sh
sandbox$ cat test_calltree.c
#include <stdio.h>
#include <stdlib.h>
void do_something_firstly()
{
char *str = NULL;
str = malloc(100);
free(str);
}
void do_something_finally()
{
printf("Bingo!\n");
}
int main()
{
printf("Hello, call tree :-)\n");
do_something_firstly();
do_something_finally();
return 0;
}
sandbox$ calltree -mb -np test_calltree.c
main:
| do_something_finally
| | printf
| do_something_firstly
| | free
| | malloc
| printf
sandbox$ calltree -mb -np test_calltree.c | tree2dot-filter.sh > test_calltree.dot
sandbox$ dot -Tjpg test_calltree.dot -o test_calltree.jpg
2. Graphviz and CodeViz
Download source codes from Ref(6) and (7), and compile them.
Then copy the "gcc-graph", "genfull", and "gengraph" utility to /usr/local/bin/
By using the following example, you will get fuction calling relations
in a picture main.png.
sandbox$ which gcc-graph genfull gengraph
/usr/local/bin/gcc-graph
/usr/local/bin/genfull
/usr/local/bin/gengraph
sandbox$ gcc-graph test_calltree.c
sandbox$ genfull
sandbox$ gengraph --output-type "png" -f main
Reference:
(1) http://directory.fsf.org/project/calltree/
(2) http://linux.softpedia.com/progDownload/calltree-Download-971.html
(3) http://download.csdn.net/source/3567869
(4) http://www.linuxsir.org/bbs/printthread.php?t=246389
(5) http://blog.csdn.net/cqbamboo/article/details/6736627
(6) http://www.graphviz.org/
(7) http://www.csn.ul.ie/~mel/projects/codeviz/
(8) http://www.ibm.com/developerworks/cn/linux/l-graphvis/
(9) http://blog.csdn.net/cqbamboo/article/details/6739024
Download source codes from Ref(1) or (2), and compile it.
Then copy the "calltree" utility to /usr/local/bin/
You also need a special script which called tree2dot-filter.sh
to make life easy, and it can be get from Ref(3).
By using the following example, you will get fuction calling relations
in a picture test_calltree.jpg.
sandbox$ which calltree tree2dot-filter.sh
/usr/local/bin/calltree
/usr/local/bin/tree2dot-filter.sh
sandbox$ cat test_calltree.c
#include <stdio.h>
#include <stdlib.h>
void do_something_firstly()
{
char *str = NULL;
str = malloc(100);
free(str);
}
void do_something_finally()
{
printf("Bingo!\n");
}
int main()
{
printf("Hello, call tree :-)\n");
do_something_firstly();
do_something_finally();
return 0;
}
sandbox$ calltree -mb -np test_calltree.c
main:
| do_something_finally
| | printf
| do_something_firstly
| | free
| | malloc
| printf
sandbox$ calltree -mb -np test_calltree.c | tree2dot-filter.sh > test_calltree.dot
sandbox$ dot -Tjpg test_calltree.dot -o test_calltree.jpg
2. Graphviz and CodeViz
Download source codes from Ref(6) and (7), and compile them.
Then copy the "gcc-graph", "genfull", and "gengraph" utility to /usr/local/bin/
By using the following example, you will get fuction calling relations
in a picture main.png.
sandbox$ which gcc-graph genfull gengraph
/usr/local/bin/gcc-graph
/usr/local/bin/genfull
/usr/local/bin/gengraph
sandbox$ gcc-graph test_calltree.c
sandbox$ genfull
sandbox$ gengraph --output-type "png" -f main
Reference:
(1) http://directory.fsf.org/project/calltree/
(2) http://linux.softpedia.com/progDownload/calltree-Download-971.html
(3) http://download.csdn.net/source/3567869
(4) http://www.linuxsir.org/bbs/printthread.php?t=246389
(5) http://blog.csdn.net/cqbamboo/article/details/6736627
(6) http://www.graphviz.org/
(7) http://www.csn.ul.ie/~mel/projects/codeviz/
(8) http://www.ibm.com/developerworks/cn/linux/l-graphvis/
(9) http://blog.csdn.net/cqbamboo/article/details/6739024
相关文章推荐
- How to use boost::property_tree to load and write JSON
- Chinese version QQ—how to install it and use it to make a audio call and video call
- How to use tf.train.write_graph() and tf.import_graph_def()
- How to use Connector to sync data between AX and CRM
- 【翻译】C# Tips & Tricks: Weak References - When and How to Use Them
- Why Ceph and how to use Ceph?
- How To Install and Use Redis
- How to use plugin audio codecs in OpenH323 and OPAL
- Why Ceph and how to use Ceph?
- how to make Completion Handlers and use it in Swift
- How to use script to get all oracle EBS Form name and corresponding fmb file name
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
- Four Logical Relationships of Project Management: What They Are and How To Use Them
- 颜色直方图的计算、显示、处理、对比及反向投影(How to Use Histogram? Calculate, Show, Process, Compare and BackProject)
- [Mootools] Simple tutorial of how to use domReady, DOM operation and Ajax in Mootools
- How to call code behind method in JavaScript in C# and VS2010?
- Why Prepared Statements are important and how to use them "properly"
- Data Structure: How to traversal Binary Tree Iteratively (Preorder, Inorder and Postorder)
- How to use JQuery to call a WebService (*.asmx) method?
- (转贴)How to use JDBC and transactions in Tomcat with JOTM