Debugging Debugging CISC 323 Winter 2006 Prof. Lamb Prof. Kelly malamb@cs.queensu.ca kelly-d@rmc.ca
Included in Courseware • Required reading: – “My Hairiest Bug War Stories” • Marc Eisenstadt • Communications of the ACM, April 1997 • Discussion – What is debugging? – What three categories are identified by Eisenstadt to better understand debugging? – What experience have you had in debugging? • Software? Hardware? Electronics? Mechanics? Anything else? 2
What is Debugging? • Various explanations – The activity that is a consequence of successful testing – The process that results in the removal of the error – The process that locates and corrects the defect » you hope! • Wikipedia definition – Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another. 3
Human Aspects • Quote on debugging by Schneiderman – Debugging is one of the more frustrating parts of programming. It has elements of problem solving or brain teasers, coupled with the annoying recognition that you have made a mistake. Heightened anxiety, and the unwillingness to accept the possibility of errors, increases the task difficulty. Fortunately, there is a great sigh of relief and a lessening of tension when the bug is ultimately … corrected. 4
High Level Approach to Debugging 1. Generate a hypothesis about the observed behaviour - May involve doing some more testing 2. Test your hypothesis – Obtain more data – Create new test cases – Trace code manually (inspect code) – Use interactive debugging tools 3. Hypothesis fails – go to 1. 4. Hypothesis passes - Make changes to code - Rerun tests - that originally uncovered the bug - that are affected by the code changes - If any tests fail – go to 1 5
Inspection vs. testing • Considering debugging, what is the advantage of code inspection over testing? 6
Eisenstadt’s Categories (fill in the details) • Why bugs were difficult to track down • Techniques used to track down the bugs • Underlying causes of the reported bugs 7
What experiences have you had debugging? • Note: rerunning the compiler to get rid of syntax errors is not debugging! • Claim: – Two of the biggest time wasters for non-software people trying to write and run software • Not knowing how to test and debug • Not knowing how to do version control 8
Recommend
More recommend