Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracing function calls in C++ using gdb

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

like image 426
user982740 Avatar asked Jan 27 '26 12:01

user982740


1 Answers

You want a backtrace. The gdb command bt will show exactly what you are interested in.

like image 69
StilesCrisis Avatar answered Jan 29 '26 01:01

StilesCrisis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!