Debugging Overview
Errors, Defects, and Failures
Cost of Software Defects
Software Defects Classification
Program Error and Classification
Software Defect Analysis
Assertions
Run-time Assertions
Contracts
std::stacktrace
Execution Debugging
Breakpoints
Watchpoints / Catchpoints
Control Flow
Stack and Info
Print
Disassemble
std::breakpoint
Memory Debugging
valgrind
Hardening Techniques
Stack Usage
Standard C Library Hardening
Standard C++ Library Hardening
Undefined Behavior Protections
Control Flow Protections
Sanitizers
Address Sanitizer
Leak Sanitizer
Memory Sanitizers
Undefined Behavior Sanitizer
Type Sanitizer
Sampling-Based Sanitizer
Debugging Summary
Compiler Warnings
Static Analysis
Compiler-Provided Static Analyzers
Open-Source Static Analyzers
Proprietary Static Analyzers
Code Testing
Unit Testing
Test-Driven Development (TDD)
Code Coverage
Fuzz Testing
Code Quality
clang-tidy
Code Complexity
Cyclomatic Complexity
Cognitive Complexity
Mo
dern
C++
Programming
17.
Debugging
and
Testing
F
ederico
Busato
2026-01-06
T
able
of
Contents
1
Debugging
Overview
Erro
rs,
Defects,
and
F
ailures
Cost
of
Soft
w
a
re
Defects
Soft
wa
re
Defects
Classification
Program
Error
and
Classification
Soft
wa
re
Defect
Analysis
2
Assertions
R
un-time
Assertions
Contracts
std::stacktrace
1/107
T
able
of
Contents
3
Execution
Debugging
Breakp
oints
W
atchp
oints
/
Catchp
oints
Control
Flow
Stack
and
Info
Print
Disassemble
std::breakpoint
2/107
T
able
of
Contents
4
Memo
ry
Debugging
valgrind
5
Ha
rdening
T
echniques
Stack
Usage
Standa
rd
C
Libra
ry
Hardening
Standa
rd
C++
Libra
ry
Hardening
Undefined
Behavior
Protections
Control
Flow
Protections
3/107
T
able
of
Contents
6
Sanitizers
A
ddress
Sanitizer
Leak
Sanitizer
Memo
ry
Sanitizers
Undefined
Behavior
Sanitizer
T
yp
e
Sanitizer
Sampling-Based
Sanitizer
7
Debugging
Summa
ry
8
Compiler
W
a
rnings
4/107
T
able
of
Contents
9
Static
Analysis
Compiler-Provided
Static
Analyzers
Op
en-Source
Static
Analyzers
Prop
rietary
Static
Analyzers
10
Code
T
esting
Unit
T
esting
T
est-Driven
Development
(TDD)
Co
de
Coverage
F
uzz
T
esting
5/107
T
able
of
Contents
11
Code
Quality
clang-tidy
12
Code
Complexity
Cyclomatic
Complexity
Cognitive
Complexity
6/107