SlideShare a Scribd company logo
1 of 21
Download to read offline
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

More Related Content

What's hot

Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)
Sri Prasanna
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
knowdiff
 
process management
 process management process management
process management
Ashish Kumar
 
Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
 
Ppt project process migration
Ppt project process migrationPpt project process migration
Ppt project process migration
jaya380
 

What's hot (20)

Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed Systems
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)Processor Allocation (Distributed computing)
Processor Allocation (Distributed computing)
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...Multiprocessing -Interprocessing communication and process sunchronization,se...
Multiprocessing -Interprocessing communication and process sunchronization,se...
 
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
 
process management
 process management process management
process management
 
Flink Architecture
Flink Architecture Flink Architecture
Flink Architecture
 
A Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET DevelopersA Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET Developers
 
Linux process management
Linux process managementLinux process management
Linux process management
 
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...GopherCon 2017 -  Writing Networking Clients in Go: The Design & Implementati...
GopherCon 2017 - Writing Networking Clients in Go: The Design & Implementati...
 
Cassandra Architecture
Cassandra ArchitectureCassandra Architecture
Cassandra Architecture
 
JActor Cluster Platform
JActor Cluster PlatformJActor Cluster Platform
JActor Cluster Platform
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Ppt project process migration
Ppt project process migrationPpt project process migration
Ppt project process migration
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Replication in the Wild
Replication in the WildReplication in the Wild
Replication in the Wild
 
Presentation
PresentationPresentation
Presentation
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 

Similar to Unstuck

Embedded Mirror Maker
Embedded Mirror MakerEmbedded Mirror Maker
Embedded Mirror Maker
Simon Suo
 

Similar to Unstuck (20)

Software Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience ReportSoftware Evolution from the Field: an Experience Report
Software Evolution from the Field: an Experience Report
 
Sub-Method Reflection
Sub-Method ReflectionSub-Method Reflection
Sub-Method Reflection
 
Reflection
ReflectionReflection
Reflection
 
Lecture: Reflection
Lecture: ReflectionLecture: Reflection
Lecture: Reflection
 
Unanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral ReflectionUnanticipated Partial Behavioral Reflection
Unanticipated Partial Behavioral Reflection
 
Reflection and Context
Reflection and ContextReflection and Context
Reflection and Context
 
Sub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral ReflectionSub-method Structural and Behavioral Reflection
Sub-method Structural and Behavioral Reflection
 
Reflectivity Demo
Reflectivity DemoReflectivity Demo
Reflectivity Demo
 
Presentation about my Research
Presentation about my ResearchPresentation about my Research
Presentation about my Research
 
Refactoring
RefactoringRefactoring
Refactoring
 
The Reflectivity
The ReflectivityThe Reflectivity
The Reflectivity
 
Talk: Practical, Pluggable Types
Talk: Practical, Pluggable TypesTalk: Practical, Pluggable Types
Talk: Practical, Pluggable Types
 
Embedded Mirror Maker
Embedded Mirror MakerEmbedded Mirror Maker
Embedded Mirror Maker
 
Nesc tutorial
Nesc tutorialNesc tutorial
Nesc tutorial
 
