During one of my recent discussions with my manager, he mentioned that one of his former clients used a C++ macro to log info about every line of code. All they had to do was en
I don't know if every line/variable can be expanded like that, but function calls can be logged. I have logged all function calls using the -finstrument-functions option of gcc. It will call:
void __cyg_profile_func_enter (void *this_fn, void *call_site);
and
void __cyg_profile_func_exit (void *this_fn, void *call_site);
for function enter and exit.
The docs explain how to use it. I don't know if other compilers offer something similar.