May 2018
Intermediate to advanced
412 pages
9h 3m
English
You already know that IEx is the go-to utility to play with Elixir code. It also has a secret and dark second life as a debugger. It isn’t fancy, but it lets you get into a running program and examine the environment.
You enter the debugger when running Elixir code hits a breakpoint. There are two ways of creating a breakpoint. One works by adding calls into the code you want to debug. The other is initiated from inside IEx. We’ll look at both using the following (buggy) code:
| | defmodule Buggy do |
| | def parse_header( |
| | << |
| | format::integer-16, |
| | tracks::integer-16, |
| » | division::integer-16 |
| | >> |
| | ) do |
| | |
| | IO.puts "format: #{format}" |
| | IO.puts "tracks: #{tracks}" |
| | IO.puts ... |
Read now
Unlock full access