BugHint: A Visual Debugger Based on Graph Mining

Slides:



Advertisements
Similar presentations
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Advertisements

CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
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.
Projects March 29, Project Requirements Think Aloud –At least two people OR Difficulty Factors Assessment –Ideally >25 (at least one class), but.
Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
1 Lecture 14 Chapter 6 Looping Dale/Weems/Headington.
Computer Science 1620 Programming & Problem Solving.
Testing an individual module
Programming Fundamentals (750113) Ch1. Problem Solving
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
Chapter 9 Structuring System Requirements: Logic Modeling
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Introduction 01_intro.ppt
Language Evaluation Criteria
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Programming Languages
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Lifecycle
By Ian Jackman Davit Stepanyan.  User executed untested code.  The order in which statements were meant to be executed are different than the order.
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.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Controlling Execution Programming Right from the Start with Visual Basic.NET 1/e 8.
1 09/20/04CS150 Introduction to Computer Science 1 Let ’ s all Repeat Together.
Chapter 8 Repetition Statements. Introduction Iteration - process of looping or the repetition of one or more statements Loop body - the statement, or.
Java Basics Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
The Hashemite University Computer Engineering Department
Today's Ninja Challenge: Write Your First Computer Game!
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
White-Box Testing Statement coverage Branch coverage Path coverage
Software Engineering Algorithms, Compilers, & Lifecycle.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
Lab 4: Loops and Iteration Graham Northup
Development Environment
MASS Java Documentation, Verification, and Testing
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Testing and Debugging.
Testing UW CSE 160 Winter 2017.
Testing UW CSE 160 Spring 2018.
TRANSLATORS AND IDEs Key Revision Points.
Software testing strategies 2
Testing UW CSE 160 Winter 2016.
PROGRAMMING Program Development.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
Problem Solving Designing Algorithms.
Programming Fundamentals (750113) Ch1. Problem Solving
IDE’s and Debugging.
Tonga Institute of Higher Education IT 141: Information Systems
Programming Fundamentals (750113) Ch1. Problem Solving
Tonga Institute of Higher Education IT 141: Information Systems
For Tutors Introduce yourself.
Running a Java Program using Blue Jay.
Chapter 15 Debugging.
CHAPTER 6 Testing and Debugging.
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Chapter 15 Debugging.
Presentation transcript:

BugHint: A Visual Debugger Based on Graph Mining Jennifer Leopold, Nathan Eloe, and Patrick Taylor

Outline Background and related work - Debugging with beginning programmers - Visualization in debugging BugHint - Algorithm - Graphic user interface Experiments - Human test study and analysis of results Future work Questions and comments

Debugging with Beginning Programmers Syntax, editor, compiler, operating system commands, … Overwhelming!!! Last thing students want to learn is a sophisticated debugger like GDB

Debugging with Beginning Programmers However, some intro programming classes have successfully incorporated debuggers into the teaching of various constructs Ex: Easier to see what is going on in a loop

Visualization in Debugging Visualization facilitates understanding of code and data structures Java debugger jBixbe

Our Motivation Create an easy-to-use debugging tool that would give a beginning programmer a hint about where the bug might be in his/her program

BugHint: The Algorithm Input: A program (in C or C++) At least 1 test case that produces correct results At least 1 test case that produces incorrect results Output: The line(s) in the code that are likely causing the bug

BugHint: The Algorithm How the analysis is done: (1) Construct a control flow graph (CFG) of the input program node = basic block of code edge = flow from one block to another Simple example: if (x != y) // line 1 { x = y; // line 2 y = x; // line 3 } cout << x << y; // line 4 B1 B2 B4 B1 = line 1 B2 = lines 2, 3 B4 = line 4

BugHint: The Algorithm How the analysis is done: (2) Construct a CFG for each input test case Case No. x y result 1 5 x = 5, y = 5 correct 2 4 incorrect 3 x = 4, y = 4 Case 1 Case 2 Case 3 B1 B4 B1 B2 B4 B1 B2 B4 B1 = line 1 B2 = lines 2, 3 B4 = line 4

