My Best
Debugging Tip

Stockholm C++ 20181122

Paul Dreik

Avoid it

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

aviation safety

How?

  • Before
  • During
  • After

Before

Maintain high quality

Stuff to know

Best Practices

Stuff to know

  • undefined behaviour
  • race conditions
  • one definition rule

Tools

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

Address sanitizer

Valgrind

Debug Iterators

Widen your world

  • multiple platforms
  • multiple compilers

Practice and prepare

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

During

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

After

Feedback and learning

Changes in procedures?

Changes in testing?

Changes in coding guidelines?

Introduce other tools?

Share the knowledge!

Good luck!

links