Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
MT311 Tutorial Li Tak Sing( 李德成 ). Uploading your work You need to upload your work for tutorials and assignments at the following site:
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
How to Debug VB .NET Code.
Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
Using a Debugger. SWC What is ”debugging”? An error in a computer program is often called a ”bug”… …so, to ”debug” is to find and get rid of errors in.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
Playing Back Scripts In HP LoadRunner >>>>>>>>>>>>>>>>>>>>>>
CPSC1301 Computer Science 1 Overview of Dr. Java.
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
ME 142 Engineering Computation I Debugging Techniques.
Testing and Debugging Session 9 LBSC 790 / INFM 718B Building the Human-Computer Interface.
9/2/ CS171 -Math & Computer Science Department at Emory University.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Eclipse debugger.
Debugging and Profiling With some help from Software Carpentry resources.
Debugging Visual Basic.NET Programs ► ► Use debugging tools ► ► Set breakpoints and correct mistakes. ► ► Use a Watch and Local window to examine variables.
Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
Copyright © 2004 – 2013 Curt Hill Java Debugging In Eclipse.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Slide 1 What we'll cover here l Using the debugger: Starting the debugger Setting.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 3 – Inventory Application: Introducing Variables,
Georgia Institute of Technology Creating Classes part 2 Barb Ericson Georgia Institute of Technology June 2006.
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
Using the Eclipse Debugger Extra Help Session (Christina Aiello)
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
1 Using an Integrated Development Environment. Integrated Development Environments An Integrated Development Environment, or IDE, permits you to edit,
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors Locate seg faults and bus errors Prepared by Dr. Spiegel.
Debugging with Eclipse
Appendix A Barb Ericson Georgia Institute of Technology May 2006
ME 142 Engineering Computation I
Appendix A Barb Ericson Georgia Institute of Technology May 2006
CS1101X Programming Methodology
What to do when a test fails
Debugging Dwight Deugo
Eclipse Navigation & Usage.
Testing and Debugging.
Computer Programming I
Debugging CMSC 202.
Barb Ericson Georgia Institute of Technology Dec 2009
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
Debugging with Eclipse
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Debugging CSCE 121 J. Michael Moore.
Tonga Institute of Higher Education
Using a Debugger 1-Jan-19.
Chapter 11: Debugging.
Debuggers and Debugging
Debugging Visual Basic Programs
Debugging Dwight Deugo
How to debug a website using IE F12 tools
Running a Java Program using Blue Jay.
Chapter 15 Debugging.
Debugging CSCE 121.
Debugging with Eclipse
Workshop for Programming And Systems Management Teachers
Chapter 15 Debugging.
Presentation transcript:

Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first compiler, once found that her program failed because a dead moth was inside the computer. The phrase stuck! Debugging versus Testing: Debugging: Done by the coder while producing the code. Testing: Done after the code is produced, often by someone other than the coder.

Debugging is hard! Bugs are run-time errors – that is, they are semantic errors (the program did not do what you intended), not syntactic errors (the program has an error in its notation that makes it impossible to run) Bugs are hard to find and fix because: Programs are big; finding the place where the bug is introduced may require examining many lines of code. The bug may be an error that is spread across many lines of code. The bug may be intermittent – the evidence of the bug may come and go depending on the inputs, the state of the system, and much more. Frequently the programmer doesn’t even notice the existence of the bug!

The Debugger Debuggers : Tools that help with debugging, by allowing you to: Run the program to a “breakpoint” that you set Step through the program, line by line See the values of the variables as you do so

Starting the Debugger Set breakpoints by double-clicking on the gray bar to the left of the line numbers Double-clicking on a breakpoint removes it Run in the Debugger by selecting the “Bug” symbol to the left of the usual “Run” symbol The first time it asks if you want to enter the Debug perspective in this situation. Check the box (“Remember my decision”) and select Yes. I double-clicked here to put a breakpoint at line 30. The program will stop at that line (just before that line runs) in the Debugger.

The Debug perspective The Debug perspective shown in this and the subsequent slides has been simplified from the default Debug perspective. The controls for running in the Debugger are here Your program is here, with indicators showing the line that is currently being executed This window shows the values of the variables, highlighting changes as the program runs This is the usual Console window for print statements This window controls which variables are shown – by default, the variables in the current function Restart a Debug run here

Running in the Debugger The Debugger pauses the program at the first breakpoint that it encounters IIt stops before it has run that line TThe blue arrow shows the place where the program is currently paused, and that line is highlighted as well You can set or remove breakpoints at any point during the run BBy double-clicking on the gray bar next to the line Run to the next breakpoint by using the green-arrow (“Resume”) button If you want to stop the run, use the red-square (“Terminate”) button If you want to re-run the program, use the “Bug” button again I added another breakpoint at line 36v

Stepping in the Debugger The program stops at your first breakpoint IIt stops before it has run that line TThe blue arrow shows the place where the program is currently paused, and that line is highlighted as well The control bar allows you to: SStep Into – run the next statement of the program IIf the statement is a function call, the Debugger enters that function SStep Over – run the next statement of the current function IIf the statement is a function call, enter that function, do its stuff, and return from the function (thus “stepping over” that function call) SStep Return – run all the remaining statement in the current function and returning to the point at which the function was called RResume – i.e., run to the next breakpoint

Examining variables in the Debugger The Variables window shows variables and their values  At the point at which the program is paused  Variables in the current function are shown  Selecting a different function in the call stack shows its variables This example shows variables when the program is paused at line 37 The window identifies the type of the variable The variable c was modified since the previous pause-point, so c is highlighted You can expand variables to see their fields. In the example to the right, I have expanded c (the Circle), then expanded its field p2 (a Point). See if you want to learn more about the Pydev debugger. The window typically shows the value of an object by showing some of its fields.