Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Debugging elixir efficently

Debugging elixir efficently

A 10 minutes walk through of Erlang's built-in tools (:debugger and :obverser) to help you debug your elixir code efficiently.

1dad9adb1056bf806ef856039acc1873?s=128

Guillaume Cauchon

May 10, 2018
Tweet

More Decks by Guillaume Cauchon

Other Decks in Technology

Transcript

  1. Debugging elixir efficiently

  2. Guillaume Cauchon @gcauchon @Mirego @alagarderie

  3. Debugging techniques in Elixir Solid Ground // Saša Jurić Empex

    2017
  4. > IO.puts/2 IO.inspect/2 Apex.ap/2

  5. None
  6. IEx.pry

  7. None
  8. :debugger

  9. iex(1)> :debugger.start() {:ok, #PID<0.156.0>} iex(2)> :int.ni(Demo) {:module, Demo} iex(3)> :int.break(Demo,

    14) :ok iex(4)>
  10. None
  11. iex(1)> Demo.fibonacci(10) 55 iex(2)> Demo.fibonacci(50) 12586269025 iex(3)> Demo.fibonacci(99) 218922995834555169026 iex(4)>

    Demo.fibonacci(-10)
  12. None
  13. None
  14. :observer

  15. iex(1)> Demo.fibonacci(-10) …

  16. > iex --erl "+S 1" -S mix * iex(1)> :observer.start()

    :ok iex(2)> Demo.fibonacci(20) 6765 iex(3)> Demo.fibonacci(99) 218922995834555169026 iex(4)> Demo.fibonacci(-1) … * Start the Erlang VM with a single process scheduler to demonstrate the infinite loop more explicitly.
  17. None
  18. None
  19. None
  20. None