SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Practical Object-Oriented
Back-in-Time Debugging
Adrian Lienhard, Tudor Gîrba and Oscar Nierstrasz
                           Software Composition Group
                          University of Bern, Switzerland
Debugger call stack
                                  class Account {
                                    Money balance;
                                    void deposit(Money amount) {
NullPointerException >>               this.balance += money;
                                    }
                                    ...
                                  }


                     ..................
Debugger call stack
                          class Account {
                            Money balance;
                            void deposit(Money amount) {
NullPointerException >>       this.balance += money;
                            }
                            ...
                          }

                          class Company {
                            void pay(Money money, Person person) {
                              person.account().deposit(money);
                            }
                          }
                     ...




                                                    where does the
                                                    account object
                                                    come from?
Debugger call stack
                          class Account {
                            Money balance;
                            void deposit(Money amount) {
NullPointerException >>       this.balance += money;
                            }
                            ...
                          }

                          class Company {
                            void pay(Money money, Person person) {
                              person.account().deposit(money);
                            }
                          }
                     ...




                                                    where does the
                                          return    account object
                                                    come from?
Debugger call stack
                          class Account {
                            Money balance;
                            void deposit(Money amount) {
NullPointerException >>       this.balance += money;
                            }
                            ...
                          }

                          class Company {
                            void pay(Money money, Person person) {
                              person.account().deposit(money);
                            }
                          }
                     ...




                                                    where does the
                     field read            return    account object
                                                    come from?
Debugger call stack
                                           class Account {
                                             Money balance;
                                             void deposit(Money amount) {
                                               this.balance += money;
                                             }
                                             ...
                                           }

class Person {                             class Company {
  void createAccount(Bank bank) {            void pay(Money money, Person perso
    this.account = bank.openAccount();         person.account().deposit(money);
  }                                          }
}                                          }




                                         ...
                                                                     where doe
                return    field write     field read         return    account o
                                                                     come from
class Acc
                                                                           Money b
                                                                           void de
                                                                             this.
                                                                           }
                                                                           ...
                                                                         }

class Bank {                  class Person {                             class Com
  Account openAccount() {       void createAccount(Bank bank) {            void pa
    return new Account();         this.account = bank.openAccount();         perso
  }                             }                                          }
}                             }                                          }




                                                                       ...
                     allocation               return    field write     field read
Debugger call stack
                                                                                 class Account {
                                                                                   Money balance;
                                                                                   void deposit(Money amount) {
                                                       NullPointerException >>       this.balance += money;
                                                                                   }
                                                                                   ...
                                                                                 }

class Bank {                  class Person {                                     class Company {
  Account openAccount() {       void createAccount(Bank bank) {                    void pay(Money money, Person person) {
    return new Account();         this.account = bank.openAccount();                 person.account().deposit(money);
  }                             }                                                  }
}                             }                                                  }




                                                                            ...
                                                                                                           where does the
                     allocation               return        field write      field read            return    account object
                                                                                                           come from?




                                  In 50% of the cases the execution stack contains
                                  essentially no information about the bug’s cause.
                                                                                                          [Liblit PLDI’05]
class Bank {                  class Person {                             class Company {
  Account openAccount() {       void createAccount(Bank bank) {            void pay(Money money, Person person) {
    return new Account();         this.account = bank.openAccount();         person.account().deposit(money);
  }                             }                                          }
}                             }                                          }




                                                                       ...
                                                                                                   where does the
                     allocation               return    field write     field read         return    account object
                                                                                                   come from?




                                               History recorded by a
                                               back-in-time debugger
                                      t

                                                Challenges:
                                                 amount of data
                                                 execution overhead
Approaches
     Omniscient           Trace-oriented             Trace-oriented
     Debugger1           debugger2 (partial)         debugger2 (full)




+ limited memory usage   – requires extensive hardware resources
– loss of old history    – loss of history       + complete history
– overhead 100x          + overhead 10x          – overhead 100x



                               1) Lewis AADEBUG’03   2) Pothier etal. OOPSLA’07
Approaches
     Omniscient           Trace-oriented              Trace-oriented
     Debugger1           debugger2 (partial)          debugger2 (full)

                             st o f all?
                         Be       dm   emor
                                             y
                          + limite erhead
                                    v
                            + low o      histor
                                                y
                                      te
                           + co mple

