ENEE150 – 0102 ANDREW GOFFIN Testing and Debugging.

Slides:



Advertisements
Similar presentations
UNIT 12 UNIX I/O Redirection.
Advertisements

General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Get number The ginput command creates crosshairs. When the user clicks the x,y values of the crosshairs are returned.
1 Lab Session-2 CSIT 121 Spring 2005 Debugging Tips NiMo’s Varying Rates Lab-2 Exercise.
Guidelines for working with Microsoft Visual Studio.Net.
Guidelines for working with Microsoft Visual Studio 6.
DDD tutorial A GDB Graphical User Interface. DDD Introduction If you find GDB difficult to use, try DDD DDD s GDB but with a Graphical User Interface.
1 Gentle Introduction to Programming Tirgul 2: Scala “hands on” in the lab.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Debugger Presented by 李明璋 2012/05/08. The Definition of Bug –Part of the code which would result in an error, fault or malfunctioning of the program.
Homework Reading Programming Assignments
Memory & Storage Architecture Seoul National University GDB commands Hyeon-gyu School of Computer Science and Engineering.
Instructor Notes GPU debugging is still immature, but being improved daily. You should definitely check to see the latest options available before giving.
1 ENERGY 211 / CME 211 Lecture 13 October 20, 2008.
Compiling & Debugging Quick tutorial. What is gcc? Gcc is the GNU Project C compiler A command-line program Gcc takes C source files as input Outputs.
Computer Engineering 1 nd Semester Dr. Rabie A. Ramadan 2.
Creating your first C++ program
1 Debugging: Catching Bugs ( II ) Ying Wu Electrical Engineering & Computer Science Northwestern University EECS 230 Lectures.
ENEE150 – 0202 ANDREW GOFFIN Introduction to ENEE150.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
Structured Programming: Debugging and Practice by the end of this class you should be able to: debug a program using echo printing debug a program using.
CSE 232: C++ debugging in Visual Studio and emacs C++ Debugging (in Visual Studio and emacs) We’ve looked at programs from a text-based mode –Shell commands.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
CSE 332: C++ debugging Why Debug a Program? When your program crashes –Finding out where it crashed –Examining program memory at that point When a bug.
Debugging Xin Tong. GDB GNU Project debugger Allows you to see what is going on `inside' another program while it executes or crashed. (Faster than printing.
read and learn from example loop programs develop modular program
1 SEEM3460 Tutorial Compiling and Debugging C programs.
CSE 351 GDB Introduction. Lab 1 Status? How is Lab 1 going? I’ll be available at the end of class to answer questions There are office hours later today.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
Debugging. Outline Announcements: –HW II due Fridayl db.
C++ crash course Class 9 flight times program, using gdb.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
ENEE150 – 0102 ANDREW GOFFIN Functional Decomposition.
Debugging 1/6/2016. Debugging 1/6/2016 Debugging  Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a program.
HKOI Programming HKOI Training Team (Intermediate) Alan, Tam Siu Lung Unu, Tse Chi Yung.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Minimal standard C program int main(void) { return 0 ; }
Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did.
1 Steps to use Flex Ravi Chotrani New York University Reviewed By Prof. Mohamed Zahran.
5.01 Understand Different Types of Programming Errors
Assigning Values 1. $ set One Two Three [Enter] $echo $1 $2 $3 [Enter] 2. $set `date` [Enter] $echo $1 $2 $3 [Enter] 3. $echo $1 $2 $3 $4 $5 $6 [Enter]
ENEE150 – 0102 ANDREW GOFFIN More With Pointers. Importance of Pointers Dynamic Memory (relevant with malloc) Passing By Reference Pointer Arithmetic.
Outline Announcements: –HW I key online this afternoon –HW II due Friday –Sign up to discuss projects Debugging Testging for correctness.
Recitation 2: Abhijit Warkhedi2/25/20161 Today’s Agenda u CVS u GDB.
CMSC 104, Version 8/061L14AssignmentOps.ppt Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips Reading Section.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
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.
CSCI 4061 Recitation 2 1.
DEBUG.
Gnu Debugger (gdb) Debuggers are used to: Find semantic errors
ENEE150 Discussion 04 Section 0101 Adam Wang.
5.01 Understand Different Types of Programming Errors
Winter 2009 Tutorial #6 Arrays Part 2, Structures, Debugger
Debugging with Clion and GDB
CS1010 Programming Methodology
Computer Engineering 1nd Semester
Editor, Compiler, Linker, Debugger, Makefiles
Testing Key Revision Points.
COMP 2710 Software Construction Introduction to GDB
Debuggers.
Common C Programming Errors, GDB Debugging
Debugging at Scale.
GNU DEBUGGER TOOL. What is the GDB ? GNU Debugger It Works for several languages – including C/C++ [Assembly, Fortran,Go,Objective-C,Pascal]
Homework Reading Programming Assignments Finish K&R Chapter 1
Lecture 4 Redirecting standard I/O & Pipes
Debugging.
Presentation transcript:

ENEE150 – 0102 ANDREW GOFFIN Testing and Debugging

Testing Your Code With projects, we will provide public test vectors  These are simple text files that can be redirected through stdin  If your output matches the test’s output, you’ve passed the test! Can redirect input/output with the ‘>’ and ‘<‘ characters ./a.out test.out  This uses test.in as input and redirects the output to test.out Goffin – ENEE150

Testing Your Code Use ‘diff’ to see if your output and test output are the same  diff test.out correct_test.out > diff.txt  Redirects all differences between the outputs into a file called ‘diff.txt’  If diff.txt is empty, you’ve passed! Goffin – ENEE150

Debugging Your Code The debugger for C in Unix systems is GDB  Command line based  Typical GDB commands:  next (n) – go to next line in current function  step (s) – go to next line that runs (goes into subroutines)  run (r) – run the program  break - stop program at line/function  print (p) - prints the value of a variable  To run GDB on a program, compile the program with the ‘-g’ flag  gcc –g Goffin – ENEE150

Debugging Your Code Running GDB  gdb a.out will start the debugger Goffin – ENEE150

Debugging your Code GDB tips and tricks  Use the –tui flag to see the code as you step through  Always set a break point before running, otherwise it’ll just run the code as normal  Try to pinpoint where an error may be in your code and set the breakpoint at that line/function Goffin – ENEE150

Project 1 Questions? Some tips:  You’re reading the input as (x,y), however the chess array is indexed using the y coordinate (row) first!  Use the_board_color[y][x], not the_board_color[x][y]  Test modularly  Test each function individually… the public tests are made for this to be easy  Make sure your output matches that of the tests!!!  You WILL lose points if the outputs are different Goffin – ENEE150