What Went Wrong? Alex Groce Carnegie Mellon University Willem Visser NASA Ames Research Center.

Slides:



Advertisements
Similar presentations
CS Data Structures I Chapter 6 Stacks I 2 Topics ADT Stack Stack Operations Using ADT Stack Line editor Bracket checking Special-Palindromes Implementation.
Advertisements

Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Delta Debugging and Model Checkers for fault localization
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION DEBUGGING Autumn 2011 Bug-Date: Sept 9, 1947.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
Model Checker In-The-Loop Flavio Lerda, Edmund M. Clarke Computer Science Department Jim Kapinski, Bruce H. Krogh Electrical & Computer Engineering MURI.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Carnegie Mellon University Java PathFinder and Model Checking of Programs Guillaume Brat, Dimitra Giannakopoulou, Klaus Havelund, Mike Lowry, Phil Oh,
Stacks, Queues, and Deques. 2 A stack is a last in, first out (LIFO) data structure Items are removed from a stack in the reverse order from the way they.
CS 267: Automated Verification Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking.
Software Model Checking for Embedded Systems PIs: Matthew Dwyer 1, John Hatcliff 1, and George Avrunin 2 Post-docs: Steven Seigel 2, Radu Iosif 1 Students:
Introduction to Computability Theory
© 2006 Pearson Addison-Wesley. All rights reserved7A-1 Chapter 7 Stacks.
Part-B1 Stacks. Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations.
Part-B1 Stacks. Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Stacks, Queues, and Deques
Array.
Stack and Queue.
Review 1 Introduction Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example.
Chapter 7 Stacks. © 2004 Pearson Addison-Wesley. All rights reserved 7-2 The Abstract Data Type: Developing an ADT During the Design of a Solution Specifications.
Chapter 12 Recursion, Complexity, and Searching and Sorting
Data Structures and Algorithms Stacks. Stacks are a special form of collection with LIFO semantics Two methods int push( Stack s, void *item ); - add.
CSC 212 Stacks & Queues. Announcement Many programs not compiled before submission  Several could not be compiled  Several others not tested with javadoc.
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.
The Daikon system for dynamic detection of likely invariants MIT Computer Science and Artificial Intelligence Lab. 16 January 2007 Presented by Chervet.
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.
Problem of the Day  Why are manhole covers round?
30 May Stacks (5.1) CSE 2011 Winter Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An.
Data structures Abstract data types Java classes for Data structures and ADTs.
1 Stacks and Queues Based on D.S. Malik, Java Programming: Program Design Including Data Structures.
Finding Feasible Counter-examples when Model Checking Abstracted Java Programs Corina S. Pasareanu, Matthew B. Dwyer (Kansas State University) and Willem.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
CIS 842: Specification and Verification of Reactive Systems Lecture 1: Course Overview Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The.
Model Checking Java Programs using Structural Heuristics
Stacks and Queues Based on D.S. Malik, Java Programming: Program Design Including Data Structures.
Symbolic Execution with Abstract Subsumption Checking Saswat Anand College of Computing, Georgia Institute of Technology Corina Păsăreanu QSS, NASA Ames.
Data Structures & Algorithms
Linked List by Chapter 5 Linked List by
1 Model Checking of Robotic Control Systems Presenting: Sebastian Scherer Authors: Sebastian Scherer, Flavio Lerda, and Edmund M. Clarke.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Question of the Day  How can you change the position of 1 toothpick and leave the giraffe in exactly the same form, but possibly mirror-imaged or oriented.
CHP-3 STACKS.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
Winter 2006CISC121 - Prof. McLeod1 Stuff No stuff today!
Automated Debugging with Error Invariants TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA A A A AA A A Chanseok Oh.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
Error Explanation with Distance Metrics Authors: Alex Groce, Sagar Chaki, Daniel Kroening, and Ofer Strichman International Journal on Software Tools for.
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
Verifying Component Substitutability Nishant Sinha Sagar Chaki Edmund Clarke Natasha Sharygina Carnegie Mellon University.
Review on Program Challenge CSc3210 Yuan Long.
M180: Data Structures & Algorithms in Java Stacks Arab Open University 1.
Stack. ADS2 Lecture 1010 The Stack ADT (GoTa §5.1) The Stack ADT stores arbitrary objects Insertions and deletions follow the last-in.
© 2006 Carnegie Mellon University Introduction to CBMC: Part 1 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel,
24 September 2002© Willem Visser Program Model Checking Enabling Technology Abstraction void add(Object o) { buffer[head] = o; head = (head+1)%size;
1 Stacks Abstract Data Types (ADTs) Stacks Application to the analysis of a time series Java implementation of a stack Interfaces and exceptions.
Localizing Errors in Counterexample Traces
Data Structures and Algorithms
Stacks.
CS212: Object Oriented Analysis and Design
Stacks.
Lesson Objectives Aims
Over-Approximating Boolean Programs with Unbounded Thread Creation
Data Structures and Algorithms
Introduction to Data Structure
Symbolic Execution and Test-input Generation
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Presentation transcript:

What Went Wrong? Alex Groce Carnegie Mellon University Willem Visser NASA Ames Research Center

Java PathFinder void add(Object o) { buffer[head] = o; head = (head+1)%size; } Object take() { … tail=(tail+1)%size; return buffer[tail]; } Java Code JAVACJVM 0: iconst_0 1: istore_2 2: goto#39 5: getstatic 8: aload_0 9: iload_2 10: aaload Bytecode Special JVM Model Checker

Counterexamples When the model checker finds a bug, it reports a counterexample. However, even an exact trace of the program failing is not what we really want for most bugs.

Counterexamples How can we get more information from a counterexample? –Perhaps if we had some successful runs to compare to, or other failing runs in which to look for common elements… A common way of debugging by hand Except we can automate it using the model checker

Counterexamples The Error

Counterexamples “The Error” Real cause

Counterexamples “The Error” Real cause Idea: generate other traces that can give you more information about what is going wrong. How?

Positives and Negatives Real cause assert (x < 5); (and x = 8) “The Error”

Positives and Negatives “The Error” Real cause Same location, same error: NEGATIVE (-) Real cause assert (x < 5); (and x = 10) An Error assert (x < 5); (and x = 8)

Positives and Negatives Real cause Same control flow location, no error condition: POSITIVE (+) Same location, same error: NEGATIVE (-) Real cause assert (x < 5); (and x = 3) assert (x < 5); (and x = 10) “The Error”An Error assert (x < 5); (and x = 8) No Error

The Basic Search “The Error” Real cause

The Basic Search Real cause

The Basic Search Real cause

The Basic Search Real cause

The Basic Search Real cause

The Basic Search Real cause

The Basic Search Real cause

The Basic Search

The Search in Detail “The Error” Real cause Depth limit PositivesNegatives

The Search “The Error” Real cause Depth limit Already visited PositivesNegatives

The Search “The Error” Real cause Depth limit PositivesNegatives

The Search “The Error” Real cause Depth limit PositivesNegatives “push-through”

The Search “The Error” Real cause Depth limit Already visited PositivesNegatives

After the Search “The Error” Real cause Positives that are prefixes of some negative are removed While negatives are a true subset of complete negatives, positives are an approximation based on observed behavior This can be useful: in some reactive systems, every trace can be extended into an error trace

Analysis of the Traces Now what do we do with these? Report on code that appears – only in positives/negatives – in all positives/negatives – only and all positives/negatives (causal) Transform positives into negatives Find difference in invariants across positives and negatives PositivesNegatives

Analysis by Code Lines For our example trace, the line(s) in the real cause will be: –in all negative traces and –only appear in negative traces –thus will be identified as genuine cause Includes which thread executed the code and any nondeterministic choices made Can custom define equivalences to allow for looser definition of “the same code” “The Error” Real cause Automatically identified

Common Ground “The Error” Real cause (Can set a minimum shared prefix or suffix size) Shared prefix Shared suffix (control flow only) Transformation “How to make it break”

Transformation Analysis Sorted so that minimal way to break (transformation from each positive to nearest negative) is identified Rerun code line analysis over transformation code only (very useful in some cases) Can identify type of error: –If any positive can be transformed into a negative by only altering thread scheduling, the error is essentially concurrency based

Invariant Differences Pick certain control locations at which to observe data values in our traces Run a dynamic invariant detection algorithm to compute invariants across these locations for all negatives and then all positives Compare the discovered invariants

A Stack Example public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; }