(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks(SAS) UNIX X Command Tips and Tricks
(SAS) UNIX X Command Tips and Tricks
 
Stoop 305-reflective programming5
Stoop 305-reflective programming5Stoop 305-reflective programming5
Stoop 305-reflective programming5
 
SQL Server Deep Drive
SQL Server Deep Drive SQL Server Deep Drive
SQL Server Deep Drive
 
202110 SESUG 49 UNIX X Command Tips and Tricks
202110 SESUG 49 UNIX X Command Tips and Tricks202110 SESUG 49 UNIX X Command Tips and Tricks
202110 SESUG 49 UNIX X Command Tips and Tricks
 
OSEK / VDX
OSEK / VDXOSEK / VDX
OSEK / VDX
 
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
SRV402 Deep Dive on Amazon EC2 Instances, Featuring Performance Optimization ...
 

More from Marcus Denker

More from Marcus Denker (20)

Soil And Pharo
Soil And PharoSoil And Pharo
Soil And Pharo
 
ConstantBlocks in Pharo11
ConstantBlocks in Pharo11ConstantBlocks in Pharo11
ConstantBlocks in Pharo11
 
Demo: Improved DoIt
Demo: Improved DoItDemo: Improved DoIt
Demo: Improved DoIt
 
First Class Variables as AST Annotations
First Class Variables as AST AnnotationsFirst Class Variables as AST Annotations
First Class Variables as AST Annotations
 
Supporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo SupportSupporting Pharo / Getting Pharo Support
Supporting Pharo / Getting Pharo Support
 
Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"Lecture: "Advanced Reflection: MetaLinks"
Lecture: "Advanced Reflection: MetaLinks"
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Variables in Pharo
Variables in PharoVariables in Pharo
Variables in Pharo
 
Lecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinksLecture. Advanced Reflection: MetaLinks
Lecture. Advanced Reflection: MetaLinks
 
Improving code completion for Pharo
Improving code completion for PharoImproving code completion for Pharo
Improving code completion for Pharo
 
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinksVUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
VUB Brussels Lecture 2019: Advanced Reflection: MetaLinks
 
Slot Composition
Slot CompositionSlot Composition
Slot Composition
 
Lecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinksLecture: Advanced Reflection. MetaLinks
Lecture: Advanced Reflection. MetaLinks
 
PHARO IOT
PHARO IOTPHARO IOT
PHARO IOT
 
Open-Source: An Infinite Game
Open-Source: An Infinite GameOpen-Source: An Infinite Game
Open-Source: An Infinite Game
 
Lecture: MetaLinks
Lecture: MetaLinksLecture: MetaLinks
Lecture: MetaLinks
 
PharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to PharoPharoTechTalk: Contributing to Pharo
PharoTechTalk: Contributing to Pharo
 
Feedback Loops in Practice
Feedback Loops in PracticeFeedback Loops in Practice
Feedback Loops in Practice
 
Pharo6 - ESUG17
Pharo6 - ESUG17Pharo6 - ESUG17
Pharo6 - ESUG17
 
Pharo6
Pharo6Pharo6
Pharo6
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Unstuck

  • 1. Design and Implementation of a Backward-In-Time Debugger Christoph Hofer Marcus Denker Stephane Ducasse © Marcus Denker
  • 2. Roadmap > Problem > Unstuck: A new Debugger for Squeak > Implementation > Lessons Learned > Future work © Marcus Denker
  • 3. 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
  • 4. 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
  • 5. Stack Trace > Squeak Debugger > Shows stack trace — methods not returned — old state lost © Marcus Denker
  • 6. Stack Trace > Squeak Debugger > Shows stack trace — methods not returned — old state lost © Marcus Denker
  • 7. 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
  • 8. Unstuck UI 1. Trace 2. Object 3. Code 4. History 5. Query © Marcus Denker
  • 9. 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
  • 10. 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
  • 11. Coloring > We can assign a color to any object > Easy tracking of objects > Color is shown in all views of the UI © Marcus Denker
  • 12. Implementation Debugger uses Trace Library uses ByteSurgeon © Marcus Denker
  • 13. 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
  • 14. Trace Library > Called from annotated code > Builds up the trace > Provides — Trace model — Event pre-processing (ordering) — State reconstruction © Marcus Denker
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. Benchmarks Events Slowdown Memory (Kb) Example 74 6 16 AST Bug 2725 3.8 800 Pier Trace 389689 248 88800 © Marcus Denker
  • 19. Future Work > further analyze + improve — Memory Consumption (GC effects) — Performance > Use behavioral reflection — fine grained selection — Scoping — Annotation of system classes © Marcus Denker
  • 20. 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
  • 21. 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