Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ function call routes resolver

I'm looking for a tool that will tell/resolve for every function all the call paths (call it "routes") to it.

For example:

void deeper(int *pNumber)
{
 *pNumber++;
}
void gateA(int *pNumber)
{
 deeper(pNumber);
}
void gateB(int *pNumber)
{
 gateA(pNumber);
}

void main()
{
 int x = 123;
 gateA(&x);
 gateB(&x);
}

See? I need a tool that will tell me all the routes to deeper(), and more if possible.

By saying "more" I mean that it will tell me if the pointer is the same as been provided to the calling function.

This will greatly save me time. Thanks!

like image 316
Poni Avatar asked Mar 22 '10 18:03

Poni


3 Answers

I think cppDepend has that functionality (along with other code analysis features)

like image 121
Dror Helper Avatar answered Nov 11 '22 22:11

Dror Helper


Doxygen will do that for you. It'll draw you nice inheritance trees and show you everyone who is calling (and called by) your functions.

like image 21
Michael Kristofik Avatar answered Nov 11 '22 21:11

Michael Kristofik


you can look at the clang analyzer.

The Clang Static Analyzer is source code analysis tool that find bugs in C/C++ and Objective-C programs.

I didn't tried it but looking at the screenshots of code review, it might be usefull

like image 1
Mathieu Avatar answered Nov 11 '22 23:11

Mathieu