+ limited memory usage   – requires extensive hardware resources
– loss of old history    – loss of history          + complete history
– overhead 100x          + overhead 10x             – overhead 100x



                               1) Lewis AADEBUG’03    2) Pothier etal. OOPSLA’07
Approaches
     Omniscient           Trace-oriented             Trace-oriented
     Debugger1           debugger2 (partial)         debugger2 (full)

                             st o f all?
                         Be          emor
                                          y
                               ited m ead
                          + lim overh
                           + low        istory
                                e vant h
                          + rel
+ limited memory usage   – requires extensive hardware resources
– loss of old history    – loss of history       + complete history
– overhead 100x          + overhead 10x          – overhead 100x



                               1) Lewis AADEBUG’03   2) Pothier etal. OOPSLA’07
At runtime delete history when it gets irrelevant



                          Relevant questions:
                           How was this object passed here?
                           What were the previous values of a field
                           and where (call stack) were they assigned?

                           Only history of live objects needed!


           Efficient mechanism required to
           identify irrelevant datapoints at runtime
How we can do it

VM that models history as first-class objects
Keep history together with regular objects in memory
Use GC to efficiently delete no longer needed history
First-class references
    Typical model: object                     Object Flow VM: references are
references as direct pointers                  represented as alias objects

            regular objects                                 alias

   header                              header
                            header                          header
 field_1                              field_1                                header
                      ...                             value
 field_2                              field_2                          ...
                                                      context
 ....                                ....
 field_n
               pointer               field_n
                                                      origin
                                                      predecessor
                                                      ...
Object Flow VM model
                                         caller   0..1

                                  MethodInvocation
                                                         *
                             context              1

                                       target     parameter
                  field or array                    *
          1            element
  Value                                Alias
          value              *
Object Flow VM model
                                            caller   0..1

                                   MethodInvocation
                                                            *
                             context                 1

                                          target     parameter
                  field or array                       *
          1            element                           predecessor
  Value                                   Alias
          value              *                              0..1
                                   0..1    *         0..1
                                 origin
Historical object state
account = new Account()      t1




                   balance                  value
 :Account                         init@t1           null
Historical object state
account = new Account()      t1
...
account.balance = 17         t2




                                                    value
                                  init@t1                   null
                                      predecessor

                   balance                          value
  :Account                   field-write@t2                  17
Historical object state
account = new Account()    t1
...
account.balance = 17       t2
...
account.balance = 42       t3

                                                  value
                                init@t1                   null
                                    predecessor

                                                  value
                           field-write@t2                  17
                                    predecessor

                 balance                          value
  :Account                 field-write@t3                  42
Object
 Flow                   allocation



                             class Person {
                                                  return   field write


                                                                         field read
                                                                                        field read


                                                                                     parameter
                                                                                                    return




                               void printOn(Stream stream) {
                                 stream.print(this.account);
                               }
                             }




                                                                return


   field-write                        field-read

                                                                           field-read
       return
                                            parameter

                allocation

                                                                               active
                                                                             invocation

  Legend          running/completed method invocation          alias            alias origin
Effect of GC
    snapshot 1




                                                                                      active
                                                                                    invocation
                 garbage collection
    snapshot 2




                     Legend           running/completed method invocation   alias    alias origin
Evaluation memory usage (1)
 2.5e+09                                                              1e+07
                 Number of aliases allocated (left Y-axis)
               Number of aliases in memory (right Y-axis)
               Number of objects in memory (right Y-axis)
  2e+09                                                               8e+06



 1.5e+09                                                              6e+06



  1e+09                                                               4e+06



  5e+08                                                               2e+06



      0                                                               0
           0            200           400              600   800   1000
                                            #classes
Evaluation memory usage (2)
  7e+06                                                                50
               Number of aliases allocated
              Number of aliases in memory
  6e+06       Number of objects in memory
                 Ratio between aliases in                              40
                   memory and allocated
  5e+06

                                                                       30
  4e+06




                                                                            %
  3e+06
                                                                       20

  2e+06
                                                                       10
  1e+06


      0                                                                0
          0       2      4       6      8     10   12   14   16   18
                                        #samples
Evaluation memory usage (3)
  1e+07
           Number of aliases allocated
  9e+06   Number of aliases in memory
          Number of objects in memory
  8e+06

  7e+06

  6e+06

  5e+06

  4e+06

  3e+06

  2e+06

  1e+06

      0
                   5             10              15   20   25
                                         #requests
