Setting breaks in IEx for debugging
With the release of Elixir 1.5 comes some handy new IEx helpers, one of which is the ability to add break points throughout your code.
You can add a break to any function using break!/2
or break!/4
:
Both break/2
and break/4
accept an additional argument for how many stops you want to make. Useful for recursive functions where you may want to stop multiple times.
To see what breaks you have use breaks/0
Now when you call the function, you'll be placed into the a debugger and you can inspect whats being passed in:
To exit the break and start a new shell process use respawn/0