Acton’s source-level debugger lets you pause Tolk contract execution at any line, inspect local variables and TVM registers in structured form, evaluate expressions, and step through message handler logic — all from a standard editor. The debugger speaks the Debug Adapter Protocol (DAP), so it integrates with VS Code, JetBrains, and any other DAP-capable client without requiring a special debug build or modified contract code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ton-blockchain/acton/llms.txt
Use this file to discover all available pages before exploring further.
Debugging tools at a glance
Choose the right tool for your question before reaching for the full debugger:| Question | Best tool |
|---|---|
| Print a value from a test or script | println(...) |
| Print a value from VM-executed contract code | debug.print<T>(x) |
| Inspect a transaction tree quickly | println(txs) or matcher output |
| Get source locations without a live debugger | acton test --backtrace full |
| Set breakpoints and step through code | acton test --debug or acton script --debug |
| Debug a real historical on-chain transaction | acton retrace <HASH> --contract <NAME> --debug |
Starting a debug session
The--debug flag is available on three commands:
Choosing a port
The default debug port is12345. Override it with --debug-port:
Connecting from VS Code
Install the TON extension for VS Code from the marketplace. The extension registers the
tolk debug adapter type automatically.{
"version": "0.2.0",
"configurations": [
{
"type": "tolk",
"request": "launch",
"name": "Attach to Acton",
"debugServer": 12345
}
]
}
Connecting from JetBrains
The TON plugin for JetBrains IDEs integrates the Acton debugger into the native test runner. You can start a debug session directly from the gutter icon next to a test function or from a Run Configuration — no manuallaunch.json required. See the IDE support guide for full setup instructions.
Setting breakpoints
Set breakpoints directly in.tolk source files in your editor. Acton maps source locations to VM execution points using compiler-produced source maps; no debug build flag or separate contract variant is needed.
Breakpoint locations may slide to the next stoppable line if the exact line has no corresponding VM instruction. The editor shows the resolved location as verified once Acton confirms the breakpoint.
Debugger capabilities
The current DAP implementation supports:Stepping controls
Continue, step over, step into, step out, and instruction-level stepping when the client requests instruction granularity.
Stack traces
Full source-level stack traces including cross-contract boundaries for live debug sessions.
Variables inspection
Locals with structured expansion for tuples, maps, arrays, structs, addresses, cells, and union types.
TVM Registers
Live sessions expose a
Registers scope with c4 (storage), c5 (output actions), and c7 (temporary data) in contract-aware readable form.Conditional breakpoints
Breakpoints with condition expressions. Conditions are fail-loud: evaluation failures stop execution and report the error rather than silently passing.
Expression evaluation
Watches, hovers, and debug-console evaluation for a safe side-effect-free subset of Tolk expressions.
Exception break filters
The debugger supports two exception break filters:- Uncaught Exceptions — break when an unhandled exception propagates.
- All Exceptions — break on every throw, including caught ones.
Expression evaluation scope
Hover, watch, and debug-console evaluation support:- Local variables (including shadowed locals from the selected frame)
- Backticked identifiers
- Field access (
foo.bar) and dot-based numeric indexing (foo.items.0) - Parentheses and boolean/string/integer/
nullliterals - Unary
!and- &&,||, and comparison operators (==,!=,<,<=,>,>=)- Typed cell casts:
someCell as Cell<Foo>orsomeSlice as Cell<Foo>decoded from the current frame’s source map
Live vs replay sessions
| Feature | --debug (live) | retrace --debug (replay) |
|---|---|---|
| Source stepping | ✅ | ✅ (requires --contract) |
| TVM Registers scope | ✅ | ✗ |
| Cross-contract stepping | ✅ | ✗ |
| Matches real on-chain context | ✗ | ✅ |
acton retrace --debug is stricter than live debugging: it requires --contract, a local .tolk contract, compiler-produced source maps, and a matching local/on-chain code hash.
Backtraces without a live debugger
When you need source locations and call paths but not interactive stepping, use--backtrace full:
- The compute phase fails and you need the exact source location.
- The action phase fails and Acton instructs you to rerun with a backtrace.
- A matcher failure produced the right transaction tree but insufficient source context.
Contract debug output
Usedebug.print* inside VM-executed contract code and println(...) in tests and scripts:
#DEBUG#:) appear in executor logs when running with --verbose, or in transaction details in Test UI and saved traces.
Practical tips
acton test --debugis best suited to a single narrowed test. Use--filterto avoid stepping through an entire suite.acton script --debugdebugs the local execution path; it does not provide source-level stepping inside a real on-chain broadcast after the script hands control to the network.- When stepping into helpers such as
net.send*ornet.runGetMethod(), Acton can splice the child execution into the same logical debug session so you do not need to start a separate debugger manually. - Some internal runtime glue in
emulation/network.tolkis treated as transparent during step-into, so Acton may skip over it to land on a more useful stop point.