O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction to debugging

Your program does not work, and you have no idea why. Worry not, for you are not alone: everyone who is a programmer has been there. How we fix this depends quite a lot on what kind of tools the ecosystem gives us.

  • Debug printing: Just sprinkle print statements near the places where you suspect the bug is happening. Simple, crude, and often effective, but it is definitely supported in virtually every ecosystem. This technique requires no extra tools, and everybody knows how to do it.
  • REPL-based debugging: The read-eval-print loop gives you a flexible interface where you can load any of your libraries and run code in them in a safe session. Extremely useful, especially if you've managed to properly compartmentalize ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required