Try using preprocessor macros to make your stub functions unique so the optimizer won't merge them into one.
__FILE__, __LINE__, and __FUNCTION__ usage in C++
Something like this:
void A() { cout << __FUNCTION__ << endl; }
void B() { cout << __FUNCTION__ << endl; }