Evaluation run-time overhead


                        Overhead           GC
     Recording off            1.15       1.6%
     Recording on             3.84     27.6%
    Average over 6 standard Smalltalk benchmarks


           Largest overhead: 6.91
Conclusion

✔   Retains important history – even if old
✔   Memory consumption limited in the best case,
    slowly growing in the worst case
✔   Relative low run-time overhead

✖   Missing control flow dependencies

Weitere ähnliche Inhalte

Andere mochten auch

Chapter 3 presentation
Chapter 3 presentationChapter 3 presentation
Chapter 3 presentation
dphil002
 
Corporate taxation introduction
Corporate taxation introductionCorporate taxation introduction
Corporate taxation introduction
dphil002
 
Uzbekistan caving 2011
Uzbekistan caving 2011Uzbekistan caving 2011
Uzbekistan caving 2011
Yura Taras
 
Itf ipp ch08_2012_final
Itf ipp ch08_2012_finalItf ipp ch08_2012_final
Itf ipp ch08_2012_final
dphil002
 
Angeiologie 4 2013 - 1-2014 livre des resumes
Angeiologie 4 2013 - 1-2014 livre des resumesAngeiologie 4 2013 - 1-2014 livre des resumes
Angeiologie 4 2013 - 1-2014 livre des resumes
sfa_angeiologie
 
RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009
etalcomendras
 
RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009
etalcomendras
 
Week5-Group-J
Week5-Group-JWeek5-Group-J
Week5-Group-J
s1160114
 

Andere mochten auch (20)

Chapter 3 presentation
Chapter 3 presentationChapter 3 presentation
Chapter 3 presentation
 
Corporate taxation introduction
Corporate taxation introductionCorporate taxation introduction
Corporate taxation introduction
 
Cluster 15
Cluster 15Cluster 15
Cluster 15
 
Postcards From Pure Michigan
Postcards From Pure MichiganPostcards From Pure Michigan
Postcards From Pure Michigan
 
Uzbekistan caving 2011
Uzbekistan caving 2011Uzbekistan caving 2011
Uzbekistan caving 2011
 
Itf ipp ch08_2012_final
Itf ipp ch08_2012_finalItf ipp ch08_2012_final
Itf ipp ch08_2012_final
 
Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)Terofox v port catalogue (rev.01)
Terofox v port catalogue (rev.01)
 
Syndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculairesSyndrome metabolique et maladies vasculaires
Syndrome metabolique et maladies vasculaires
 
Jay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final CorrigidaJay Cross Vivo Versao Final Corrigida
Jay Cross Vivo Versao Final Corrigida
 
Angeiologie 4 2013 - 1-2014 livre des resumes
Angeiologie 4 2013 - 1-2014 livre des resumesAngeiologie 4 2013 - 1-2014 livre des resumes
Angeiologie 4 2013 - 1-2014 livre des resumes
 
201101 affective learning
201101 affective learning201101 affective learning
201101 affective learning
 
Sexto AñO Basico
Sexto AñO BasicoSexto AñO Basico
Sexto AñO Basico
 
RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009RCMSL Phenomenal Sep 24, 2009
RCMSL Phenomenal Sep 24, 2009
 
RCMSL Phenomenal July 2, 2009
RCMSL Phenomenal July 2, 2009RCMSL Phenomenal July 2, 2009
RCMSL Phenomenal July 2, 2009
 
RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009RCMSL Phenomenal July 16, 2009
RCMSL Phenomenal July 16, 2009
 
VU 19 Nov 09
VU 19  Nov 09VU 19  Nov 09
VU 19 Nov 09
 
Cup A Soup MiNi
Cup A Soup MiNiCup A Soup MiNi
Cup A Soup MiNi
 
Twitter en Facebook voor journalisten
Twitter en Facebook voor journalistenTwitter en Facebook voor journalisten
Twitter en Facebook voor journalisten
 
Week5-Group-J
Week5-Group-JWeek5-Group-J
Week5-Group-J
 
Master Teset Specification SRCP
Master Teset Specification SRCPMaster Teset Specification SRCP
Master Teset Specification SRCP
 

Ähnlich wie Practical Object-Oriented Back-in-Time Debugging

The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdf
akshay1213
 
