Debugging and Profiling C++ Code on Linux

“Debugging and Profiling C++ Code on Linux” is a two-day training course with programming exercises taught by Milian Wolff of The KDAB Group. It is offered at the Gaylord Rockies from 9AM to 5PM on Saturday and Sunday, September 14th and 15th (immediately prior to the conference). Lunch is included.

Course Description

This course teaches C++ developers the other side of the development story: the time spent writing C++ code is often dwarfed by the time required to find bugs and improve performance.

This training gives an introduction to various tools which help C++ developers and testers at finding bugs and performance issues of native applications written in C++ under Linux. The training is applicable to both desktop as well as embedded developers.

The tools presented cover a wide range of problems, from general purpose debugging and CPU profiling to domain-specific high-level analyzers. Often, it is relatively simple to run a tool, but interpreting the results, or even just using some of the more advanced tools, requires deep technical knowledge.

During the training the participants will do hands-on exercises (“labs”) to optimize or find bugs in existing code.

After the two training days, attendees will have a solid understanding of the tooling landscape on Linux, which should boost their productivity by knowing which tool to use in which situation.

Course Topics

Debugging:

  • debuggers – GDB and RR
  • sanitizers – address, undefined behaviour and thread
  • valgrind
  • assertions
  • strace
  • static code analysis

Profiling:

  • manual timing
  • Linux perf – stat, trace, sampling and off-cpu profiling, hotspot UI frontend
  • heaptrack
  • Intel V-Tune
  • LTTng

Prerequisites

This course introduces all presented tools without requiring prior knowledge of them. The examples and labs are written in C++, having basic C++ knowledge is sufficient. While we use Qt as the build system and to display a UI in some of the examples and labs, no knowledge of Qt is required.

A VirtualBox VM with most of the tools installed will be provided in advance of the course. Some tools are limited in the VM, as the VM has no support for accessing the performance counters (PMU) of the host. This mainly affects RR, which is used in one lab, so it needs to be installed on the host. It also affects perf and V-Tune, although the performance counter support in these is not needed for the labs. Nevertheless perf and V-Tune can optionally be installed on the host to see the full performance counter support.

For installing the required RR tool on the host, the following is needed:

For the other optional host tools, the following is needed in addition:

Register Here

Course Instructor

Milian Wolff is a Senior Software Engineer at KDAB, Milian leads the R&D in tooling and profiling in which he has a special interest. Milian created Massif-Visualizer and heaptrack, both of which are now used regularly to improve the performance of C++ and Qt applications. When not applying his knowledge to improving code base performance for KDAB’s customers, Milian maintains QtWebChannel for the Qt Project and is co-maintainer of the KDevelop IDE. In 2015, Milian won KDE’s Akademy Award for his work on Clang integration. He has a Masters Degree in Physics.