From the course: Debugging C Code

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Setting breakpoints

Setting breakpoints - C Tutorial

From the course: Debugging C Code

Start my 1-month free trial

Setting breakpoints

- [Instructor] I've created a debug build of this movie's exercise file, 03_02 bug1. Let me run it to see what's going to happen. (beeping) Uh, oops. (chuckling) The code needs some debugging, some fixing in the new debugger so let me start that. GNU debug and then the program name. List the cost. And press Enter to see the rest. Perhaps you can see where the error occurs but let me show you how to use two tools, breakpoints to stop execution and variable dumps to view variable values while the code runs. So I'll set a breakpoint on line nine. And now run. And the code stops at the breakpoint. To see the value of variable x, type print x, the variable name. And to see the value of variable string, same thing and there's its value. To step to the next line of code, type next and then next again and eventually the loops start again or you can just specify a repeat value for the next command. Repeat three…

Contents