Tracing C++ Sandbox

These instructions will allow you to install and compile a small C++ program to try out C++ tracing which is much better way to understand your code that alternative techniques like a traditional debugger.

To set up up a sandbox to try out C++ tracing which is a faster way to debug code.

Make sure you have our basic sandbox tools installed.

Then at the command prompt type in the following commands:

git clone https://github.com/eliotmuirgrid/core.git cd core/sandbox_tracing/ make

You are doing a git clone of this repository.

This should have compiled a program called “test”. You can run this program using:

./test

If you are using windows you will need to avoid the ./ in front to try it out. Without any arguments you should see:

Eliots-MacBook-Pro-2:sandbox_tracing eliotmuir$ ./test The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. Factorial 6! = 720

It gets more interesting when we switch on tracing using the command line settings like this:

This should give something like:

Now we’re talking. We can filter tracing to specific files using wild card matching, and we redirect to a file like this:

This will produce the file “trace.log” and only trace stuff in files matching the pattern APP*.cpp file.

Next: