My Best
Debugging Tip

Stockholm C++ 20181122

Paul Dreik

Avoid it

But if you can't, do the best of the situation.

aviation safety


  • Before
  • During
  • After


Maintain high quality

Stuff to know

Best Practices

Stuff to know

  • undefined behaviour
  • race conditions
  • one definition rule


  • compiler warnings
  • static analysis
  • assert()
  • contracts (soon!)

Address sanitizer


Debug Iterators

Widen your world

  • multiple platforms
  • multiple compilers

Practice and prepare

  • setup for debugging from the start
  • try other tools
  • try something unfamiliar


Be efficient - how?

Know your primary tool!

Break mode

Drag Yellow Arrow to g(), then run

Thread NAME is updated!

Find and reproduce

  • debug/release build
  • sanitizers
  • valgrind

Prove the bug with a test

Commit the failing test

Fix the bug

The test now passes


Feedback and learning

Changes in procedures?

Changes in testing?

Changes in coding guidelines?

Introduce other tools?

Share the knowledge!

Good luck!