Automatic Extraction of Object-Oriented Component Interfaces John Whaley Michael C. Martin Monica S. Lam Computer Systems Laboratory Stanford University.

Slides:



Advertisements
Similar presentations
pa 1 Porting BETA to ROTOR ROTOR Projects Presentation Day, June by Peter Andersen.
Advertisements

Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
1 of 24 Automatic Extraction of Object-Oriented Observer Abstractions from Unit-Test Executions Dept. of Computer Science & Engineering University of Washington,
Generic programming in Java
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
Software Quality Assurance Inspection by Ross Simmerman Software developers follow a method of software quality assurance and try to eliminate bugs prior.
5 th Biennial Ptolemy Miniconference Berkeley, CA, May 9, 2003 Java Code Generation Steve Neuendorffer UC Berkeley.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Aliases in a bug finding tool Benjamin Chelf Seth Hallem June 5 th, 2002.
272: Software Engineering Fall 2008 Instructor: Tevfik Bultan Lecture 15: Interface Extraction.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Automatically Extracting and Verifying Design Patterns in Java Code James Norris Ruchika Agrawal Computer Science Department Stanford University {jcn,
Synthesis of Interface Specifications for Java Classes Rajeev Alur University of Pennsylvania Joint work with P. Cerny, G. Gupta, P. Madhusudan, W. Nam,
Michael Ernst, page 1 Improving Test Suites via Operational Abstraction Michael Ernst MIT Lab for Computer Science Joint.
Applying Dynamic Analysis to Test Corner Cases First Penka Vassileva Markova Madanlal Musuvathi.
1 Further OO Concepts II – Java Program at run-time Overview l Steps in Executing a Java Program. l Loading l Linking l Initialization l Creation of Objects.
Program Analysis Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
1 Tracking Down Bugs Benny Vaksendiser. 2 Overview Motivation Isolating Cause-Effect Chains from Computer Programs Visualization of Test Information to.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 16: Automated Interface Extraction.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Impact Analysis of Database Schema Changes Andy Maule, Wolfgang Emmerich and David S. Rosenblum London Software Systems Dept. of Computer Science, University.
Software Faults and Fault Injection Models --Raviteja Varanasi.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
1 Test Selection for Result Inspection via Mining Predicate Rules Wujie Zheng
Glenn Ammons Ras Bodík Jim Larus Univ. of Wisconsin Univ. of Wisconsin Microsoft Research Mining Specifications (lots of) code  specifications.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
University of Maryland Using Dyninst to Measure Floating-point Error Mike Lam, Jeff Hollingsworth and Pete Stewart.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
JAVA Ekapap Julnonyang When it was implemented? Developed by Sun Microsystems. The first public implementation was Java 1.0 in 1995 The language.
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
ITP 109 Week 2 Trina Gregory Introduction to Java.
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
Ganga/Dirac Data Management meeting October 2003 Gennady Kuznetsov Production Manager Tools and Ganga (New Architecture)
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Introduction to Programming 1 1 2Introduction to Java.
Software, IEE Proceedings, Vol.152, Num.3, June 2005,Page(s): Prasanthi.S March, Java-based component framework for dynamic reconfiguration.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Jeremy Nimmer, page 1 Automatic Generation of Program Specifications Jeremy Nimmer MIT Lab for Computer Science Joint work with.
Applications Active Web Documents Active Web Documents.
Before You Begin Nahla Abuel-ola /WIT.
Compositional Pointer and Escape Analysis for Java Programs
Testing and Debugging.
Introduction Enosis Learning.
Introduction Enosis Learning.
High Coverage Detection of Input-Related Security Faults
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
Introduction Previous work Test Suite Minimization
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Presentation transcript:

Automatic Extraction of Object-Oriented Component Interfaces John Whaley Michael C. Martin Monica S. Lam Computer Systems Laboratory Stanford University July 24, 2002

July 24, 2002ISSTA 2002Slide 2 Motivation  Component programming is widespread.  Interface specifications are important! Misunderstanding the API is a common source of error Misunderstanding the API is a common source of error  Ideally, we want formal specifications. However, many components don’t have any specifications, formal or informal! However, many components don’t have any specifications, formal or informal!  Our goal: automatic generation of interface specifications For large, object-oriented programs For large, object-oriented programs Partial specifications Partial specifications

July 24, 2002ISSTA 2002Slide 3 Why Automatic Extraction?  Documentation Based on the actual code, so no divergence Based on the actual code, so no divergence  Rules for static or dynamic checkers Find errors in API usage Find errors in API usage  Find API bugs Discrepancy between code & intended API Discrepancy between code & intended API  Dynamic extraction: Evaluation of test coverage Evaluation of test coverage

July 24, 2002ISSTA 2002Slide 4 Overview  Component Model Product of Finite State Machines Product of Finite State Machines  Static Analysis  Dynamic Analysis and Checker  Implemented for Java  Analyzed >1 million lines of code Java class libraries Java class libraries Java 2 Enterprise Edition Java 2 Enterprise Edition Java network libraries Java network libraries joeq virtual machine joeq virtual machine

July 24, 2002ISSTA 2002Slide 5 Example: File  Use a Finite State Machine (FSM) to express ordering constraints. openS TART read write close E ND

July 24, 2002ISSTA 2002Slide 6 A Simple OO Component Model  Each object follows an FSM model.  One state per method, plus S TART & E ND states.  Method call causes a transition to a new state. open S TART read write close E ND m1 ; m2 is legal, new state is m2 m1m2

July 24, 2002ISSTA 2002Slide 7 Problem 1  An object has two fields, a and b.  Each field must be set before being read.  Solution: a product of FSMs, one for each field. set_a get_a set_b get_b S TART set_aget_aset_bget_bE ND S TART set_a get_b

July 24, 2002ISSTA 2002Slide 8 Splitting by fields set_a get_a set_b get_b Separate by fields into different, independent submodels. S TART set_aget_aset_bget_bE ND S TART set_bget_bE ND S TART set_a get_a E ND

July 24, 2002ISSTA 2002Slide 9 Problem 2  getFileDescriptor is state-preserving.  Solution: distinguish between state-modifying and state-preserving. start S TART create E ND connect close getFileDescriptor S TART getFileDescriptorconnect Model for Socket

July 24, 2002ISSTA 2002Slide 10 State-preserving methods start S TART create E ND connect close S TART getFileDescriptor m1 is state-modifying m2 is state-preserving m1 ; m2 is legal, new state is m1 m1m2

July 24, 2002ISSTA 2002Slide 11 Summary of Model  Product of FSMs Per-thread, per-instance Per-thread, per-instance  One submodel per field Interprocedural mod-ref analysis Interprocedural mod-ref analysis Identifies methods belonging to submodelIdentifies methods belonging to submodel Separates state-modifying and state-preserving methods.Separates state-modifying and state-preserving methods.  One submodel per Java interface Implementation not required. Implementation not required.

July 24, 2002ISSTA 2002Slide 12 Extraction Techniques StaticDynamic For all possible program executions For one particular program execution Conservative Exact (for that execution) Analyze implementation Analyze component usage Detect illegal transitions Detect legal transitions Superset of ideal model (upper bound) Subset of ideal model (lower bound)

July 24, 2002ISSTA 2002Slide 13 Static Model Extractor  Defensive programming Implementation throws exceptions (user or system defined) on illegal input. Implementation throws exceptions (user or system defined) on illegal input. public void connect() { connection = new Socket(); } public void read() { if (connection == null) throw new IOException(); } S TART connectread connection

July 24, 2002ISSTA 2002Slide 14 Detecting Illegal Transitions  Only support simple predicates Comparisons with constants, implicit null pointer checks Comparisons with constants, implicit null pointer checks  Find pairs such that: Source must execute: Source must execute: field = const ;field = const ; Target must execute: Target must execute: if (field == const) throw exception;if (field == const) throw exception;

July 24, 2002ISSTA 2002Slide 15 Algorithm  Source method: Constant propagation Constant at exit node Constant at exit node  Target method: Control dependence Throw of exception is control dependent on predicate Throw of exception is control dependent on predicate

July 24, 2002ISSTA 2002Slide 16 Dynamic Extractor  Goal: find the legal transitions that occur during an execution of the program  Java bytecode instrumentation  For each thread, each instance of a class: Track last state-modifying method for each submodel. Track last state-modifying method for each submodel.  Same mechanism for dynamic checking Instead of adding to model, flag exception. Instead of adding to model, flag exception.

July 24, 2002ISSTA 2002Slide 17 Experiences  We applied our tool to several real-life applications. ProgramDescription Lines of code Java.net Networking library 12,000 Java libraries General purpose library 300,000 J2EE Business platform 900,000 joeq Java virtual machine 65,000

July 24, 2002ISSTA 2002Slide 18 Automatic documentation  java.util.AbstractList.ListItr slice on lastRet field (static) next, previous S TART set remove add

July 24, 2002ISSTA 2002Slide 19 start S TART begin E ND suspend resume rollbackcommit Automatic documentation J2EE TransactionManager (dynamic)

July 24, 2002ISSTA 2002Slide 20 Test coverage increaseRecursionDepth decreaseRecursionDepth increaseRecursionDepth simpleWriteObject S TART E ND J2EE IIOPOutputStream (dynamic) No self-edges implies a max recursion depth of 1

July 24, 2002ISSTA 2002Slide 21 Upper/lower bound of model start S TART create E ND connect available getInputStream getOutputStream close SocketImpl model (dynamic) (+static) getFileDescriptor

July 24, 2002ISSTA 2002Slide 22 Finding API bugs  Applied our tool to the joeq virtual machine S TART load prepare compile Expected API for jq_Method: S TART load prepare compile Actual API for jq_Method: setOffset

July 24, 2002ISSTA 2002Slide 23 Related Work  Dynamic Daikon (Ernst99) Daikon (Ernst99) DIDUCE (Hangal02) DIDUCE (Hangal02) K-limited FSM extraction (Reiss01) K-limited FSM extraction (Reiss01) Machine-learning (Ammons02) Machine-learning (Ammons02)  Static Metal (Engler00) Metal (Engler00) Vault (DeLine01), NIL, Hermes (Strom86) Vault (DeLine01), NIL, Hermes (Strom86) SLAM toolkit (Ball01) SLAM toolkit (Ball01) ESC (Detlefs98) ESC (Detlefs98)  ESC + Daikon (Flanagan01, Nimmer02)

July 24, 2002ISSTA 2002Slide 24 Conclusion  Product of FSM Model is simple, but useful Model is simple, but useful  Upper/lower bound: static/dynamic  Useful for: Documentation generation Documentation generation Test coverage Test coverage Rules for automatic checkers Rules for automatic checkers Finding API bugs Finding API bugs