1 from stack traces to lazy rewriting sequences
play

1 From Stack Traces to Lazy Rewriting Sequences Stephen Chang , Eli - PowerPoint PPT Presentation

1 From Stack Traces to Lazy Rewriting Sequences Stephen Chang , Eli Barzilay, John Clements*, Matthias Felleisen Northeastern University *California Polytechnic State University 10/5/2011 2 Debugging lazy programs is hard. 3 Freja (Nilsson


  1. 1

  2. From Stack Traces to Lazy Rewriting Sequences Stephen Chang , Eli Barzilay, John Clements*, Matthias Felleisen Northeastern University *California Polytechnic State University 10/5/2011 2

  3. Debugging lazy programs is hard. 3

  4. Freja (Nilsson and Fritzson 1992) Hat (Sparud and Runciman, 1997) Buddha (Pope, 1998) HOOD (Gill, 2000) New Hat (Wallace et al., 2001) HsDebug (Ennals and Peyton Jones, 2003) Rectus (Murk and Kolmoldin, 2006) GHCi debugger (Marlow et al., 2007) StackTrace (Allwood et al., 2009) 4

  5. Freja (Nilsson and Fritzson 1992) Hat (Sparud and Runciman, 1997) Buddha (Pope, 1998) HOOD (Gill, 2000) New Hat (Wallace et al., 2001) HsDebug (Ennals and Peyton Jones, 2003) Rectus (Murk and Kolmoldin, 2006) GHCi debugger (Marlow et al., 2007) StackTrace (Allwood et al., 2009) What do you think is Haskell's most glaring weakness / blind spot / problem? [Tibell, Knowlson 2011] Inadequate Tools (50%) 5

  6. [State of Haskell Survey 2011] 6

  7. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) 7

  8. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) "Laziness is hard to come to grips with. It's powerful and good, but it also causes strange problems that a beginner often cannot diagnose." (months) 8

  9. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) "Laziness is hard to come to grips with. It's powerful and good, but it also causes strange problems that a beginner often cannot diagnose." (months) "I think that a good debugger that lets me step through a program /quickly and comfortably/ would be a great help." (1yr) 9

  10. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) "Laziness is hard to come to grips with. It's powerful and good, but it also causes strange problems that a beginner often cannot diagnose." (months) "I think that a good debugger that lets me step through a program /quickly and comfortably/ would be a great help." (1yr) "I'd love to see some debugging (~step by step evaluation/run tracing) support." (2yrs) 10

  11. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) "Laziness is hard to come to grips with. It's powerful and good, but it also causes strange problems that a beginner often cannot diagnose." (months) "I think that a good debugger that lets me step through a program /quickly and comfortably/ would be a great help." (1yr) "I'd love to see some debugging (~step by step evaluation/run tracing) support." (2yrs) "Debugging lazy code" (4 yrs) 11

  12. [State of Haskell Survey 2011] "A debugger adjusted to the complexity of debugging lazily evaluated structures." (weeks) "Laziness is hard to come to grips with. It's powerful and good, but it also causes strange problems that a beginner often cannot diagnose." (months) "I think that a good debugger that lets me step through a program /quickly and comfortably/ would be a great help." (1yr) "I'd love to see some debugging (~step by step evaluation/run tracing) support." (2yrs) "Debugging lazy code" (4 yrs) Better lazy step-based tools are needed. 12

  13. What's a "step"? 13

  14. HsDebug [Ennals and Peyton Jones 2003] 14

  15. HsDebug [Ennals and Peyton Jones 2003] • Evaluate expressions optimistically. 15

  16. HsDebug [Ennals and Peyton Jones 2003] non-termination errors • Evaluate expressions optimistically. • To preserve lazy behavior, handle special cases: 16

  17. HsDebug [Ennals and Peyton Jones 2003] non-termination errors • Evaluate expressions optimistically. • To preserve lazy behavior, handle special cases: • Too difficult to implement. 17

  18. Idea #1: Debugger shouldn't change the program evaluation model. 18

  19. GHCi Debugger [Marlow et al. 2007] 19

  20. GHCi Debugger [Marlow et al. 2007] • Shows the effects of laziness. 20

  21. GHCi Debugger [Marlow et al. 2007] • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 21

  22. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 22

  23. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 23

  24. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 24

  25. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 25

  26. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 26

  27. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 27

  28. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 28

  29. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 29

  30. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 30

  31. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 31

  32. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 32

  33. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4) ) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 33

  34. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" 34

  35. GHCi Debugger [Marlow et al. 2007] test1 x y = (test2 y) + x test2 x = x * 2 test3 x = x + 1 main = print $ test1 (1 + 2) (test3 (3 + 4)) -- unfamiliar to programmers. • Shows the effects of laziness. • "having execution jump around can be distracting and confusing" • Step semantics correspond to low-level implementation 35

  36. Idea #2: Debugger should use a high-level semantics familiar to programmers. 36

  37. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] 37

  38. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. 38

  39. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. 39

  40. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. 40

  41. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. 41

  42. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. • Extraneous reductions. 42

  43. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. • Extraneous reductions. 43

  44. A reduction semantics-based tool [Gibbons and Wansbrough 1996, Ariola et al. 1995] • Persistent arguments clutter reductions. • Extraneous reductions. 44

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend