<p>I have intermittent crashes occurring in my ActiveMQ libraries due to the way I'm using the activemq-cpp API.  It'd be much easier to debug the issue if I could observe every function being called leading up to the crash.  Are there any quick ways to trace the entry and exit of functions in a Visual Studio 2005 c++ multithreaded program?</p>

<p>Thanks in advance!</p>

Use a Tracer object.  Something like this:
```
```
class Tracer
{
public:
  Tracer(const char *functionName) : functionName_(functionName)
  {
    cout << "Entering function " << functionName_ << endl;
  }

  ~Tracer()
  {
    cout << "Exiting function " << functionName_ << endl;
  }

  const char *functionName_;
};
```
```
Now you can simply instantiate a Tracer object at the top the function, and it will automatically print "exiting... " when the function exits and the destructor is called:
```
```
void foo()
{
  Tracer t("foo");
   ...
}
```
```