Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

control flow graph of a c program to find worst possible path

Are there any tools, libraries, or frameworks to get the control flow graph of a C program, and find the worst possible path a program can take?

When I read the other questions related to control flow graphs, I came across a few tools which can generate the control flow graph. Is there any way to use them to find the worst possible path?

like image 886
Hari Krishna Avatar asked Nov 15 '22 00:11

Hari Krishna


1 Answers

If the graph will ever have loops in it, then no -- there isn't a foolproof way to figure this, as the question is equivalent to the halting problem. Short version: it's impossible for a program, given an arbitrary other program, to even determine whether it will ever return. You could possibly determine potential infinite loops, but the only way to be anywhere near certain is to actually run the program with an exhaustive set of inputs.

like image 163
cHao Avatar answered Feb 06 '23 04:02

cHao