Compiling and running in a verbose mode to capture program trace

Hi, is there an option to compile and run Ardupilot in a verbose state that logs the program trace? I want to output specifically when a function is invoked and when. I want to do this for all functions.

This might be a good start:
./Tools/autotest/autotest.py --no-clean build.Copter fly.ArduCopter --gdb

yes, just use waf configure --debug

Thank you. This seems to work.