BugHint: The Algorithm How the analysis is done: (3) Remove non-discriminant edges (and nodes) Case No. x y result 1 5 x = 5, y = 5 correct 2 4 incorrect 3 x = 4, y = 4 Case 1 Case 2 Case 3 B1 B4 B1 B2 B4 B1 B2 B4 B1 = line 1 B2 = lines 2, 3 B4 = line 4

BugHint: The Algorithm How the analysis is done: (4) Find the largest connected subgraph that exists in the (majority of) the incorrect graphs and doesn’t exist in the (majority of) the correct graphs Case No. x y result 1 5 x = 5, y = 5 correct 2 4 incorrect 3 x = 4, y = 4 Case 1 Case 2 Case 3 B1 = line 1 B2 = lines 2, 3 B4 = line 4 empty B2 B2

BugHint: The Algorithm How the analysis is done: This corresponds to the block of code where the bug likely occurs In this example, the swap is not being done correctly Simple example: if (x != y) // line 1 { x = y; // line 2 y = x; // line 3 } cout << x << y; // line 4 B1 B2 B4 B1 = line 1 B2 = lines 2, 3 B4 = line 4

BugHint: The Algorithm Some cases are more difficult to analyze! Example: if (x <= y) // line 1 min = y; // line 2 else min = y; // line 3 cout << min; // line 4 B1 B2 B3 B4 B1 = line 1 B2 = line 2 B3 = line 3 B4 = line 4 Case 1 Case 2 Case 3 Case No. x y result 1 5 min = 5 correct 2 4 min = 4 3 incorrect B1 B2 B4 B1 B3 B4 B1 B2 B4

BugHint: The Algorithm Some cases are more difficult to analyze! Example: if (x <= y) // line 1 min = y; // line 2 else min = y; // line 3 cout << min; // line 4 B1 B2 B3 B4 B1 = line 1 B2 = line 2 B3 = line 3 B4 = line 4 Case 1 Case 2 Case 3 Case No. x y result 1 5 min = 5 correct 2 4 min = 4 3 incorrect B1 B2 B4 B1 B3 B4 B1 B2 B4

BugHint: The Algorithm Relax the rule that the subgraph in the incorrect case(s) does not occur in all correct case(s) Example: if (x <= y) // line 1 min = y; // line 2 else min = y; // line 3 cout << min; // line 4 Conclude that the bug is in B2, which is line 2 (should be min = x;) Case 1 Case 2 Case 3 Case No. x y result 1 5 min = 5 correct 2 4 min = 4 3 incorrect B2 B3 B2 B1 = line 1 B2 = line 2 B3 = line 3 B4 = line 4

BugHint: The Algorithm How the analysis is done: Sometimes it will be the opposite situation (i.e., it will be code that is executed in the correct cases that is not executed in the incorrect cases) Sometimes no hint can be given because the control path will be the same for any inputs Ex: int sum = 5, total = 10; float avg; avg = sum / total; // gives 0, not 0.5

BugHint: The GUI Clicking on a block in a trace will highlight node and lines in code Lines that are the bug hint Can step through a selected test case execution Trace for a selected test case Specify test cases Input values for selected test case Bug hint

Experiments Wanted to test the hypothesis that BugHint would improve debugging skill 163 students who had just completed CS1 Treatment group: intro to BugHint, pre-training exercises with it Control group: tips on manual debugging, pre-training exercises using those tips Both groups then given programs with a bug and asked to fix it; treatment group given a bug hint

Experiments Wanted to test the hypothesis that BugHint would improve debugging skill Treatment group: Better able to come up with additional test cases Better able to add comments to the code they were debugging Said it was easier to find and fix the bug Didn’t take significantly less time to find and fix the bug than the control group

Future Work Add ability to debug user-defined functions Prioritize subgraphs that contain statements with multiple operators and/or particular operators (e.g., && and ||) More usability and usefulness studies, including scalability

Questions? Comments? Ideas?