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