The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP 2620 1.

Slides:



Advertisements
Similar presentations
Chapter 15 Debugging. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Debugging with High Level Languages.
Advertisements

The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
PART 6 Programming 1.Decomposition 2.Three Constructs 3.Counting Example 4.Debugging.
Programming Types of Testing.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
Programming Logic and Design Fourth Edition, Introductory
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Programming Translators.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
1 Overview of Programming and Problem Solving Chapter 1.
1 Conditions Logical Expressions Selection Control Structures Chapter 5.
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.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Objective At the conclusion of this chapter you will be able to:
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
Chapter 6 Programming. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 6-2 Solving Problems using a Computer.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 6 Programming l Problem solving l Debugging.
Chapter 7 What’s Wrong with It? (Syntax and Logic Errors) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Introduction to Computing Systems and Programming Programming.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
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.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Chapter 6 Programming Adapted from slides provided by McGraw-Hill Companies Inc., modified by professors at University of Wisconsin-Madison.
Chapter 1 Introduction 2nd Semester H
ME 142 Engineering Computation I
Computer Science 210 Computer Organization
Lecture 1: Introduction to JAVA
Integers/Characters Input/Output
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Computer Engineering
Computer Science 210 Computer Organization
Chapter 15 Debugging.
Chapter 6 Programming.
Introduction to Computer Engineering
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 6 Programming.
Chapter 15 Debugging.
Introduction to Computer Engineering
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
COSC121: Computer Systems
Chapter 15 Debugging.
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 6 Programming.
Chapter 15 Debugging.
Presentation transcript:

The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP

Debugging When you drive to someplace new and you make a wrong turn, what do you do? There are two driving debugging techniques – Drive aimlessly hoping to find your way back – Return to some known position and use a map to compare where you are and where you should be

Debugging Debugging is similar to this in many ways The simplest way to keep track of where you are is to trace a program That is you keep track of the sequence of instructions that have been executed and the results it has produced

Debugging Another useful technique to divide your program into modules, similar to functions in a C program You can compare the results before and after each module to see if your code is executed properly and debug if needed

Debugging We will now look at the LC-3 simulator Using this program you can debug interactively as the program is running You can use the keyboard, monitor, and menus to control the simulator

Debugging We need to be able to: – Deposit values into memory and registers – Execute instruction sequences in a program – Stop execution when desired – Examine what is in memory and registers at any point in the program The LC-3 simulator allows all of these

Debugging There are three classes of errors: – Syntax Errors – Logic Errors – Data Errors

Debugging Syntax Errors – You made a typing error that resulted in an illegal operation. – Not usually an issue with machine language, because almost any bit pattern corresponds to some legal instruction. – In high-level languages, these are often caught during the translation from language to machine code.

Debugging Logic Errors – Your program is legal, but wrong, so the results don’t match the problem statement. – Trace the program to see what’s really happening and determine how to get the proper behavior.

Debugging Data Errors – Input data is different than what you expected. – Test the program with a wide variety of inputs.

Debugging There are three ways to debug a program: – Single stepping – Breakpoints – Watchpoints

Debugging Single-Stepping – Execute one instruction at a time. – Tedious, but useful to help you verify each step of your program.

Debugging Breakpoints – Tell the simulator to stop executing when it reaches a specific instruction. – Check overall results at specific points in the program. – Lets you quickly execute sequences to get a high-level overview of the execution behavior. – Quickly execute sequences that your believe are correct.

Debugging Watchpoints – Tell the simulator to stop when a register or memory location changes or when it equals a specific value. – Useful when you don’t know where or when a value is changed.