210 likes | 305 Views
Debugging with Incomplete and Dynamically Generated Execution Trees. Josep Silva. Technical University of Valencia. Contents. Introduction Algorithmic Debugging A Debugging Session Scalability Problems of AD Memory, Graphical Memory, Time A New Architecture for AD
E N D
Debugging with Incomplete and Dynamically Generated Execution Trees Josep Silva Technical University of Valencia
Contents • Introduction • Algorithmic Debugging • A Debugging Session • Scalability Problems of AD • Memory,Graphical Memory, Time • A New Architecture for AD • Virtual Execution Trees • System Demo • DDJ • Conclusions and Future Work
Introduction • Algorithmic debugging[Shapiro 82]Logic Paradigm • TWO PHASES: • Generate an execution tree • Traverse the execution tree asking questions until the bug is found If the effect of a bug is detected then AD will find the bug main = 4 What is an Execution Tree ? listSum [1,2] = 4 Example: main = listSum [1,2] listSum [] = 0 listSum (x:xs) = x + (listSum xs) 1+3 = 4 listSum [2] = 3 2+1 = 3 listSum [] = 1
Introduction • Generating Execution Trees • By program transformation (Hat) • By using an extended interpreter (Toy) • Traversing Execution Trees • GOLDEN RULE:When a wrong equation has not wrong children, then this equation is buggy main = 3 listSum [1,2] = 3 Example: main = listSum [1,2] listSum [] = 0 listSum (x:xs) = x + (listSum xs) 1+2 = 3 listSum [2] = 2 2+0 = 2 listSum [] = 0
Algorithmic Debugging Strategies A Debugging Session main = sqrtest [1,2] sqrtest x = test (squares (listsum x)) test (x,y,z) = (x==y) && (y==z) listsum [] = 0 listsum (x:xs) = x + (listsum xs) squares x = ((square1 x),(square2 x),(square3 x)) square1 x = square x square x = x*x square2 x = listsum (list x x) list x y | y==0 = [] | otherwise = x:list x (y-1) square3 x = listsum (partialsums x) partialsums x = [(sum1 x),(sum2 x)] sum1 x = div (x * (incr x)) 2 sum2 x = div (x + (decr x)) 2 incr x = x + 1 decr x = x - 1
Algorithmic Debugging Strategies A Debugging Session with Top-Down Search main = False • Starting Debugging Session... • main = False? NO • sqrtest [1,2] = False? NO • test [9,9,8] = False? YES • squares 3 = [9,9,8]? NO • square1 3 = 9? YES • square2 3 = 9? YES • square3 3 = 8? NO • listsum [6,2] = 8? YES • partialsums 3 = [6,2]? NO • sum1 3 = 6? YES • sum2 3 = 2? NO • decr 3 = 2? YES • Bug found in rule: • sum2 x = div (x + (decr x)) 2 sqrTest [1,2] = False test (9,9,8) = False squares 3 = (9,9,8) listSum [1,2] = 3 listSum [2] = 2 squares1 3 = 9 squares2 3 = 9 squares3 3 = 8 listSum [] = 0 square 3 = 9 listSum [3,3,3] = 9 list 3 3 = [3,3,3] partialSums 3 = [6,2] listSum [6,2] = 8 listSum [3,3] = 6 list 3 2 = [3,3] listSum [2] = 2 sum1 3 = 6 sum2 3 = 2 decr 3 = 2 listSum [3] = 3 list 3 1 = [3] listSum [] = 0 incr 3 = 4 listSum [] = 0 list 3 0 = []
Contents • Introduction • Algorithmic Debugging • A Debugging Session • Scalability Problems of AD • Memory,Graphical Memory, Time • A New Architecture for AD • Virtual Execution Trees • System Demo • DDJ • Conclusions and Future Work
Scalability Problems Memory The size of the ET can be huge It does not usually fit in main memory Graphic memory The whole ET cannot be shown at the same time
Scalability Problems • Time • Generating the ET is costly • The problem is even worst with databases In some languages the problem is inherent to the current technology Java: The Java Platform Debugger Architecture JVM Source Code JPDA Execution Tree
Scalability Problems • Time • Generating the ET is costly • The problem is even worst with databases In some languages the problem is inherent to the current technology Java: The Java Platform Debugger Architecture
Contents • Introduction • Algorithmic Debugging • A Debugging Session • Scalability Problems of AD • Memory,Graphical Memory, Time • A New Architecture for AD • Virtual Execution Trees • System Demo • DDJ • Conclusions and Future Work
A New Architecture for AD Key ideas: Memory problem Store the ET in a database Graphic memory Use a clustering mechanism based on a system of cache memories Time Allow the debugger to debug with incomplete ETS -> Use a virtual ET (and reimplement the strategies for VETs) JPDA
A New Architecture for AD Interface communication - Communicates with the user - Controls what nodes are shown in the GUI Selecting questions - Selects the nodes of the VET to be asked - Implements the search strategies Construction of the VET - The only interface with JPDA - Wakes up thread 2 when the VET is too big. - It sleeps when the persistence bound is reached Storage of the VET - It controls what nodes are stored in the database - Removes half of the nodes, Sleeps and weaks up thread 1
A New Architecture for AD The system of caches: n n … m m m … … Persistence cache Logic cache Presentation cache
A New Architecture for AD Redefining search strategies: … … … Top-Down It cannot even start because the root node is the last node completed Heaviest First The heaviest node could not be completed Divide & Query The half node could not be completed
A New Architecture for AD Redefining search strategies: … … … … Top-Down It cannot even start because the root node is the last node completed Heaviest First The heaviest node could not be completed Divide & Query The half node could not be completed
A New Architecture for AD Redefining search strategies: … … … … Top-Down It only asks for the descendants of a node that are completed and that do not have a completed ancestor Heaviest First It would ask first for the completed descendant that in turn contains more completed descendants Divide & Query It would ask for the completed node that divides the VET in two subtrees with the same number of nodes … …
Contents • Introduction • Algorithmic Debugging • A Debugging Session • Scalability Problems of AD • Memory,Graphical Memory, Time • A New Architecture for AD • Virtual Execution Trees • System Demo • DDJ • Conclusions and Future Work
Contents • Introduction • Algorithmic Debugging • A Debugging Session • Scalability Problems of AD • Memory,Graphical Memory, Time • A New Architecture for AD • Virtual Execution Trees • System Demo • DDJ • Conclusions and Future Work
Conclusions and future work • New architecture for algorithmic debuggers • Use a database (solving main memory scalability) • Use cache memories (solving graphical memory scalability, speeding up AD) • Work with VETs (solving time scalability)
Conclusions and future work • New architecture for algorithmic debuggers • Use a database (solving main memory scalability) • Use cache memories (solving graphical memory scalability, speeding up AD) • Work with VETs (solving time scalability) • Future work • Adapt the debugger to Eclipse as a plugin • Change the front-end for other languages • Experiment with concurrent languages: • - Erlang