Hands-On Introduction to the Dark Art of Interactive Debugging Tools [2023 class archive (-)]

This class has been cancelled

Course Description

The goal of this workshop is to present learners tools and strategies to save time using interactive debuggers, static analysis, and dynamic analysis tools. Learners will interactively learn how to use the GDB debugger, static analysis tools (e.g. cppcheck), and dynamic analysis tools (e.g. perf, strace, ltrace, sanitizers) to write better software and find bugs more quickly. The intended audience is for junior level engineers, students, or engineers newer to working with compiled languages (e.g. C++) who want a quick start to understand the methodology of which tools to help get them out of trouble.


Desire to learn above all.

C++ competence at the intermediate level, some familiarity with concurrent programming are needed.

Students will be provided an optional virtual machine with software setup. Otherwise students will be asked to install the following software:

  • A recent C++ compiler (e.g. clang++ version 7 or greater or g++10 or greater)
  • gdb (version 10 or greater is recommended but most versions should be fine)
  • strace
  • ltrace
  • cppcheck

Course Topics

  • Introduction
      1. The cost of bugs
      2. Debugging versus Testing
      3. Psychology of bugs
  • Interactive Debuggers Introduction – Part 1
  • The audience will be expected to follow along interactively during this section in a learning cycle (i.e. instruction shows, then audience tries, then we discuss)
      1. Why an interactive debugger versus ‘printf’ or ‘cout’ debugging
      2. GDB Introduction and and a note on compilation (installation, setup, and abilities)
      3. Using GDB to interactive debug basics
  • Cover: refresh and Ctrl+l
      1. Using GDB to interactively analyze code
      2. Using GDB to interactively debug with the stack frame
      3. Moving faster with GDB
  • Interactive Debuggers Introduction – Part 2
      1. Setting values in GDB: set value
      2. Displaying values changed: display
      3. Bookmarks and Checkpoints
      4. Setting output to a new window
  • Interactive Debuggers Introduction – Part 3
      1. In this section, students will work more in-depth on improving workflow
      2. Speeding up debug process: executing shell commands and make
      3. Writing gdbscripts and python scripts
  • Some Tips and Quirks when debugging
      1. Initialization of variables in GDB
      2. Turning on and off optimizations (show -fno-inline)
  • Time Travel Debugging
      1. Using GDB to capture snapshots of your program
      2. Going Further:
        1. Briefly introduce rr and Undo’s time travel debuggers.
  • Static Analysis Tools
      1. Demonstration with cppcheck
  • Dynamic Analysis Tools
      1. Introduction to valgrind for handling memory leaks.
        1. Demonstration of how to use valgrind with GDB.
      2. clang++ and g++ sanitizers
      3. Briefly introduce perf for capturing performance related bugs
      4. Brief introduction to strace and ltrace
  • Programming Defensively in C++
      1. Conditional Compilation
        1. How to properly build a DEBUG build.
      2. Using assertions and exceptions
      3. How constexpr helps us write safer code
      4. Defending against bugs with Unit Testing Frameworks
        1. (Demonstrated with Catch2)
  • Conclusion and Question and Answer
  • Bonus Exercise (if time, audience chooses)

Register Here

Course Instructor

Mike ShahMike Shah is currently an Associate Teaching Professor at Northeastern University in the Khoury College of Computer Sciences. His primary teaching interests are in computer systems, computer graphics, and software engineering. His research interests are related to performance engineering (dynamic analysis), software visualization, and computer graphics.

In the past several years, Mike has enjoyed speaking and training at professional programming conferences such as CppCon, C++ on Sea, Core C++, ACCU, DConf, and Handmade Seattle.

Along with teaching, training, and research work, Mike has occasional juggles consulting work as a 3D Senior Graphics Engineer using Modern C++.