DrDebug: Deterministic Replay based Cyclic Debugging with Dynamic Slicing Yan Wang *, Harish Patil **, Cristiano Pereira **, Gregory Lueck **, Rajiv Gupta.

Slides:



Advertisements
Similar presentations
On-the-fly Healing of Race Conditions in ARINC-653 Flight Software
Advertisements

Concurrent Predicates: A Debugging Technique for Every Parallel Programmer PACT 13 Justin Gottschlich Gilles Pokam Cristiano Pereira Youfeng Wu Intel Corporation.
Software & Services Group PinPlay: A Framework for Deterministic Replay and Reproducible Analysis of Parallel Programs Harish Patil, Cristiano Pereira,
1 Chao Wang, Yu Yang*, Aarti Gupta, and Ganesh Gopalakrishnan* NEC Laboratories America, Princeton, NJ * University of Utah, Salt Lake City, UT Dynamic.
1 CS 201 Compiler Construction Lecture 3 Data Flow Analysis.
An Case for an Interleaving Constrained Shared-Memory Multi-Processor Jie Yu and Satish Narayanasamy University of Michigan.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Program Slicing. 2 CS510 S o f t w a r e E n g i n e e r i n g Outline What is slicing? Why use slicing? Static slicing of programs Dynamic Program Slicing.
Program Slicing Mark Weiser and Precise Dynamic Slicing Algorithms Xiangyu Zhang, Rajiv Gupta & Youtao Zhang Presented by Harini Ramaprasad.
Presented By: Krishna Balasubramanian
1 Cost Effective Dynamic Program Slicing Xiangyu Zhang Rajiv Gupta The University of Arizona.
CS590F Software Reliability What is a slice? S: …. = f (v)  Slice of v at S is the set of statements involved in computing v’s value at S. [Mark Weiser,
Bouncer securing software by blocking bad input Miguel Castro Manuel Costa, Lidong Zhou, Lintao Zhang, and Marcus Peinado Microsoft Research.
1 S. Tallam, R. Gupta, and X. Zhang PACT 2005 Extended Whole Program Paths Sriraman Tallam Rajiv Gupta Xiangyu Zhang University of Arizona.
Software & Services Group PinADX: Customizable Debugging with Dynamic Instrumentation Gregory Lueck, Harish Patil, Cristiano Pereira Intel Corporation.
An Case for an Interleaving Constrained Shared-Memory Multi- Processor CS6260 Biao xiong, Srikanth Bala.
1 Integrating Influence Mechanisms into Impact Analysis for Increased Precision Ben Breech Lori Pollock Mike Tegtmeyer University of Delaware Army Research.
Pruning Dynamic Slices With Confidence Xiangyu Zhang Neelam Gupta Rajiv Gupta The University of Arizona.
S. Narayanasamy, Z. Wang, J. Tigani, A. Edwards, B. Calder UCSD and Microsoft PLDI 2007.
Continuously Recording Program Execution for Deterministic Replay Debugging.
Deterministic Logging/Replaying of Applications. Motivation Run-time framework goals –Collect a complete trace of a program’s user-mode execution –Keep.
BugNet Continuously Recording Program Execution for Deterministic Replay Debugging Satish Narayanasamy Gilles Pokam Brad Calder.
Dependable computing needs pervasive debugging Tim Harris
Homework 2 In the docs folder of your Berkeley DB, have a careful look at documentation on how to configure BDB in main memory. In the docs folder of your.
C Prog. To Object Code text text binary binary Code in files p1.c p2.c
Replay Debugging for Distributed Systems Dennis Geels, Gautam Altekar, Ion Stoica, Scott Shenker.
Automated Diagnosis of Software Configuration Errors
0 Deterministic Replay for Real- time Software Systems Alice Lee Safety, Reliability & Quality Assurance Office JSC, NASA Yann-Hang.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
A Portable Virtual Machine for Program Debugging and Directing Camil Demetrescu University of Rome “La Sapienza” Irene Finocchi University of Rome “Tor.
Software (Program) Analysis. Automated Static Analysis Static analyzers are software tools for source text processing They parse the program text and.
Microsoft Research Asia Ming Wu, Haoxiang Lin, Xuezheng Liu, Zhenyu Guo, Huayang Guo, Lidong Zhou, Zheng Zhang MIT Fan Long, Xi Wang, Zhilei Xu.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Analyzing parallel programs with Pin Moshe Bach, Mark Charney, Robert Cohn, Elena Demikhovsky, Tevi Devor, Kim Hazelwood, Aamer Jaleel, Chi- Keung Luk,
- 1 - Dongyoon Lee †, Mahmoud Said*, Satish Narayanasamy †, Zijiang James Yang*, and Cristiano L. Pereira ‡ University of Michigan, Ann Arbor † Western.
Bug Localization with Machine Learning Techniques Wujie Zheng
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Interactive Debugging QuickZoom: A State Alteration and Inspection-based Interactive Debugger 1.
Automatic Diagnosis and Response to Memory Corruption Vulnerabilities Presenter: Jianyong Dai Jun Xu, Peng Ning, Chongkyung Kil, Yan Zhai, Chris Bookhot.
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
DoubleChecker: Efficient Sound and Precise Atomicity Checking Swarnendu Biswas, Jipeng Huang, Aritra Sengupta, and Michael D. Bond The Ohio State University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Technology and Science, Osaka University Dependence-Cache.
Scalable Support for Multithreaded Applications on Dynamic Binary Instrumentation Systems Kim Hazelwood Greg Lueck Robert Cohn.
Debugging parallel programs. Breakpoint debugging Probably the most widely familiar method of debugging programs is breakpoint debugging. In this method,
References: “Pruning Dynamic Slices With Confidence’’, by X. Zhang, N. Gupta and R. Gupta (PLDI 2006). “Locating Faults Through Automated Predicate Switching’’,
Lecture Notes - Copyright © S. C. Kothari, All rights reserved.1 Efficient Debugging CPRE 556 Lecture 19.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Seminar of “Virtual Machines” Course Mohammad Mahdizadeh SM. University of Science and Technology Mazandaran-Babol January 2010.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University A Slicing Method for Object-Oriented Programs Using Lightweight.
DrDebug: Deterministic Replay based Cyclic Debugging with Dynamic Slicing Yan Wang *, Harish Patil **, Cristiano Pereira **, Gregory Lueck **, Rajiv Gupta.
Fast Reproducing Web Application Errors Jie Wang, Wensheng Dou, Chushu Gao, Jun Wei Institute of Software Chinese Academy of Sciences
Yongjian HuTanzirul Azim Iulian Neamtiu Improving the Android Development Lifecycle with the VALERA Record-and- replay Approach.
Pruning Dynamic Slices With Confidence Original by: Xiangyu Zhang Neelam Gupta Rajiv Gupta The University of Arizona Presented by: David Carrillo.
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
Execution Replay and Debugging. Contents Introduction Parallel program: set of co-operating processes Co-operation using –shared variables –message passing.
Flashback : A Lightweight Extension for Rollback and Deterministic Replay for Software Debugging Sudarshan M. Srinivasan, Srikanth Kandula, Christopher.
Agenda  Quick Review  Finish Introduction  Java Threads.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Automated Adaptive Bug Isolation using Dyninst Piramanayagam Arumuga Nainar, Prof. Ben Liblit University of Wisconsin-Madison.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Paradyn Project Safe and Efficient Instrumentation Andrew Bernat.
Qin Zhao1, Joon Edward Sim2, WengFai Wong1,2 1SingaporeMIT Alliance 2Department of Computer Science National University of Singapore
Chapter 3 General-Purpose Processors: Software
Static Slicing Static slice is the set of statements that COULD influence the value of a variable for ANY input. Construct static dependence graph Control.
Computer Architecture and Assembly Language
PinADX: Customizable Debugging with Dynamic Instrumentation
Yongle Zhang, Serguei Makarov, Xiang Ren, David Lion, Ding Yuan
Log20: Fully Automated Optimal Placement of Log Printing Statements under Specified Overhead Threshold Xu Zhao*, Kirk Rodrigues*, Yu Luo*, Michael Stumm*,
CPRE 416-Software Evolution and Maintenance-Lecture 11
Presentation transcript:

DrDebug: Deterministic Replay based Cyclic Debugging with Dynamic Slicing Yan Wang *, Harish Patil **, Cristiano Pereira **, Gregory Lueck **, Rajiv Gupta *, and Iulian Neamtiu * * University of California Riverside ** Intel Corporation 1

Cyclic Debugging for Multi-threaded Programs Mozilla developer Bug report Id: Observe program state Fast-forward to the buggy region Program binary + input Root cause of the bug? ver Buggy region (12%) still large: ~1M instructions  Difficult to locate the bug Data race on variable rt->scriptFilenameTable 2 Fast Forward Long wait while fast-forwarding (88%) buggy Region main thread T1T2 worker threads

Key Contributions of DrDebug  User Selects Execution Region  Only capture execution of buggy region  Avoid fast forwarding  User Examines Execution Slice  Only capture bug related execution  Work for multi-threaded programs  Single-step slice in a live debugging session Execution Region and Execution Slice Results: Buggy region: <15% of total execution for bugs in 3 real-world programs Execution slice: < 48% of buggy region, < 7% of total execution for bugs in 3 real-world programs T1T2 Region 3

PinPlay in DrDebug PinPlay [Patil et. al., CGO’10, ] is a record/replay system, using the Pin dynamic instrumentation system. Logger Program binary + input region pinball Captures the non-deterministic events of the execution of a (buggy) region Replayer region pinball Program Output Deterministically repeat the captured execution Relogger pinball region pinball Relog execution—exclude the execution of some code regions 4

T2T1 Region Execution Region region pinball Record on Record off 5 Root Cause Failure Point

T1T2 region pinball Dynamic Slicing Dynamic slice: executed statements that played a role in the computation of the value. 6 compute slice Failure Point Root Cause

T1T2 region pinball compute slice pinball Excluded Code Region 7 Dynamic slice: executed statements that played a role in the computation of the value. compute slice Failure Point Root Cause Dynamic Slicing

T1T2 slice pinball Replaying Execution Slice Inject value Prior work on slicing: post-mortem analysis 8 Failure Point

DrDebug Program binary + input Observe program state Root cause of the bug? Only Capture Bug Related Program Execution Usage model of DrDebug slice pinball Cyclic Debugging Based on Replay of Execution Slice 9 compute slice record on/off

Other Contributions  Improve Precision of Dynamic Slice  Dynamic Data Dependence Precision Filter out spurious register dependences due to save/restore pairs at the entry/exit of each function  Dynamic Control Dependence Precision Presence of Indirect jumps  Inaccurate CFG  Missing Control Dependence Refine CFG with dynamically collected jump targets  Integration with Maple [Yu et al. OOPSLA’12] Capture exposed buggy execution into pinball Debug exposed concurrency bug with DrDebug 10

Slice Criterion DrDebug GUI Showing a Dynamic Slice 11

Data Race bugs used in our Case Studies Program NameBug Description pbzip A data race on variable fifo  mut between main thread and the compressor threads Aget-0.57A data race on variable bwritten between downloader threads and the signal handler thread Mozilla-1.9.1A data race on variable rt  scriptFilenameTable. One thread destroys a hash table, and another thread crashes in js_SweepScriptFilenames when accessing this hash table Quantify the buggy execution region size for real bugs. Time and space overhead of DrDebug are reasonable for real bugs. 12

Time and Space Overheads for Data Race Bugs with Buggy Execution Region Program Name #ins(%ins in region vs. total) #ins in slice pinball (%ins in slice vs. region pinball) Logging Overhead Replay Time (sec) Slicing Time (sec) Time (sec) Space (MB) Pbzip2 (0.9.4) 11,186 (0.04%) 1,065 (9.5%) Aget (0.57) 108,695 (14.3%) 51,278(47.2%) Mozilla (1.9.1) 999,997 (12.2%) 100 (0.01%) Buggy region size ~ 1M Buggy Region: <15% of total execution Execution Slice: <48% of buggy region, <7% of total execution 13

Logging Time Overheads with native input 14

Replay Time Overheads with native input The buggy regions up to a billion instructions can still be collected/replayed in reasonable time(~2 min). 15

Execution Slice: replay time with native input 36% 16

Contributions Support for recording: execution regions and dynamic slices Execution of dynamic slices for improved bug localization and replay efficiency Backward navigation of a dynamic slice along dependence edges with Kdbg based GUI Results: Buggy region: <15% of total execution; Execution slice: <48% of buggy region, <7% of total execution for bugs in 3 real-world programs Replay-based debugging and slicing is practical if we focus on a buggy region 17

Q&A? 18

Backup 19

pinball Logger (w/ fast forward) Replayer Pin’s Debugger Interface (PinADX) Program binary + input Observe program state/ reach failure Form/Refine a hypothesis about the cause of the bug Capture Buggy Region Replay-based Cyclic Debugging Cyclic Debugging with DrDebug 20

Dynamic Slicing in DrDebug when Integrated with PinPlay Dynamic Slicing Pin Replayer Remote Debugging Protocol KDbg GDB region pinball slice (b) Replay buggy Region and Compute Dynamic Slices. (a) Capture buggy region. region pinball Pin logger Program binary + input 21

Dynamic Slicing in DrDebug when Integrated with PinPlay slice pinball Pin Relogger slice region pinball + (c) Generate Slice Pinball from Region Pinball. Remote Debugging Protocol KDbg GDB Pin Replayer slice pinball (d) Replay Execution Slice and Debug by Examining State. 22

Computing Dynamic Slicing for Multi-threaded Programs  Collect Per Thread Local Execution Traces  Construct the Combined Global Trace Shared Memory Access Order Topological Order  Compute Dynamic Slice by Backwards Traversing the Global Trace Adopted Limited Preprocessing (LP) algorithm [Zhang et al., ICSE’03] to speed up the traversal of the trace 23

Dynamic Slicing a Multithreaded Program 1 1 {x} {} 2 1 {z} {x} 5 1 {m} {x} 3 1 {w} {y} Def-Use Trace for T1 4 1 {w}{w} 6 1 {x} {m} Def-Use Trace for T {k} {y} 8 1 {j} {y} 9 1 {j} {z,j} 11 1 {k,x} {} 12 1 {k}{k,x} 13 1 {k} {} 7 1 {y} {} x x y x z shared memory access order fox x x program order Per Thread Traces and Shared Memory Access Order T1T2 1x=5; 2 z=x; 3 int w=y; 4 w=w-2; 5 int m=3*x; 6 x=m+2; 7 y=2; 8 int j=y + 1; 9 j=z + j; 10 int k=4*y; 11 if (k>x){ 12 k=k-x; 13 assert(k>0); } Example Code int x, y, z; wrongly assumed atomic region 24

Dynamic Slicing a Multithreaded Program 7 1 {y} {} 8 1 {j} {y} 9 1 {j} {z,j} 10 1 {k} {y} 11 1 {k,x} {} 3 1 {w} {y} 4 1 {w} {w} 5 1 {m} {x} 6 1 {x} {m} 1 1 {x} {} 2 1 {z} {x} 12 1 {k} {k,x} 13 1 {k} {} T1 T2 T1 Global Trace 5 1 m=3*x 11 1 if(k>x) 12 1 k=k-x 13 1 assert(k>0) 6 1 x=m y=2 CD x k m 1 1 x= k=4*y x x k y slice criterion root cause Slice for k at 13 1 should read (depend on) the same definition of x 25

Execution Slice Example 10 1 k=4*y 11 1 if (k>x) 12 1 k=k-x 13 1 assert(k>0) T1T2 5 1 m=3*x 6 1 x=m x=5 7 1 y=2 inject j=8 z=5 w=0 inject Injecting Values During Replay 8 1 j=y j=z + j 10 1 k=4*y 11 1 if (k>x) 12 1 k=k-x 13 1 assert(k>0) T1T2 5 1 m=3*x 6 1 x=m x=5 2 1 z=x 3 1 w=y 4 1 w=w y=2 Code Exclusion Regions Only Bug Related Executions (e.g., root cause, failure point) are Replayed and Examined to Understand and Locate bugs.  Prior works-- postmortem analysis  Execution Slice – single-stepping/examining slice in a live debugging session 26

Control Dependences in the Presence of indirect jump 1P(FILE* fin, int d){ 2 int w; 3 char c=fgetc(fin); 4 switch(c){ 5 case 'a': /* slice criterion */ 6 w = d + 2; 7 break; 8 … 11} C Code 3call fgetc mov %al,- 0x9(%ebp) 4... mov 0x (,%eax,4),%eax jmp *%eax 6 mov 0xc(%ebp),%eax add $0x2,%eax mov %eax,-0x10(%ebp) 7 jmp 80485c88... Assembly Code Inaccurate CFG Causing Missed Control Dependence 6 1 : w=d+2 Imprecise Slice for w at line : c=fgetc(fin) 4 1 : switch(c) 6 1 : w=d+2 ‘a’ c CD Capture Missing Control Dependence due to indirect jump 27

Improve Dynamic Control Dependence Precision  Implement a static analyzer based on Pin's static code discovery library -- this allows DrDebug to work with any x86 or Intel64 binary.  We construct an approximate static CFG and as the program executes, we collect the dynamic jump targets for the indirect jumps and refine the CFG by adding the missing edges.  The refined CFG is used to compute the immediate post- dominator for each basic block 28

Spurious Dependences Example 1P(FILE* fin, int d){ 2 int w, e; 3 char c=fgetc(fin); 4 e= d + d; 5 if(c=='t') 6 Q(); 7 w=e; /* slice criterion */ 8 } 9Q() 10 { } C Code 3 call fgetc mov %al,-0x9(%ebp) 4 mov 0xc(%ebp),%eax add %eax,%eax 5 cmpb $0x74,-0x9(%ebp) jne d 6 call Q d 7 mov %eax,-0x10(%ebp) 9 Q() 10 push %eax pop %eax Assembly Code save/restore pair Spurious Data/Control Dependence 29

Spurious Dependences Example 7 1 : w = e mov %eax, -0x10(%ebp) 4 1 : e = d+d add %eax, %eax e Refined Slice 3 1 : c=fgetc(fin) 5 1 : if(c==‘t’) 121: pop %eax ‘t’ c 7 1 : w = e mov %eax, -0x10(%ebp) 10 1 : push %eax 4 1 : e = d+d add %eax, %eax CD eax e Imprecise Slice for w at line 7 1 Bypass data dependences caused by save/restore pairs True Definition of eax 30

Improved Dynamic Dependence Precision  Dynamic Control Dependence Precision Indirect jump (switch-case statement): Inaccurate CFG  missing Control Dependence Refine CFG with dynamically collected jump targets  Dynamic Data Dependence Precision Spurious dependence caused by save/restore pairs at the entry/exit of each function Identify save/restore pairs and bypass data dependences 31

Integration with Maple  Maple [Yu et al. OOPSLA’12] is a thread interleaving coverage-driven testing tool. Maple exposes untested thread interleaving as much as possible.  We changed Maple to optionally do PinPlay-based logging of the buggy execution it exposes.  We have successfully recorded multiple buggy executions and replayed them using DrDebug. 32

Slicing Time Overhead  10 slices for the last 10 different read instructions, spread across five threads, for region length 1M (main thread)  Average dynamic information tracing time: 51 seconds  Average size of slice: 218K dynamic instructions  Average slicing time: 585 seconds 33

Dynamic Slicer Implementation Slice Control Dependence Detection Global Trace Construction Slicer & Code Exclusion Regions Builder Pin Immediate Post Dominators Shared Memory Access Order + 34

Time and Space Overheads for Data Race Bugs with Whole Execution Region Program Name #executed ins #ins in slice pinball (%ins in slice pinball) Logging Overhead Replay Time (sec) Slicing Time (sec) Time (sec) Space (MB) pbzip230,260,30011,152 (0.04%) Aget761,59279,794 (10.5%) Mozilla8,180, ,496 (9.9%) ,

Logging Time Overheads 36

Replay Time Overheads 37

Removal of Spurious Dependences: slice sizes 38