Debugging in Pharo

Damien Cassou, Stéphane Ducasse and Luc Fabresse http://stephane.ducasse.free.fr

What You Will Learn

Debugging

Debugging

Watch the videos and practice

Simple Trace

Transcript show: 'x = ', x printString

Defining a Breakpoint

   ...
   Halt now.

Halt now (or self halt)

Single-Shot Halt

  ...
  Halt once.

To enable it, evaluate

  Halt enableHaltOnce

Halt once, if enabled :

Halt After n Iterations

Halt onCount: 10

Conditional Halt

faces will stop only when invoked from printString

Dice >> faces
  ...
  Halt if: #printString

Conditional Halt

The parameter passed to if: can be a test name too:

Dice >> faces
  ...
  Halt if: #testLargeDice

faces will stop only when invoked from testLargeDice

Create Your Own Breakpoints

Halt class >> between: minTime and: maxTime
   (Time current
      between: minTime asTime
      and: maxTime asTime)
         ifTrue: [ self signal ]

Dice >> faces
   ...
   Halt between: '00:00' and: '02:00'

faces will halt only between midnight and 2am.

What You Should Know

/