OOP: Classes and Objects
OOP: Classes and ObjectsOOP: Classes and Objects
OOP: Classes and Objects
Atit Patumvan
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdf
ankitcom
 
You are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdfYou are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdf
deepakangel
 
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdfAccount.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
anujmkt
 

Ähnlich wie Practical Object-Oriented Back-in-Time Debugging (6)

Inheritance
InheritanceInheritance
Inheritance
 
The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdf
 
OOP: Classes and Objects
OOP: Classes and ObjectsOOP: Classes and Objects
OOP: Classes and Objects
 
public class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdfpublic class InsufficientFundsException extends Exception{Insuffic.pdf
public class InsufficientFundsException extends Exception{Insuffic.pdf
 
You are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdfYou are not setting any values for those variables(name, ID, interes.pdf
You are not setting any values for those variables(name, ID, interes.pdf
 
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdfAccount.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
 

Mehr von lienhard (10)

Chicken
ChickenChicken
Chicken
 
Prototype-based Programming with JavaScript
Prototype-based Programming with JavaScriptPrototype-based Programming with JavaScript
Prototype-based Programming with JavaScript
 
Virtual Machines Lecture
Virtual Machines LectureVirtual Machines Lecture
Virtual Machines Lecture
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)Dynamic Object Flow Analysis (PhD Defense)
Dynamic Object Flow Analysis (PhD Defense)
 
Rapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using MondrianRapid Prototyping Of Visualizations Using Mondrian
Rapid Prototyping Of Visualizations Using Mondrian
 
Tracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature DependenciesTracking Objects To Detect Feature Dependencies
Tracking Objects To Detect Feature Dependencies
 
Test Blueprints
Test BlueprintsTest Blueprints
Test Blueprints
 
Object Flow Analysis
Object Flow AnalysisObject Flow Analysis
Object Flow Analysis
 
Identifying Traits with Formal Concept Analysis
Identifying Traits with Formal Concept AnalysisIdentifying Traits with Formal Concept Analysis
Identifying Traits with Formal Concept Analysis
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Practical Object-Oriented Back-in-Time Debugging

  • 1. Practical Object-Oriented Back-in-Time Debugging Adrian Lienhard, Tudor Gîrba and Oscar Nierstrasz Software Composition Group University of Bern, Switzerland
  • 2. Debugger call stack class Account { Money balance; void deposit(Money amount) { NullPointerException >> this.balance += money; } ... } ..................
  • 3. Debugger call stack class Account { Money balance; void deposit(Money amount) { NullPointerException >> this.balance += money; } ... } class Company { void pay(Money money, Person person) { person.account().deposit(money); } } ... where does the account object come from?
  • 4. Debugger call stack class Account { Money balance; void deposit(Money amount) { NullPointerException >> this.balance += money; } ... } class Company { void pay(Money money, Person person) { person.account().deposit(money); } } ... where does the return account object come from?
  • 5. Debugger call stack class Account { Money balance; void deposit(Money amount) { NullPointerException >> this.balance += money; } ... } class Company { void pay(Money money, Person person) { person.account().deposit(money); } } ... where does the field read return account object come from?
  • 6. Debugger call stack class Account { Money balance; void deposit(Money amount) { this.balance += money; } ... } class Person { class Company { void createAccount(Bank bank) { void pay(Money money, Person perso this.account = bank.openAccount(); person.account().deposit(money); } } } } ... where doe return field write field read return account o come from
  • 7. class Acc Money b void de this. } ... } class Bank { class Person { class Com Account openAccount() { void createAccount(Bank bank) { void pa return new Account(); this.account = bank.openAccount(); perso } } } } } } ... allocation return field write field read
  • 8. Debugger call stack class Account { Money balance; void deposit(Money amount) { NullPointerException >> this.balance += money; } ... } class Bank { class Person { class Company { Account openAccount() { void createAccount(Bank bank) { void pay(Money money, Person person) { return new Account(); this.account = bank.openAccount(); person.account().deposit(money); } } } } } } ... where does the allocation return field write field read return account object come from? In 50% of the cases the execution stack contains essentially no information about the bug’s cause. [Liblit PLDI’05]
  • 9. class Bank { class Person { class Company { Account openAccount() { void createAccount(Bank bank) { void pay(Money money, Person person) { return new Account(); this.account = bank.openAccount(); person.account().deposit(money); } } } } } } ... where does the allocation return field write field read return account object come from? History recorded by a back-in-time debugger t Challenges: amount of data execution overhead
  • 10. Approaches Omniscient Trace-oriented Trace-oriented Debugger1 debugger2 (partial) debugger2 (full) + limited memory usage – requires extensive hardware resources – loss of old history – loss of history + complete history – overhead 100x + overhead 10x – overhead 100x 1) Lewis AADEBUG’03 2) Pothier etal. OOPSLA’07
  • 11. Approaches Omniscient Trace-oriented Trace-oriented Debugger1 debugger2 (partial) debugger2 (full) st o f all? Be dm emor y + limite erhead v + low o histor y te + co mple + limited memory usage – requires extensive hardware resources – loss of old history – loss of history + complete history – overhead 100x + overhead 10x – overhead 100x 1) Lewis AADEBUG’03 2) Pothier etal. OOPSLA’07
  • 12. Approaches Omniscient Trace-oriented Trace-oriented Debugger1 debugger2 (partial) debugger2 (full) st o f all? Be emor y ited m ead + lim overh + low istory e vant h + rel + limited memory usage – requires extensive hardware resources – loss of old history – loss of history + complete history – overhead 100x + overhead 10x – overhead 100x 1) Lewis AADEBUG’03 2) Pothier etal. OOPSLA’07
  • 13. At runtime delete history when it gets irrelevant Relevant questions: How was this object passed here? What were the previous values of a field and where (call stack) were they assigned? Only history of live objects needed! Efficient mechanism required to identify irrelevant datapoints at runtime
  • 14. How we can do it VM that models history as first-class objects Keep history together with regular objects in memory Use GC to efficiently delete no longer needed history
  • 15. First-class references Typical model: object Object Flow VM: references are references as direct pointers represented as alias objects regular objects alias header header header header field_1 field_1 header ... value field_2 field_2 ... context .... .... field_n pointer field_n origin predecessor ...
  • 16. Object Flow VM model caller 0..1 MethodInvocation * context 1 target parameter field or array * 1 element Value Alias value *
  • 17. Object Flow VM model caller 0..1 MethodInvocation * context 1 target parameter field or array * 1 element predecessor Value Alias value * 0..1 0..1 * 0..1 origin
  • 18. Historical object state account = new Account() t1 balance value :Account init@t1 null
  • 19. Historical object state account = new Account() t1 ... account.balance = 17 t2 value init@t1 null predecessor balance value :Account field-write@t2 17
  • 20. Historical object state account = new Account() t1 ... account.balance = 17 t2 ... account.balance = 42 t3 value init@t1 null predecessor value field-write@t2 17 predecessor balance value :Account field-write@t3 42
  • 21. Object Flow allocation class Person { return field write field read field read parameter return void printOn(Stream stream) { stream.print(this.account); } } return field-write field-read field-read return parameter allocation active invocation Legend running/completed method invocation alias alias origin
  • 22. Effect of GC snapshot 1 active invocation garbage collection snapshot 2 Legend running/completed method invocation alias alias origin
  • 23. Evaluation memory usage (1) 2.5e+09 1e+07 Number of aliases allocated (left Y-axis) Number of aliases in memory (right Y-axis) Number of objects in memory (right Y-axis) 2e+09 8e+06 1.5e+09 6e+06 1e+09 4e+06 5e+08 2e+06 0 0 0 200 400 600 800 1000 #classes
  • 24. Evaluation memory usage (2) 7e+06 50 Number of aliases allocated Number of aliases in memory 6e+06 Number of objects in memory Ratio between aliases in 40 memory and allocated 5e+06 30 4e+06 % 3e+06 20 2e+06 10 1e+06 0 0 0 2 4 6 8 10 12 14 16 18 #samples
  • 25. Evaluation memory usage (3) 1e+07 Number of aliases allocated 9e+06 Number of aliases in memory Number of objects in memory 8e+06 7e+06 6e+06 5e+06 4e+06 3e+06 2e+06 1e+06 0 5 10 15 20 25 #requests
  • 26. Evaluation run-time overhead Overhead GC Recording off 1.15 1.6% Recording on 3.84 27.6% Average over 6 standard Smalltalk benchmarks Largest overhead: 6.91
  • 27. Conclusion ✔ Retains important history – even if old ✔ Memory consumption limited in the best case, slowly growing in the worst case ✔ Relative low run-time overhead ✖ Missing control flow dependencies