Reputation: 203
I have a system developed in C++ on Linux platform. I am doing some debugging of this system. I want to look for the complete sequence of function calls to a function. Lets assume the functions are called in the following sequence
function_1 -> function_2 -> function_3 -> function_4
If I put a break point at function_4, the execution will be holded at that point. I want to see that functions_1, function_2 and function_3 are called before function_4. If there any gdb command to trace these function calls?
Thanks, Ankur
Upvotes: 3
Views: 4624
Reputation: 23848
If function_1() calls function_2() which calls function_3() etc
You can set your breakpoint in function_4() and you use the command
where
To print a backtrace of the stack
Another tool that may be useful is valgrind with the callgrind tool
Upvotes: 1
Reputation: 16290
You want a backtrace. The gdb
command bt
will show exactly what you are interested in.
Upvotes: 8
Reputation: 156
bt: backtrace http://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
Upvotes: 2