call-graph

Create a call graph for a file with clang

情到浓时终转凉″ 提交于 2019-12-02 19:38:37
Is there a way to create a call graph with clang that can reasonably fit on a page? i.e. given: #include<iostream> using namespace std; int main() { int a; cin>>a; cout<<a; cout<<a; return 0; } I current get by using: $ clang++ main.cpp -S -emit-llvm -o - | opt -analyze -std-link-opts -dot-callgraph $ cat callgraph.dot | c++filt | sed 's,>,\\>,g; s,-\\>,->,g; s,<,\\<,g' | gawk '/external node/{id=$1}$1!=id' | dot -Tpng -ocallgraph.png (which seems like a lot of effort to do something that I would not have expected to be so difficult). I would like to get something that is a bit more reasonable

Kcachegrind/callgrind is inaccurate for dispatcher functions?

故事扮演 提交于 2019-12-01 06:32:14
I have a model code on which kcachegrind/callgrind reports strange results. It is kind of dispatcher function. The dispatcher is called from 4 places; each call says, which actual do_J function to run (so the first2 will call only do_1 and do_2 and so on) Source (this is a model of actual code) #define N 1000000 int a[N]; int do_1(int *a) { int i; for(i=0;i<N/4;i++) a[i]+=1; } int do_2(int *a) { int i; for(i=0;i<N/2;i++) a[i]+=2; } int do_3(int *a) { int i; for(i=0;i<N*3/4;i++) a[i]+=3; } int do_4(int *a) { int i; for(i=0;i<N;i++) a[i]+=4; } int dispatcher(int *a, int j) { if(j==1) do_1(a);

Kcachegrind/callgrind is inaccurate for dispatcher functions?

为君一笑 提交于 2019-12-01 04:53:07
问题 I have a model code on which kcachegrind/callgrind reports strange results. It is kind of dispatcher function. The dispatcher is called from 4 places; each call says, which actual do_J function to run (so the first2 will call only do_1 and do_2 and so on) Source (this is a model of actual code) #define N 1000000 int a[N]; int do_1(int *a) { int i; for(i=0;i<N/4;i++) a[i]+=1; } int do_2(int *a) { int i; for(i=0;i<N/2;i++) a[i]+=2; } int do_3(int *a) { int i; for(i=0;i<N*3/4;i++) a[i]+=3; } int

A 'profiler with visualization' for PHP with `full backtrace visualization`?

吃可爱长大的小学妹 提交于 2019-11-30 14:29:07
Currently, I am using xdebug profiler & KCacheGrind . But GallGrind format does not store full call trace, just the parent child call traces (look at Kcachegrind/callgrind is inaccurate for dispatcher functions? for what I am talking about.) Is there a profiler with visualization with full backtrace visualization available for PHP? I have looked at PHP Quick Profiler : But, It requires too much code to be added and no visualization. phpCallGraph : Its most recent version has been modified on 2009-08-06 ( ref ) . I had to do some major PHP profiling for a previous project a few months ago. The

C/C++ call-graph utility for Windows platform [closed]

半城伤御伤魂 提交于 2019-11-30 04:42:05
I have a large 95% C, 5% C++ Win32 code base that I am trying to grok. What modern tools are available for generating call-graph diagrams for C or C++ projects? Have you tried SourceInsight's call graph feature? http://www.sourceinsight.com/docs35/ae1144092.htm nagul Have you tried doxygen and codeviz ? Doxygen is normally used as a documentation tool, but it can generate call graphs for you with the CALL_GRAPH/CALLER_GRAPH options turned on. Wikipedia lists a bunch of other options that you can try. Good old cflow works fine for C. See here for an implementation. Any decent static analysis

Call graph generation from matlab src code

谁说我不能喝 提交于 2019-11-30 03:39:58
I am trying to create a function call graph for around 500 matlab src files. I am unable to find any tools which could help me do the same for multiple src files. Is anyone familiar with any tools or plugins? In case any such tools are not available, any suggestions on reading 6000 lines of matlab code without documentation is welcome. Let me suggest M2HTML , a tool to automatically generate HTML documentation of your MATLAB m-files. Among its feature list: Finds dependencies between functions and generates a dependency graph (using the dot tool of GraphViz) Automatic cross-referencing of

Can clang generate a call graph for an Xcode project (in Objective-C?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 22:38:53
I found this example that looks like it outputs what I want for C++. How can it be done for the Objective-C code in an Xcode project? I see mentions of Doxygen being able to create a call graph, but I can't find an example. (I want to get to know clang better, but it's hard to get started...) Absolutely. There are a couple of tricks that you need to understand, but it's not too bad. First, you need a compatible version of opt , since it doesn't come with the LLVM Apple ships. I got mine from macports: port install llvm-3.0 Then you need to compile your file. Working out the parameters can

A 'profiler with visualization' for PHP with `full backtrace visualization`?

。_饼干妹妹 提交于 2019-11-29 20:37:44
问题 Currently, I am using xdebug profiler & KCacheGrind . But GallGrind format does not store full call trace, just the parent child call traces (look at Kcachegrind/callgrind is inaccurate for dispatcher functions? for what I am talking about.) Is there a profiler with visualization with full backtrace visualization available for PHP? I have looked at PHP Quick Profiler: But, It requires too much code to be added and no visualization. phpCallGraph: Its most recent version has been modified on

Are there any static Call-Graph and/or Control-Flow-Graph API for JavaScript? [closed]

喜欢而已 提交于 2019-11-29 19:59:47
Are there any Call-Graph and/or Control-Flow-Graph generators for JavaScript? Call Graph - http://en.wikipedia.org/wiki/Call_graph Control Flow Graph - http://en.wikipedia.org/wiki/Control_flow_graph EDIT: I am looking specifically for a static tool that let me access the graph using some API/code To do this, you need: parsing, name resolution (handling scoping) type analysis (while JavaScript is arguably "dynamically typed", there are all kinds of typed constants including function constants that are of specific interest here) control flow analysis (to build up the structure of the control

Build a Call graph in python including modules and functions?

筅森魡賤 提交于 2019-11-29 19:11:58
I have a bunch of scripts to perform a task. And I really need to know the call graph of the project because it is very confusing. I am not able to execute the code because it needs extra HW and SW to do so. However, I need to understand the logic behind it. So, I need to know if there is a tool (which do not require any python file execution) that can build a call graph using the modules instead of the trace or python parser. I have such tools for C but not for python. Thank you. The best tool I've found is called pyan , and was originally written by Edmund Horner , improved by him , and then