• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Unstuck
 

Unstuck

on

  • 964 views

Design And Implementation of a Backward-In-Time Debugger...

Design And Implementation of a Backward-In-Time Debugger

Traditional debugging and stepping execution trace are well-accepted techniques to understand deep internals about a program. However in many cases navigating the stack trace is not enough to find bugs, since the cause of a bug is often not in the stack trace anymore and old state is lost, so out of reach from the debugger. In this paper, we present the design and implementation of a backward-in-time debugger for a dynamic language, i.e, a debugger that allows one to navigate back the history of the application. We present the design and implementation of a backward-in-time debugger called Unstuck and show our solution to key implementation challenges.

Statistics

Views

Total Views
964
Views on SlideShare
962
Embed Views
2

Actions

Likes
0
Downloads
6
Comments
0

1 Embed 2

http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Unstuck Unstuck Presentation Transcript

    • Design and Implementation of a Backward-In-Time Debugger Christoph Hofer Marcus Denker Stephane Ducasse © Marcus Denker
    • Roadmap > Problem > Unstuck: A new Debugger for Squeak > Implementation > Lessons Learned > Future work © Marcus Denker
    • Problem > Debugger: Snapshot of state at time of error > Cause for errors is in the past — Who assigned *that* value? > very incomplete history available — guess were to set breakpoint, rerun © Marcus Denker
    • Example Foo>>initialize Foo>>bar var1 := 0. ...... var2 := ''. Foo>>moreBar Foo>>start var2 size > 0 ifTrue:[ self beforeBar. ^var2 at: 1]. self bar. ^'' self moreBar. Foo>>beforeBar var1 = 0 ifTrue: [ var2 := nil.] © Marcus Denker
    • Stack Trace > Squeak Debugger > Shows stack trace — methods not returned — old state lost © Marcus Denker
    • Stack Trace > Squeak Debugger > Shows stack trace — methods not returned — old state lost © Marcus Denker
    • Solution > We want: — Record the history of the program — View the state at any point in the past > Unstuck — A new Debugger for Squeak — Provides full trace information © Marcus Denker
    • Unstuck UI 1. Trace 2. Object 3. Code 4. History 5. Query © Marcus Denker
    • Searching Variable Search Domain event All events send all message sends return all method returns varAccess all variable accesses instVarAccess instance variable access tempVarAccess temporary variables © Marcus Denker
    • Searching: Example Query Result send selector = #foo All the executed methods named ”foo” return returnValue > 4 All returns with a return value greater than 4 events isSend & Message sends with exactly (even arguments size = 1) one argument © Marcus Denker
    • Coloring > We can assign a color to any object > Easy tracking of objects > Color is shown in all views of the UI © Marcus Denker
    • Implementation Debugger uses Trace Library uses ByteSurgeon © Marcus Denker
    • ByteSurgeon > Framework for editing bytecode for Squeak — Like Javasist in Java, but: > Uses structural reflection to transform at runtime — Simple model: Inline code before / after a bytecode — Inlined code is normal smalltalk code — Not much knowledge about bytecode needed © Marcus Denker
    • Trace Library > Called from annotated code > Builds up the trace > Provides — Trace model — Event pre-processing (ordering) — State reconstruction © Marcus Denker
    • State reconstruction > State not recorded for completely annotated classes — past state can be reconstructed from trace > System never completely annotated — Tracer saves state of non-annotated objects © Marcus Denker
    • Debugging system classes > Annotate classes used by Bytesurgeon or Tracer — System classes (e.g. Collection or String) — Compiler (e.g. AST) > Problems: — Classes used for annotation --> crash — Tracer records events generated by the tracer © Marcus Denker
    • Solution > Retain both methods (original + annotated) > Generate preamble — test for global — call original methods when inactive > Common problem when using reflection! — General solution? — Future work! © Marcus Denker
    • Benchmarks Events Slowdown Memory (Kb) Example 74 6 16 AST Bug 2725 3.8 800 Pier Trace 389689 248 88800 © Marcus Denker
    • Future Work > further analyze + improve — Memory Consumption (GC effects) — Performance > Use behavioral reflection — fine grained selection — Scoping — Annotation of system classes © Marcus Denker
    • Conclusion > Problem of current debugging tools > Overview of Unstuck — UI — Implementation > Having the history available helps — Possible for small programs — Work needed for bigger systems + continuous use © Marcus Denker
    • Conclusion > Problem of current debugging tools > Overview of Unstuck — UI — Implementation Questions? > Having the history available helps — Possible for small programs — Work needed for bigger systems + continuous use © Marcus Denker