cjadviser: smt-based debugging support for contextj* shizuka uchio(kyushu university, japan) naoyasu...
Embed Size (px)
TRANSCRIPT

CJAdviser: SMT-based Debugging Support for ContextJ*
Shizuka Uchio (Kyushu University, Japan)Naoyasu Ubayashi (Kyushu University, Japan)Yasutaka Kamei (Kyushu University, Japan)
July 25, 2011
COP 2011

Overview-- Trace analysis with SMT-solver
2
SMT
SMT: Satisfiability Modulo Theories
Context Dependence Graph
Unit Test
We can check a variety ofobject-context
dependencies such as“Do two objects A and
B exist in the Context X
at the same time ? ” A
BX

3
Outline
Motivation --Debugging issues in COP
CJAdviser: Trace analysis with SMT solver
Related work
Conclusion and Future work

4
Motivation

5
Motivation
Context-awareness plays an important role in developing adaptive software.
COP can treat context as a module and enables programmers to describe the context-aware behavior elegantly.
However, it becomes difficult to debug the programs due to the complexity of COP execution and the dependence between objects and contexts.

6
Example: ContextJ* Code
Employer ubayashi = new Employer("Ubayashi", "Motooka");Person uchio = new Person("UchioShizuka", "Arae1", ubayashi);
with(Layers.Address).eval( new Block() { public void eval() { System.out.println(uchio); }}); with(Layers.Address, Layers.Employment).eval( newBlock() { public void eval() { System.out.println(uchio); }});
public class Person implements IPerson {layers.define(Layers.Address,new IPerson() { public String toString() { return layers.next(this) + "; Address: " + address;}}); layers.define(Layers.Employment,new IPerson() { public String toString() { return layers.next(this) + "; [Employer] " + employer;}});
public class Employer implements IEmployer {layers.define(Layers.Address,new IEmployer() { public String toString() { return layers.next(this) + "; Address: " + address;}});
Employer Person
Employment Layer
Address Layer
Name: UchioShizuka; Address: Arae1
Name: UchioShizuka; Address: Arae1;[Employer] Name: Ubayashi; Address: Motooka

7
Execution Trace
Q2: When uchio enters Address and Employment layers, the layered method toString (Address layer) is invoked after the layered method toString (Employment layer) is invoked.
•Where is this order specified ?•Is the order defined by layers.define ?
Q1: Address layer and Employment layer are instantiated just after Employer object is instantiated.
Why ?

8
More concerns …
Is there a possibility of simultaneously activating two layers A and B ?
Is the layer A activated sometime ?
Do two objects X and Y exist in the layer A at the same time ?

9
CJAdviser:Trace analysis with SMT solver

Our approach
10
SMT
SMT: Satisfiability Modulo Theories
Context Dependence Graph
Unit Test

11
SMT (Satisfiability Modulo Theories)
SMT generalizes SAT (Boolean satisfiability) by adding equality reasoning, arithmetic, and other first-order theories.
Yices is an SMT solver that decides the satisfiability of formulas containing uninterpreted function symbols with equality, linear real and integer arithmetic, scalar types recursive
datatypes, tuples, records, extensional arrays, fixed-size bit-vectors,
quantifiers lambda expressions

12
CJLogger
CXDG: Context dependence graph
ContextJ*execution (period)
Context
Context
Object
Object
Logging

13
Yices encoding -- CXDG
: ; Type definitions(define-type obj (scalar Employer Person))(define-type layer (scalar Address Employment))(define-type with-period (subrange 1 2))(define-type log-count (subrange 0 4))(define-type obj-with-layer (tuple with-period obj layer))(define-type logging (-> int obj-with-layer))(define log::logging)
: ; Log data (CXDG: Context dependence graph)(define test-run::logging (update (update (update (update (update (update log (0) (mk-tuple 1 Person Address)) (1) (mk-tuple 1 Employer Address)) (2) (mk-tuple 2 Person Address)) (3) (mk-tuple 2 Employer Address)) (4) (mk-tuple 2 Person Employment))))
Array
Syntax is similar to Scheme

CJQuery
14
(period)
Context
Context
Object
Object
Query
SAT or UNSAT
Yices
Debug Concern
s

15
Case 1:Do a person and an employer exist in the Address layer at the same time ?
(define i::log-count)(define j::log-count)(define t::with-period)
(assert (and (/= i j) (= (test-run i) (mk-tuple t Person Address)) (= (test-run j) (mk-tuple t Employer Address))))
(check)
SAT i = 2, j = 3, and t = 2

16
Case 2:Do a person and an employer exist in the same layer at the same time ?
(define i::log-count)(define j::log-count)(define t::with-period)(define l::layer)
(assert (and (/= i j) (= (test-run i) (mk-tuple t Person l)) (= (test-run j) (mk-tuple t Employer l))))(check)
SAT i = 2, j = 3, t = 2, andl=Address.

Case 3:Does a person exist in the Employment layer sometime?
17
(define i::log-count)(define t::with-period)
(assert (= (test-run i) (mk-tuple t Person Employment)))(check)
SAT i = 4 and t = 2

Related work
18

19
Related work
Whyline [Ko, A. J. et al. ICSE2008] allows programmers to ask “Why did” and “Why
didn‘t” questions about the bugs. provides answers of the bug causes.
DebugAdvisor [Ashok, B. et al. FSE2009] allows programmers to express the context of the bugs
and search through diverse data such as natural language text and core dumps.

20
Conclusion and Future work

21
Conclusion and Future work
We proposed CJAdviser, SMT-based Debugging Support for ContextJ*.
Future work Support for Jcop User Interface (cf. Whyline) Scalability Real case Studies

22
Thank you for your attention.