A Stack Example public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; } A simple stack with an interface that initializes the stack to a random maximum size then randomly pushes and pops data.

A Stack Example public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; } A simple stack with an interface that initializes the stack to a random maximum size then randomly pushes and pops data. ORIGINAL COUNTEREXAMPLE: Stack overflow for stack size 1 (array out of bounds on stack)

A Stack Example public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; } A simple stack with an interface that initializes the stack to a random maximum size then randomly pushes and pops data. ORIGINAL COUNTEREXAMPLE: Stack overflow for stack size 1 (array out of bounds on stack) Run analysis with a search depth of 50 and compute invariants.

A Stack Example Code line analysis Code in the push method appears in all negatives. public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; }

A Stack Example Invariant analysis For positives, on entry to the push method, this invariant holds: stack.length > top For negatives, however the invariant is: stack.length >= top public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; }

A Stack Example Transformations from positive to negative Change stack size from 3 to 1 … Change stack size from 4 to 2 Insert a push … Remove a pop … public IntStack (int s) { stack = new int[s]; top = 0; } public void push (int i) { stack[top++] = i; } public int pop () { top--; return stack[top]; }

DEOS Error Analysis DEOS –Real time operating system –Allows threads to be created and deleted –Has time budgets for various threads

DEOS Error Analysis DEOS –Real time operating system –Allows threads to be created and deleted –Has time budgets for various threads Original counterexample –Assertion about the time budget of a thread fails

DEOS Error Analysis DEOS –Real time operating system –Allows threads to be created and deleted –Has time budgets for various threads Original counterexample –Assertion about the time budget of a thread fails Run analysis with size limit of 10

DEOS Error Analysis Transformations Change a wait until next period into a thread deletion Insert an interrupt and system clock ticks (before a deletion already in the positive) Change a wait until next period into an interrupt and system clock ticks and afterwards a deletion … The DEOS error requires deletion (which appears in the set of code found in all negatives) but also relies upon specific timing, as indicated by the transformations.

Related Work “Fate and Free Will in Error Traces” (TACAS 02) SLAM group independently investigated very similar concepts this summer (submitted to POPL) –Approach quite similar in spirit, lacks invariants and transformation approaches, but has some niceties with respect to source code analysis Andreas Zeller: work on isolating error-causing thread schedules and cause-effect chains

Future Work More efficient algorithms for generation of the traces (try bounded model checking) Different approaches to analysis: –Generation of automata –Characterization of error classes –Checking of causality…