Debuggers and Debugging

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.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
CIT 590 Debugging. Find a laptop Please take a moment to open up your laptop and open up Eclipse. If you do not have a laptop, please find a friend. If.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Python quick start guide
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.
Introduction to Python Basics of the Language. Install Python Find the most recent distribution for your computer at:
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Debugging UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative Commons.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
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.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Eclipse debugger.
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.
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.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
COP 3530 Spring 12 Discussion Session 1. Agenda 1.Introduction 2.Remote programming 3.Separate code 4.Compile -- g++,makefile 5.Debug -- gdb 6.Questions?
Debug in Visual Studio Windows Development Fundamentals LESSON 2.5A.
Lab 9 Department of Computer Science and Information Engineering National Taiwan University Lab9 - Debugging I 2014/11/4/ 28 1.
Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first.
Copyright Ó Oracle Corporation, All rights reserved Debugging Triggers.
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
An introduction to the debugger And jGrasp editor-syncrasies (ideosyncrasies)
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors Locate seg faults and bus errors Prepared by Dr. Spiegel.
Debugging with Eclipse
Debugging with Clion and GDB
Compiler Construction (CS-636)
CS1101X Programming Methodology
Computer Architecture
Testing and Debugging.
Computer Programming I
Debugging CMSC 202.
A451 Theory – 7 Programming 7A, B - Algorithms.
CS 153: Concepts of Compiler Design November 30 Class Meeting
TRANSLATORS AND IDEs Key Revision Points.
Debugging with Eclipse
Debuggers.
Comp 110/401 Appendix: Debugging Using Eclipse
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Using a Debugger 1-Jan-19.
Debugging Taken from notes by Dr. Neil Moore
Decision Structures and Indefinite Loops
Introduction to Dictionaries
Testing, debugging, and using support libraries
Recursion and Implementation of Functions
Scope Rules and Storage Types
Homework #5 — Monte Carlo Simulation
Elements of a Python Program
More About Functions Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Variables, Lists, and Objects
Simple Graphics Package
Objects (again) Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
More elements of Python programs
Notes on pyplot Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
Notes about Homework #4 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
CSV files Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
Note on Program Design Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
Notes on Homework #6 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Debugging Taken from notes by Dr. Neil Moore
Debugging Visual Basic Programs
jGRASP editor-syncrasies (idiosyncrasies)
Numpy, pylab, matplotlib (follow-up)
Debugging with Eclipse
Presentation transcript:

Debuggers and Debugging Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2nd edition, by John Zelle and copyright notes by Prof. George Heineman of Worcester Polytechnic Institute) CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging A program that “runs” another program so that You can cause it to stop or pause at designated places Examine the values of variables when stopped See where it has been called from Step one statement at a time Step over entire functions … Essential to program development in all modern languages It is too difficult … … for ordinary humans … … to develop non-trivial programs … without the aid of a debugger CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Breakpoint A “flag” inserted into code to cause running program to suspend just before executing that statement Return control to debugger In Python:– Interpreter notices flag Calls debugger In compiled languages Debugger inserts special machine instruction in compiled code Triggers “interrupt” Interrupt-handler in OS transfers control to debugger Debugger may resume execution of running program As if nothing had happened (except passage of time) CS-1004, A-Term 2014 Debuggers and Debugging

Breakpoint (continued) Debugger “knows” the source code i.e., which line is currently executing which line will execute next where variables are stored what variables are currently being changed In Python, because it is interpreted language In compiled languages, compiler plants extra info in machine code to connect to source code Go Debugger command to program to run normally until a breakpoint CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Single-step Debugger places flag in interpreter or processor to suspend execution at every statement Python interpreter “knows” whenever it is starting a new statement E.g., next statement in-line Branch of if-else Loop iteration … In compiled languages, Special modes in processor CS-1004, A-Term 2014 Debuggers and Debugging

Single-step scenarios Simple Python statements Stops at start of every statement Function call, or Expression containing function call Stops at first statement inside function Function return Stops at first statement after function call (including first statement inside another function) (not including system & library functions) CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Clear Breakpoint Removes breakpoint Handy when you are satisfied with a piece of code and want to go on to debug next piece CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Questions? CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Step Over Debugger places (temporary) breakpoint at start of next statement Or function call, etc. Runs freely until next breakpoint (Temporary) breakpoint placed above Any other breakpoint CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Step Out Find caller of current function Place (temporary) breakpoint immediately after that call At start of next statement CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Viewing variables IDLE debugger lists all variables in current scope of current function Click on call history to see variables in scope of calling function(s) Can maneuver up and down ‘call stack’ Check source box to track execution i.e., highlight each line as it is executing Check the box to show globals I.e., variables, etc., defined outside of any function CS-1004, A-Term 2014 Debuggers and Debugging

Debuggers and Debugging Questions? CS-1004, A-Term 2014 Debuggers and Debugging