How can I know which file called the function? cpp

410 views Asked by At

I'm trying to understand a program(Moveit!) connected with many other files. The program runs fine without any problem, but I want to know which function(from a different directory) calls the function I'm interested in. Since there are so many directories and functions of the same name, I can't just simply track them easily. So far, I've just tracked the caller function by manually opening all other files. Can I know how to track down the caller function(or file)?

For example, I've attached a code below that which caller function and file location I want to know.

bool ompl_interface::ModelBasedPlanningContext::solve(planning_interface::MotionPlanResponse& res) {   ...   }
1

There are 1 answers

1
kilomikesierra On BEST ANSWER

Thank you guys! The program I've been using(ROS Moveit!) had a built-in gdb debugger and I could find the log file which showed all the directories .cpp file launched. This might not be applied to all for sure, but below is just an example of the location of the log file for my case.

~/.ros/log/cf90466c-a51d-11ec-b5e0-7085c253edd4/rosout.log