Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.

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.
Using Macros and Visual Basic for Applications (VBA) with Excel
BIM313 – Advanced Programming Techniques Debugging 1.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
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.
Lec6 P 1 CP2030 Visual Basic For C++ programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 6 Back To Index v Procedures and Parameters.
Finding and Debugging Errors
How to Debug VB .NET Code.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
JavaScript, Fourth Edition
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.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Visual Basic Chapter 1 Mr. Wangler.
ASP.NET Programming with C# and SQL Server First Edition Chapter 6 Debugging and Error Handling.
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Debugging Projects Using C++.NET Click with the mouse button to control the flow of the presentation.
Playing Back Scripts In HP LoadRunner >>>>>>>>>>>>>>>>>>>>>>
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
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.
Active-HDL Interfaces Debugging C Code Course 10.
ME 142 Engineering Computation I Debugging Techniques.
Visual Basic.NET BASICS Lesson 5 Exponentiation, Order of Operations, and Error Handling.
VB – Debugging Tools Appendix D. Why do we need debugging? Every program has errors, and the process of finding these errors is debugging Types of errors.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Chapter 3 The Visual Basic Editor. Important Features of the VBE Alt-F11 will open the Visual Basic Editor. The Code window is to the right, Project Explorer.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Debugging Visual Basic.NET Programs ► ► Use debugging tools ► ► Set breakpoints and correct mistakes. ► ► Use a Watch and Local window to examine variables.
Centric features In this presentation… –macro capabilities more sophisticated functionality –advanced macro features Inspector Debugging error trapping.
CS320n –Visual Programming More LabVIEW Foundations.
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.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Visual Basic Integrated Development Environment (IDE) 56:150 Information System Design.
15 Copyright © 2004, Oracle. All rights reserved. Debugging Triggers.
Chapter 7 What’s Wrong with It? (Syntax and Logic Errors) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Debugger By: Engr. Faisal ur Rehman CE-105 Spring 2007.
Chapter 2: The Visual Studio .NET Development Environment
ME 142 Engineering Computation I
How to debug an application
Debugging Dwight Deugo
Testing and Debugging.
Computer Programming I
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Our Environment We will exercise on Microsoft Visual C++ v.6
Debugging Visual Basic Programs
IDE’s and Debugging.
Debugging Dwight Deugo
Presentation transcript:

Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi

Outline Debugging strategies Error Types – Compile, Run-Time and Logical errors VB Debugger – Breakpoints, watches and stepping through Error Trapping Common Errors 6/27/20152Dr. Monther Aldwairi

Debugging Errors in a program are called bugs The process of finding and correcting them is called debugging Debugging aims at eliminating or reducing the number of bugs in a program, thus making it behave as expected. 6/27/2015Dr. Monther Aldwairi3

Debugging strategies Tracing – Putting print statement in the code to verify flow and variable values during execution – Remove print statements after the error is detected Logfile – Text file to which a debugging trace is written – Debuggers read the log file (GDB for example) Error Trapping and Handling – Used to trap fatal errors 6/27/20154Dr. Monther Aldwairi

