Debugging and debugging tools in Elixir?

elixir debugger vscode
elixir pry
elixir binding
elixir inspect
elixir test debugging
elixir
cannot pry is an iex shell running?
elixir print

I've just started using Elixir, and have started a Phoenix project, which I enjoy a lot. Now by having rails background, I'm used to being spoiled with debugging tools like "debugger", "byebug" and so on; I was wondering if there are any similar tools for Elixir? How are you guys debugging your Elixir applications?

Even an equivalent to Rubys raise my_object.inspect, would do wonders!

Thank you

You can use IEx

require IEx

value = {:some, :erlang, :value}
IEx.pry

If you start this program with for example iex -s program.exs (or iex -S mix for a project) you'll be asked if you want to allow prying into this code when it is reached and value will be available for you for inspection.

You can also just do print debugging using IO.inspect allowing you to output basically any erlang data structure.

Debugging � Elixir School, Much has been said about Elixir debugging techniques, but in this post, I'd Although it's not exactly a debug tool, it's worth mentioning that� In Elixir 1.5 and OTP 20 there's a new function Exception.blame/3 which can add debug information to certain exceptions. It only supports FunctionClauseErrors right now and you should only use it in development because it's an expensive task: the function will retrieve the available clauses from bytecode and evaluate them against the given arguments.

Debugging Cowboy apps, and Phoenix apps.

I saw this post in the Elixir rader http://www.jessetrimble.net/iex-pry-elixir, and thought i would just summarise it up here, as it's extremely convenient :-).

In Rails applications (and other), you can simply put in the debugger tag in your controller, and when the path is triggered, it will break at the debugger tag.

When using pry in Phoenix the above will result in

Cannot pry #PID<0.259.0> at web/controllers/posts_controller.ex:8. Is an IEx shell running?

It turns out that the Phoenix process must run within an IEx session, this is done as such

iex -S mix phoenix.server

Now instead you will see

Request to pry #PID<0.266.0> at web/controllers/posts_controller.ex:9. Allow? [Yn]

Elixir — quick reference for debugging techniques, You can use IEx require IEx value = {:some, :erlang, :value} IEx.pry. If you start this program with for example iex -s program.exs (or iex -S mix� The most straightforward tool we have for debugging Elixir code is IEx. But don’t be fooled by its simplicity - you can solve most of the issues with your application by it. IEx means Elixir's interactive shell. You could have already seen IEx in one of the previous lessons like Basics where we ran Elixir code interactively in the shell.

You can use Quaff.Debug module from https://github.com/qhool/quaff

The Debug module provides a simple helper interface for running Elixir code in the erlang graphical debugger

I tested it today with Elixir 1.0.4, it works.

Debugging and debugging tools in Elixir?, A brief tutorial on debugging Elixir projects using `IEx.pry/0` and `:debugger`. and so forth, it's a good tool for non-production debugging. Written by Erich Kist. It’s common that our first experience with debugging in a new language is by printing values to the terminal. Elixir isn’t different: we can use IO.puts/2 and IO.inspect/2. However, Elixir also provides other approaches to debugging.

Debugging techniques in Elixir � Plataformatec Blog, I've just started using Elixir, and have started a Phoenix project, which I enjoy a lot. Now by having rails background, I'm used to being spoiled with debugging� Go to Debugging Phoenix with IEx.pry if you want more tips about debugging Phoenix with IEx.pry.:debugger. Pretty much the same as IEx.pry which stops the execution at the break point and allows you to inspect the current code, but :debugger gives you a nice visual interface, like the ones in IDEs:

In Elixir 1.5 and OTP 20 there's a new function Exception.blame/3 which can add debug information to certain exceptions. It only supports FunctionClauseErrors right now and you should only use it in development because it's an expensive task: the function will retrieve the available clauses from bytecode and evaluate them against the given arguments. See Release

Debugging and debugging tools in Elixir? - elixir - html, Luke Imhoff, an engineer with DockYard who developed the Elixir plugin for JetBrain's IntelliJ platform, provides his findings for debugging Elixir code using three different classes of tools: IO, Pry, and line-based graphical tools. [IntelliJ 9.0. Libraries and tools for debugging code and applications. All libraries and projects - 20. visualixir, observer_cli, Wobserver, elixometer, and eper

Debugging Elixir With Three Tools: ElixirConf 2018, So far I just did „poor mans debugging“ with IO.inspect but I am guessing Erlang developers and nobody used the debugger tool for nothing. Erlang remote access and remote debugging are builtin features in Erlang/Elixir. With these features, it is possible to see what's happening inside a BEAM node (as RabbitMQ). There are a set of tools inside the beam like etop, eprof, dbg, fprof that work in the same Linux way.

What are your debugging techniques? - Questions / Help, Is there any IDE or Editor that support Elixir/Phoenix/Ecto Debugging a mix command or bash command that you can run from the run tool. This feature can be used to inspect and debug production apps running on remote nodes. Let’s see how we can connect to an Elixir node running inside a docker container remotely from a local iex shell and use Erlang’s debugger tool to set breakpoints and debug the code running in the remote node.

Is there an Elixir editor with Debugger? - Questions / Help, Why another debugging tool? At first, the tracing setter is implemented as macro, because it allows to use native elixir macro capabilities to capture call in natural� ElixirLS: Elixir support and debugger for VS Code Provides Elixir language support and debugger. This extension is powered by the Elixir Language Server (ElixirLS), an Elixir implementation of Microsoft's IDE-agnostic Language Server Protocol and VS Code debug protocol. Visit its page for more information.

Comments
  • Have a look at this awesome list, mentioning some debugging tools: github.com/h4cc/awesome-elixir#debugging
  • For what it's worth, I've heard that this book: erlang-in-anger.com has some awesome advice on debugging Erlang. Most of the tools one would use with Erlang are equally applicable to Elixir.
  • Not 100% related but it is also worth mentioning :observer.start (run it on IEx). It is a great tool for debugging and exploring running applications.
  • Any thoughts about debugging Phoenix/cowboy apps, say if you want to debug the behavior of a controller when a request rolls in.
  • Old thread but you should check this out if you haven't yet youtube.com/watch?v=pj6zAgvVt5w
  • It is worth mentioning that IO.inspect returns the given argument. So if you have a code like foo(bar, baz), you can directly add foo(IO.inspect(bar), baz) and everything will behave the same.
  • Does this work in phoenix? I get a server crash when I try it.
  • for windows you want to use iex.bat --werl -S mix phoenix.server
  • I hope a link to IEx.pry/1 documentation would be useful
  • For further reading, the official website also has some detailed information about: it elixir-lang.org/getting-started/debugging.html
  • I think the mix task phoenix.start has been replaced for phoenix.server
  • I'm new to Elixir and Phoenix so this could be a dump question. In understand that with pry I can inspect the variables and (being into iex) I can make function calls. But this is only half of a debugger's functionality: how can I follow the execution flow of the program? Is there another tool to let me advance to the next line and step into functions? Ruby's byebug has both functionalities.
  • If you're using Docker to run your Phoenix app, this won't work.