Professional Documents
Culture Documents
Debugging and Profiling (C++) 7 Half Days
Debugging and Profiling (C++) 7 Half Days
Program Outline
The training program explains the importance of debugging and explores various types of
debugging. Some of the commonly used debugging tools on Windows/macOS are introduced,
and their usage illustrated with examples. The emphasis then shifts to debugging performance
issues and the concept of program profiling is explained in that context. Commonly used
memory profiling tools on Windows/macOS are explained with sample programs. Several
useful tips on debugging and profiling are provided throughout the training program. Lots of
exercises are provided for hands-on experience with the concepts learned.
Pre-requisites
The participants are expected to have a good understanding of C/C++ and should have
worked on a medium-sized software project for several months.
Hardware and Software Requirements
Each participant needs a computer with Windows/macOS installed. For Windows machines,
the Debugging Tools for Windows, which is part of the Windows SDK, needs to be installed
from https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/. Further, the
Concurrency Visualizer extension for Visual Studio needs to be installed by clicking on
Extensions > Manage Extensions in the Visual Studio menu, and then searching for
Concurrency Visualizer in the Visual Studio Marketplace. For macOS machines, the latest
version of Xcode needs to be installed.
Pre-reading Material
None.
Program Contents
Day 1 (Windows & macOS)
1. Importance of debugging
2. Defensive coding
o Using assertions in code
o Preconditions and postconditions
o Compile time assertions
o Tracing & logging in Windows & macOS
3. Reproducing the problem
o Isolating the causes of failure
o Automation is your friend
4. Overview of debugging in Xcode & Visual Studio
o Debug windows - Watch, breakpoints, memory, threads, tasks, registers
o Attaching to running process
5. Understanding debugging symbols
6. Symbols in Visual Studio, Xcode
7. Setting up symbol paths in Visual Studio
8. Understand program stack
9. Debugging with static analysis tools
10. Debugging optimized code
o Overview of compiler optimizations
o Problems created by optimizations for debugging
o Turning off optimizations using compiler directives
11. Debugging Multithreaded applications
o Deadlocks & avoidance
o Race conditions
12. Memory Issues
o Uninitialized pointers
o Buffer overflow (stack & heap)
o Invalid/dangling pointers
o Double delete
o Memory leaks
Day 5 (Windows)
18. Debugging tools for Windows
19. Detecting leaks in release builds – UMDH
o UMDH options
o Understanding stack backtraces to locate leaks
20. Detecting memory issues with Visual Studio
o Concept of heap corruption detection
o Crt function for detecting heap corruption
o Address sanitizer
~o~