Preferable Debug Method Use a debugger! Allows you to pause during execution in order to view or alter variables 1.Setting breakpoints (to suspend program execution) 2.Defining watch values (to see current value of variables 3.Stepping into a program (executing one instruction at a time) 6/27/20155Dr. Monther Aldwairi

Error Types Compiler Errors – Syntactic, or compilation, errors occur when VB commands are written improperly. Run-time errors – An application attempts to perform an action that the system cannot execute Logical errors – Caused by faulty program logic. 6/27/20156Dr. Monther Aldwairi

Compiler Errors Visual Basic compiler errors occur when the compiler encounters problems in the code. A pop up windows is displayed 6/27/20157Dr. Monther Aldwairi

Run-time Errors Visual Basic run-time errors occur when an application attempts to perform an action that the system cannot execute. 6/27/20158Dr. Monther Aldwairi

Logical Errors The program compiles and runs fine The program does not give the expected output General debugging strategy: 1.Place breakpoint near (preferably, slightly ahead) of suspected error source. 2.Execute program in normal fashion, until breakpoint is encountered. 3.Define one or more watch values and step through the program, one instruction at a time. 4.Follow watch values to identify location, and possibly, source, of error. 6/27/20159Dr. Monther Aldwairi

Program Modes Design – Place controls on the form, set properties and write code Run (F5 or Start) Break – Invoked automatically when run-time errors are encountered – By clicking the break button or Ctrl-Break 6/27/201510Dr. Monther Aldwairi

Debugging Status Indicators 6/27/201511Dr. Monther Aldwairi Indicator Name SymbolDescription BreakpointSuspends program execution Current Statement Represents the next line to be executed. You can drag the current statement indicator to another line to either skip or re-execute code

Debug Menu 6/27/2015Dr. Monther Aldwairi12

Breakpoints Select statement, or click anywhere within statement, and set breakpoint: 1.Select Toggle Breakpoint from the Debug menu, or 2.Click on the Toggle Breakpoint button within the Debug toolbar, or 3.Press function key F9. A dark red point to the left of a statement indicates the existence of a breakpoint. The break in the program occurs just before the selected statement is executed. 6/27/201513Dr. Monther Aldwairi

Breakpoints To remove breakpoint use one of the three possibilities listed earlier to set a breakpoint. – To remove all break points select Clear All Breakpoints from the Debug menu, or use Ctrl- Shift-F9 Temporary breakpoint: click within a statement, select Run to Cursor from the Debug menu, or use Ctrl-F8. 6/27/2015Dr. Monther Aldwairi14

Defining watch values Watch values are the current values of variables or expressions There are two types of watch values: 1.Ordinary watch values: remain active as you step through the program 2.Break watches: The cause a break when True or when the values changes 6/27/201515Dr. Monther Aldwairi

To define watch values 1.Select Add Watch, from the Debug menu, and enter information in the Add Watch dialog box. 2.Right-click on the Watches window, select Add Watch. 3.Highlight an expression in the Code Editor window, and select Add Watch, from the Debug menu. 4.Highlight an expression in the Code Editor window. Then, right-click and select Add Watch. 5.Shift+F9 for quick watches 6/27/201516Dr. Monther Aldwairi

Adding Watches 6/27/2015Dr. Monther Aldwairi17

Stepping through a program Three different types of stepping: 1.Step Into results in line-by-line stepping of current procedure and subordinated procedures. 2.Step Over results in line-by-line stepping of current procedure, bypassing subordinated procedures. 3.Step Out results in execution of all remaining statements within the current procedure, and then pauses at the first statement following the procedure access in the parent routine. Note procedures will be discussed later in CH4 6/27/201518Dr. Monther Aldwairi

Stepping through a program To carry out line-by-line stepping do one of the following: 1.Select Step Into (or Step Over, Step Out) from the Debug menu 2.Press F8 to Step Into, Shift+F8 to Step Over, Ctrl+Shift+F8 to Step Out 3.Click on the Step Into button (or Step Over or Step Out button) on the Debug toolbar 6/27/2015Dr. Monther Aldwairi19

Error Trapping We will teach you later in Chapter 8 how to trap and handle fatal errors 6/27/201520Dr. Monther Aldwairi

Common Error Types #Error Type# 6Overflow58File already exists 7Out of memory61Disk full 9Subscript out of range62Input past end of file 11Division by zero71Disk not ready 13Type mismatch380 Invalid property value 52Bad file name or number382'Item' property cannot be set at run time 52File not found423Property or method not found 55File already open450Wrong number of arguments 6/27/201521Dr. Monther Aldwairi

Compile Errors Examples 6/27/201522Dr. Monther Aldwairi

Run Time Errors 6/27/201523Dr. Monther Aldwairi