Upload
others
View
24
Download
0
Embed Size (px)
Citation preview
CS120: Debugging
W. Michael Petullo
University of Wisconsin–La Crosse
As of February 1, 2021
Debugging: Grace Hopper and her bug
Both images are in the public domain
Debugging: Summary of Think Java Appendix C
The compiler is spewing error messages Syntax errors cascade; focus on the first error.
I’m getting a weird compiler message, and it won’t go away Study the error message,look at the code, search for common syntax errors.
I can’t get my program to compile no matter what I do Ensure you are compiling thefile you intend; apply bisection.
I did what the compiler said, but it still doesn’t work Error messages give evidence,but suggested remedy might be wrong.
My program hangs Infinite loop? Ctrl-C
Program causes exception Fix what gives rise to exception, or add try/catch.
My program doen’t work Study, hypothesise, experiment. Add print statements.
Big hairy expression is broken Simplify into multiple expressions/statements.
I am really stuck Go for a walk. Clean program whitespace and add comments.
Really, really stuck Rubber ducky debugging and then use office hours