“Debugging and Profiling C++ Code on Linux” is a two-day training course with programming exercises taught by David Faure of The KDAB Group. It is offered at the Meydenbauer Conference Center from 9AM to 5PM on Saturday and Sunday, September 29th and 30th, 2018 (immediately after 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:
- a working build setup to compile C++ code
- Qt build environment
- qmake is used as the build system for the examples and labs
- QtCreator is in addition recommended to open and edit the example and lab projects easily, although any editor will do
- Kernel >= 4.x
- GCC 5.x or Clang 3.6 or higher
- RR
For the other optional host tools, the following is needed in addition:
- root privileges
- debug symbols for Qt
- On Linux, it is sufficient to install the distro-provided packages paired with their debug symbol packages. On Ubuntu e.g., install qtbase5-dev and qtbase5-dbg.
- Linux perf
- Packages on Ubuntu: linux-tools-common linux-tools-generic
- We provide a recent AppImage that you can use on https://swanson.kdab.com/owncloud/index.php/s/BBiDckKr8rldRap
- hotspot
- https://github.com/KDAB/hotspot
- We provide a recent AppImage that you can use on https://swanson.kdab.com/owncloud/index.php/s/BBiDckKr8rldRap
- Intel VTune Amplifier