liveBook · Manning

Debugging

As explained in Elixir in Action, Third Edition

Debugging is the process of examining program execution and data to locate or understand faults.

Debugging examines program execution and data to locate or understand faults. In highly concurrent and distributed BEAM systems, classical step-by-step debugging becomes difficult because processes, timeouts, and nodes cannot be coordinated into one meaningful sequence. section 13.3 section 13.3.1

Prefer strategies that preserve the system’s concurrent behavior:

  • Use logging and tracing to collect enough context to identify the cause of a failure. section 13.3.1
  • Start with Elixir’s Logger output: crashed OTP-compliant processes such as GenServers report an error and stack trace with file and line information. section 13.3.1
  • Add IO.inspect when the stack trace lacks sufficient evidence; it prints an expression’s result and returns that result, preserving behavior. section 13.3.1

Inspecting a suspicious pipeline

Pipe an intermediate value through IO.inspect to observe it without changing the surrounding computation: value |> IO.inspect() |> next_step(). section 13.3.1

How Elixir in Action, Third Edition covers it

How deep it goes
Contrasts classical debugging with logging, tracing, Logger, stack traces, and IO.inspect, while deferring deeper treatment.
Examples
Uses crashed GenServers, Logger stack traces, and IO.inspect in expressions or pipelines.
What it assumes
Assumes familiarity with concurrent BEAM systems and OTP-compliant processes; teaches IO.inspect’s diagnostic behavior directly.
What you can do after
Diagnose/debug with it by inspecting failures through logs, stack traces, tracing, and non-invasive value inspection.
How it connects
Connects debugging with concurrency, distributed systems, logging, tracing, OTP, GenServer, and stack traces.

Also explained in

Compare how 16 books explain debugging →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.