Skip to content

Finding a path of calls between two functions in C++ #10109

Answered by dalao1337
dalao1337 asked this question in Q&A
Discussion options

You must be logged in to vote

Just to clarify what I am trying to accomplish, if we take a look at the sample program below:

void func_b(){
    func_c();
}

void func_a(){
    func_b();
}

void func_c(){
    func_d();
}

void func_d(){
}

int main(){
    func_a();
    return 0;
}

I would like to have a query that can give me the path between main() and func_d() so essentially, main() -> func_a() -> func_b() -> func_c() -> func_d(). Currently, starting from function func_d() I am able to back-track all the way to main() by using a recursive predicate that uses getACallToThisFunction() and getEnclosingFunction(). Although this is capable of asserting whether function_d() is reachable from main(), that's all that it does…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dalao1337
Comment options

Answer selected by dalao1337
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants