O'Reilly logo

Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming by Zed A. Shaw

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

Exercise 20. Advanced Debugging Techniques

I’ve already taught you about my awesome debug macros, and you’ve been using them. When I debug code I use the debug() macro almost exclusively to analyze what’s going on and track down the problem. In this exercise, I’m going to teach you the basics of using GDB to inspect a simple program that runs and doesn’t exit. You’ll learn how to use GDB to attach to a running process, stop it, and see what’s happening. After that, I’ll give you some little tips and tricks that you can use with GDB.

This is another video-focused exercise where I show you advanced debugging tricks with my technique. The discussion below reinforces the video, so watch the video first. Debugging will be much easier to learn by watching ...

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