Skip to content

Commit f1b8f8c

Browse files
committed
Mention IEx behaviour in dbg docs
1 parent 8f12969 commit f1b8f8c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5806,18 +5806,22 @@ defmodule Kernel do
58065806
## Configuring the debug function
58075807
58085808
One of the benefits of `dbg/2` is that its debugging logic is configurable,
5809-
allowing tools to extend `dbg` with enhanced behaviour. The debug function
5810-
can be configured at compile time through the `:dbg_callback` key of the `:elixir`
5811-
application. The debug function must be a `{module, function, args}` tuple.
5812-
The `function` function in `module` will be invoked with three arguments
5813-
*prepended* to `args`:
5809+
allowing tools to extend `dbg` with enhanced behaviour. This is done, for
5810+
example, by `IEx` which extends `dbg` with an interactive shell where you
5811+
can directly inspect and access values.
5812+
5813+
The debug function can be configured at compile time through the `:dbg_callback`
5814+
key of the `:elixir` application. The debug function must be a
5815+
`{module, function, args}` tuple. The `function` function in `module` will be
5816+
invoked with three arguments *prepended* to `args`:
58145817
58155818
1. The AST of `code`
58165819
2. The AST of `options`
58175820
3. The `Macro.Env` environment of where `dbg/2` is invoked
58185821
5819-
Whatever is returned by the debug function is then the return value of `dbg/2`. The
5820-
debug function is invoked at compile time.
5822+
The debug function is invoked at compile time and it must also return an AST.
5823+
The AST is expected to ultimately return the result of evaluating the debugged
5824+
expression.
58215825
58225826
Here's a simple example:
58235827

0 commit comments

Comments
 (0)