Debugging CSCE 121.

Slides:



Advertisements
Similar presentations
VCE SD Theory Slideshows By Mark Kelly Vceit.com Debugging Techniques.
Advertisements

Introduction to Recursion and Recursive Algorithms
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.
Programming Types of Testing.
1 Basic Definitions: Testing What is software testing? Running a program In order to find faults a.k.a. defects a.k.a. errors a.k.a. flaws a.k.a. faults.
MT311 Tutorial Li Tak Sing( 李德成 ). Uploading your work You need to upload your work for tutorials and assignments at the following site:
 Monday, 9/9/02, Slide #1 CS106 Introduction to CS1 Monday, 9/9/02  QUESTIONS?? (Exercises, Lab #1, etc.)  Today:  More on float objects  C++ concept:
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
CS 225 Lab #2 - Pointers, Copy Constructors, Destructors, and DDD.
1 Gentle Introduction to Programming Tirgul 2: Scala “hands on” in the lab.
Fundamentals of Software Development 1Slide 1 Grace Hopper ( ) An influential force and a legendary figure in the development of programming languagesAn.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Careers in Computer Science Your Future Starts at KCD.
Introduction to complexity Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Abstraction Computer Science and Software Engineering
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
HOMEWORK REVIEW This is an if else statement layout if (condition) { code to be executed if condition is true; } else { code to be executed if condition.
Week 5 - Wednesday.  What did we talk about last time?  Exam 1!  And before that?  Review!  And before that?  if and switch statements.
Week 91 Introduction to Programming Ms. Knudtzon C Period Quarter 2 – Lecture 20 Monday, November 1 st.
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.
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
Program Errors and Debugging Week 10, Thursday Lab.
Debugging and Profiling With some help from Software Carpentry resources.
Getting Started with MATLAB (part2) 1. Basic Data manipulation 2. Basic Data Understanding 1. The Binary System 2. The ASCII Table 3. Creating Good Variables.
Chapter 1 Introduction. Chapter 1 -- Introduction2  Def: Compiler --  a program that translates a program written in a language like Pascal, C, PL/I,
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
Efficiently Solving Computer Programming Problems Doncho Minkov Telerik Corporation Technical Trainer.
Debugging What coders (programmers) do to find the errors (“bugs”) in their own programs “Bugs” – Admiral Grace Hopper, developer of the world’s first.
Functions in C++ Top Down Design with Functions. Top-down Design Big picture first broken down into smaller pieces.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Introduction To Software Development Environment.
An Introduction to Programming with C++ Sixth Edition Chapter 8 More on the Repetition Structure.
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors Locate seg faults and bus errors Prepared by Dr. Spiegel.
Output THE BASICS. What is Output? Output is the information that comes FROM a computer OUT to a user Sometimes this information is feedback to an action.
Debugging with Eclipse
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors
CMPT 120 Topic: Python’s building blocks -> More Statements
14 Compilers, Interpreters and Debuggers
AP CSP: The Need for Programming Languages and Algorithms
ME 142 Engineering Computation I
Testing and Debugging PPT By :Dr. R. Mall.
Testing and Debugging.
Grace Murray Hopper.
Debugging CMSC 202.
Lecture 2 Introduction to Programming
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
Computational Thinking
Lesson 2 Understanding Software Bugs
Debugging with Eclipse
Debugging CSCE 121 J. Michael Moore.
Coding Concepts (Standards and Testing)
Debugging at Scale.
Using a Debugger 1-Jan-19.
Repetition Structures
Debugging Taken from notes by Dr. Neil Moore
DEBUGGING CS2110.
Programming.
Chapter 11: Debugging.
Debugging “Why you were up till 2AM”
Debugging Taken from notes by Dr. Neil Moore
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 1 Introduction.
Module Recognition Algorithms
Review of Previous Lesson
Debugging with Eclipse
Presentation transcript:

Debugging CSCE 121

Early Bug https://www.wired.com/2013/12/googles-doodle-honors-grace-hopper-and-entomology/ Hopper received her PhD in Mathematics from Yale University in 1934. She left a faculty position at Vassar to join the Navy in 1943, and was assigned to work on the “Mark I Electromechanical Computing Machine.” It was 51 feet long, 8 feet high, and 8 feet deep. From there, Hopper went on to work in academia, industry, and the military, staying on the cutting edge of computing. Her best known innovation is the compiler, but she is also responsible for COBOL, FORTRAN, and many other computing innovations. Whether or not Hopper coined the term “computer bug” is a source of some controversy. The Navy promotes the idea that it was Hopper that squashed the first computer bug; there is an actual photo of the offending insect on Hopper’s US Navy webpage: (image in slide) Somehow, “computer moth” just doesn’t have the same resonance. If you dig a little deeper, though, it appears the use of “bug” to describe a technical problem has a complex history–and in fact, may not have originated with Grace Hopper at all: “The OED Supplement records sense (4b) of the noun bug (“a defect or fault in a machine, plan, or the like”) as early as 1889. In that year the Pall Mall Gazette reported (11 Mar: 1) that ‘Mr. Edison … had been up the two previous nights discovering a ‘bug’ in his phonograph–an expression for solving a difficulty, and implying that some imaginary insect has secreted itself inside and is causing all the trouble.’…. This meaning was common enough by 1934 to be recognized in Webster’s New International Dictionary: ‘bug, n…. 3. A defect in apparatus or its operation… Slang, U.S.’” (citation) So, the “actual bug” notation in the lab notebook above probably reflects the amusement of the technician at finding a physical bug, when the word bug was already in use as slang for a problem. It does appear that the term “debugging” came into use around Hopper's time period, but I haven’t seen any evidence firmly tying it to this particular moth. Oh well. BTW, The Grace Hopper Celebration of Women in Computingis the largest technical conference for women in computing. Get involved!

“If debugging is the process of removing software bugs, then programming must be the process of putting them in.” Edsger Dijkstra

Debugging Figuring out what is wrong with the code we wrote… Analyze problem Compare program results with hand executed results. A couple of tools Judicious use of print statements (i.e. cout) Careful use of debugging tool.

Print Statements Sometimes you have no choice. Print out data at different points in the program. Make certain you can determine where a particular output comes from. Examples “Starting function X” “Ending function X” “Value(s) before processing/calculation” “Value(s) after processing/calculation”

Debuggers Allow you to look at things while the program is running. At any point in the program, you can see the call stack. Local variables and parameter values.

Breakpoints Breakpoints can be placed on any executable statement in your code. When the program executes, it will pause at a breakpoint. You can look at variable values, etc.

Moving Through Code Once stopped you can execute the code line by line. Three options Step Over Move to the following statement. This will not enter any functions called on the current line (unless it finds another breakpoint in a function called before the next line). Step Into Go into the next function on the current line (if there is one.) Note: functions may be nested. Step Out Stop going line by line in the current function and move to the next line of code in the calling function.

More? There is a lot more out there regarding debugging. However, these basics should help you tremendously as you gain experience programming. If you find you need more, you can do some self-teaching!