1 / 28

Dynamine: Mining Software Revision Histories for Error Patterns

Explore error patterns through software revision histories. Identify common issues like null dereferences and buffer overruns. Understand co-added method calls and patterns in code analysis. Discover how DynaMine works and its impact on bug reporting. Uncover mining methods for dynamic analysis and post-process usage patterns. Dive into patterns in CVS histories for effective bug reporting.

Download Presentation

Dynamine: Mining Software Revision Histories for Error Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DynaMineFinding Common Error Patterns by Mining Software Revision Histories Benjamin Livshits Stanford University Thomas Zimmermann Saarland University

  2. J2EE servlets Application specific Device drivers Linux code Error Pattern Iceberg null dereferences, buffer overruns, ... The usual suspects

  3. Co-changed items = patterns

  4. Co-added Method Calls public void createPartControl(Composite parent) { ... // add listener for editor page activation getSite().getPage().addPartListener(partListener); } public void dispose() { ... getSite().getPage().removePartListener(partListener); }

  5. Co-added Method Calls public void createPartControl(Composite parent) { ... // add listener for editor page activation getSite().getPage().addPartListener(partListener); } public void dispose() { ... getSite().getPage().removePartListener(partListener); }

  6. Co-added Method Calls public void createPartControl(Composite parent) { ... // add listener for editor page activation getSite().getPage().addPartListener(partListener); } public void dispose() { ... getSite().getPage().removePartListener(partListener); } co-added

  7. patterns mine CVS histories rank and filter revision history mining instrument relevant method calls run the application dynamic analysis post-process usage patterns error patterns unlikely patterns report patterns report bugs reporting How DynaMine Works

  8. Mining Patterns patterns mine CVS histories rank and filter revision history mining instrument relevant method calls run the application dynamic analysis post-process usage patterns error patterns unlikely patterns report patterns report bugs reporting

  9. o1.addListener() o1.removeListener() Foo.java 1.12 Bar.java 1.47 o2.addListener() o2.removeListener() System.out.println() Baz.java 1.23 o3.addListener() o3.removeListener() list.iterator() iter.hasNext() iter.next() o4.addListener() System.out.println() Qux.java 1.41 o4.removeListener() 1.42 Mining Method Calls

  10. Finding Pairs 1 Pair o1.addListener() o1.removeListener() Foo.java 1.12 Bar.java 1.47 o2.addListener() o2.removeListener() System.out.println() 1 Pair Baz.java 1.23 o3.addListener() o3.removeListener() list.iterator() iter.hasNext() iter.next() 2 Pairs 0 Pairs o4.addListener() System.out.println() Qux.java 1.41 0 Pairs o4.removeListener() 1.42

  11. o.enterAlignment() o.exitAlignment() o.redoAlignment() iter.hasNext() iter.next() o.enterAlignment() o.exitAlignment() o.redoAlignment() iter.hasNext() iter.next() o.enterAlignment() o.exitAlignment() o.redoAlignment() iter.hasNext() iter.next() o.enterAlignment() o.exitAlignment() o.redoAlignment() iter.hasNext() iter.next() \ {enterAlignment(), exitAlignment(), redoAlignment()} Finding Patterns • Find “frequent itemsets” (with Apriori)

  12. Ranking Patterns o1.addListener() o1.removeListener() Foo.java 1.12 • Support count = #occurrences of a pattern • Confidence = strength of a pattern, P(A|B) Bar.java 1.47 o2.addListener() o2.removeListener() System.out.println() Baz.java 1.23 o3.addListener() o3.removeListener() list.iterator() iter.hasNext() iter.next() o4.addListener() System.out.println() Qux.java 1.41 o4.removeListener() 1.42

  13. This is a fix! Rank removeListener() patterns higher Ranking Patterns o1.addListener() o1.removeListener() Foo.java 1.12 Bar.java 1.47 o2.addListener() o2.removeListener() System.out.println() Baz.java 1.23 o3.addListener() o3.removeListener() list.iterator() iter.hasNext() iter.next() o4.addListener() System.out.println() Qux.java 1.41 o4.removeListener() 1.42

  14. JEDIT ECLIPSE since 2000 2001 developers 92 112 lines of code 700,000 2,900,000 revisions 40,000 400,000 Investigated Projects

  15. Simple Method Pairs • GUIs & Listener Usage pattern Error pattern

  16. Simple Method Pairs • Locking of Resources Not hit at runtime

  17. State Machines in Eclipse • Pretty-printing Usage pattern

  18. State Machines in Eclipse • Memory context manupilation Not hit at runtime

  19. State Machines in JEdit • Compound edits (for undo/redo) Usage pattern

  20. Complex Patterns • try { • monitor.beginTask(null, Policy.totalWork); • int depth = -1; • try { • workspace.prepareOperation(null, monitor); • workspace.beginOperation(true); • depth = workspace.getWorkManager().beginUnprotected(); • return runInWorkspace (Policy.subMonitorFor(monitor, Policy.opWork, • SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); • } catch (OperationCanceledException e) { • workspace.getWorkManager().operationCanceled(); • return Status.CANCEL_STATUS; • } finally { • if (depth >= 0) • workspace.getWorkManager().endUnprotected(depth); • workspace.endOperation(null, false, • Policy.subMonitorFor(monitor, Policy.endOpWork)); • } • } catch (CoreException e) { • return e.getStatus(); • } finally { • monitor.done(); • }

  21. Complex Patterns • try { • monitor.beginTask(null, Policy.totalWork); • int depth = -1; • try { • workspace.prepareOperation(null, monitor); • workspace.beginOperation(true); • depth = workspace.getWorkManager().beginUnprotected(); • return runInWorkspace (Policy.subMonitorFor(monitor, Policy.opWork, • SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); • } catch (OperationCanceledException e) { • workspace.getWorkManager().operationCanceled(); • return Status.CANCEL_STATUS; • } finally { • if (depth >= 0) • workspace.getWorkManager().endUnprotected(depth); • workspace.endOperation(null, false, • Policy.subMonitorFor(monitor, Policy.endOpWork)); • } • } catch (CoreException e) { • return e.getStatus(); • } finally { • monitor.done(); • }

  22. Complex Patterns • try { • monitor.beginTask(null, Policy.totalWork); • int depth = -1; • try { • workspace.prepareOperation(null, monitor); • workspace.beginOperation(true); • depth = workspace.getWorkManager().beginUnprotected(); • return runInWorkspace (Policy.subMonitorFor(monitor, Policy.opWork, • SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); • } catch (OperationCanceledException e) { • workspace.getWorkManager().operationCanceled(); • return Status.CANCEL_STATUS; • } finally { • if (depth >= 0) • workspace.getWorkManager().endUnprotected(depth); • workspace.endOperation(null, false, • Policy.subMonitorFor(monitor, Policy.endOpWork)); • } • } catch (CoreException e) { • return e.getStatus(); • } finally { • monitor.done(); • }

  23. Workspace Transactions Usage pattern S → O* O → w.prepareOperation() w.beginOperation() U* w.endOperation() U → w.getWorkManager().beginUnprotected() S [w.getWorkManager().operationCanceled()] w.getWorkManager().beginUnprotected()

  24. Dynamic Validation patterns mine CVS histories rank and filter revision history mining instrument relevant method calls run the application dynamic analysis post-process usage patterns error patterns unlikely patterns report patterns report bugs reporting

  25. usage patterns error patterns unlikely patterns e<v/10 v/10<=e<=2v otherwise Pattern classification post-process v validations, e violations

  26. Experiments total 56 patterns

  27. Future Work • Automatically generate state machines • Additional patterns by textual matching • Programmer assist toolsProgrammers who inserted a call to open() inserted a call to close() • Aspect Mining

  28. Contibutions • DynaMine learns usage patterns from large version archives. • DynaMine ranks patterns effectively, especially for finding error patterns. • DynaMine increases trust in patterns by dynamic analysis

More Related