Need help with tracetool?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

128 Stars 11 Forks GNU Lesser General Public License v3.0 1.2K Commits 0 Opened issues


An efficient and configurable logging framework for C++

Services available


Need anything else?

Contributors list

tracetool - a configurable and efficient logging framework for C++

tracetool is a framework created by froglogic for tracing the execution of a C or C++ program and inspecting its state. This is achieved by instrumenting the source code of the target program and linking the recompiled sources against a shared


Image Of TraceTool GUI


tracetool is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


Building the framework requires

The actual build is the merely a matter of running the commands


On Windows, you may want to pass

-G "NMake Makefiles"
to cmake to generate Makefiles and then use
to use those Makefiles.

Quick Start

Here's a quick step by step guide on how to instrument a basic program so that it generates trace information. Here's the initial source code of the sample program:


int main() { using namespace std;

string name;
cout << "Please enter your name: ";
cin >> name;

cout << "Hello, " << name << "!" << endl;


First, instrument the above source code so that the

header is included and insert a few calls to various tracelib macros into the source code. Here's the instrumented code:

#include "tracelib.h"

int main() { fTrace(0) << "main() entered";

using namespace std;

string name;
cout &lt;&lt; "Please enter your name: ";
cin &gt;&gt; name;

fWatch(0) &lt;&lt; fVar(name);

cout &lt;&lt; "Hello, " &lt;&lt; name &lt;&lt; "!" &lt;&lt; endl;

fTrace(0) &lt;&lt; "main() finished";


Save the resulting file to e.g.


Here's a sample compile line for use with

(the compiler which comes with Microsoft Visual Studio):
cl /EHsc hello_instrumented.cpp /I \include\tracelib

The resulting binary (

in the above case) will behave as before. The tracing (and the resulting change to runtime performance) is only activated in case a special configuration file was detected.

Creating a configuration file is a matter of writing some XML. Save the following file as

and store it in the same directory as
which was built above:

Now, running the program will generate quite a bit of additional output:

03.09.2010 16:00:56: Process 2524 [started at 03.09.2010 16:00:56] (Thread 468): [LOG] 'main() entered' hello_instrumented.cpp:8: int __cdecl main(void)
Please enter your name: Max
03.09.2010 16:00:57: Process 2524 [started at 03.09.2010 16:00:56] (Thread 468): [WATCH] hello_instrumented.cpp:16: int __cdecl main(void)
Hello, Max!
03.09.2010 16:00:57: Process 2524 [started at 03.09.2010 16:00:56] (Thread 468): [LOG] 'main() finished' hello_instrumented.cpp:20: int __cdecl main(void)
03.09.2010 16:00:57: Process 2524 [started at 03.09.2010 16:00:56] finished


The tracetool framework consists of multiple components:

  • tracelib.dll
    on Linux) is a dynamic library (plus accompanying header files) which has to be linked into any application which wishes to use the tracing functionality.
  • tracegui
    is a GUI for reviewing previously recorded traces as well as recording and watching the trace generated by running applications live.
  • traced
    is a daemon process which collects and stores trace data in the background without running a GUI.Traced applications can be configured to send their output over a network connection to
    . The recorded traces can be sent to other people and reviewed later using
  • trace2xml
    is a utility program for dumping a trace database generated by
    into an XML file which can then be processed by other scripts.
  • xml2trace
    performs the reverse operation of
    : given an XML file, a
    file is generated which can be loaded by
  • convertdb
    is a helper utility for converting earlier versions of databases with tracelib traces.


This project is really just standing on the shoulders of giants. It was made possible by and takes advantage of a few other open source projects:

  • The PCRE library is used for matching function names to include in the execution trace via regular expressions.
  • For matching functionn names to include in the execution trace via wildcard patterns, the wildcmp function is used.
  • Reading the
    file is done using the TinyXML parser.
  • Stack traces logged for selected trace points are generated by StackWalker.
  • Efficient storage of execution traces is implemented using SQLite.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.