Backtrace Support
Tracer, Jolt’s emulator, supports backtraces for panics that occur in guest programs. This is essential for debugging runtime errors.By default, symbols are stripped from release guest ELFs, so backtraces won’t contain detailed information. Debug/dev builds preserve symbols automatically.
JOLT_BACKTRACE Environment Variable
TheJOLT_BACKTRACE environment variable enables ad-hoc debugging by preserving symbols and enabling backtrace support.
Basic Backtrace
SetJOLT_BACKTRACE=1 to enable symbol resolution (function names, file:line):
Full Backtrace
For more detailed debugging information including register snapshots and cycle counts per frame, useJOLT_BACKTRACE=full:
Backtrace Attribute in #[jolt::provable]
For guest programs where you always want full debug support, you can bake symbol preservation into the build using thebacktrace attribute:
- Preserves symbols in the guest ELF
- Adds
-Cforce-frame-pointers=yesto the build - Is useful for test programs, dedicated debug builds, or when you need frame pointers for ZeroOS-level unwinding
The
backtrace attribute is not needed for normal debugging — JOLT_BACKTRACE=1 is sufficient for most cases.Valid Backtrace Values
Thebacktrace attribute accepts the following values:
"off"— Disable backtrace support"dwarf"— Full DWARF debug info with frame pointers"frame-pointers"— Frame pointers only
Manual Symbol Control
You can also control symbol preservation directly via the CLI:Printing and Tracing
Jolt supports standardprint! and println! macros in guest programs for debugging output.
Using println! in Guest Programs
no_std Guests
Forno_std guests, import the macros via:
std Guests
When std is enabled, the standardprintln! works automatically:
Fast Iteration with trace_analyze
When debugging issues with guest programs, use the correspondingtrace_analyze function for your #[jolt::provable] functions. This approach:
- Skips instantiating the prover
- Allows for faster iteration during debugging
- Executes the guest program in the tracer without generating a proof
Debugging Workflow
- Add print statements to understand program flow
- Use JOLT_BACKTRACE=1 to get detailed panic information
- Use trace_analyze for fast iteration without proving
- Switch to full proving once the logic is correct