File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -5806,18 +5806,22 @@ defmodule Kernel do
5806
5806
## Configuring the debug function
5807
5807
5808
5808
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`:
5814
5817
5815
5818
1. The AST of `code`
5816
5819
2. The AST of `options`
5817
5820
3. The `Macro.Env` environment of where `dbg/2` is invoked
5818
5821
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.
5821
5825
5822
5826
Here's a simple example:
5823
5827
You can’t perform that action at this time.
0 commit comments