Refactor out common entry/exit code.

Whether we're entering or exiting a function, we care about the same function and arguments. We do need to handle the return value, but we're not doing that properly yet.
Trivial: add 'using std::string'.