Advanced Debugging
- finish. Finish current function, then break. Useful
when you step into a function that you didn't mean to.
- return. Prematurely finish current function, then break.
return 3 causes the function to prematurely finish with 3
as its return value.
- whatis treeptr. Prints data type of treeptr.
- whatis size_t. Prints out definition of type size_t.
- call factorial(5). Calls the function factorial with
argument 5 and prints the result.
- x = 7. Sets program variable x to 7.
- display x. Print value of x every time the program
stops.
- undisplay x. Turns off display mode for variable x.
- watch x. Breaks program whenever x changes.
- rwatch x. Breaks program whenever x's value is
used. [x = 7; would cause a watch to stop, y = x;
would cause a rwatch to stop, and x++ would cause both to
stop.]
- clear 54. Clears breakpoint (if any) at line 54.
- file prog7. Change file to be debugged to prog7.
- info breakpoints. List current breakpoints.
Next Slide