@@ -11,6 +11,7 @@ use foundry_evm_core::{
11
11
use foundry_evm_coverage:: HitMaps ;
12
12
use foundry_evm_traces:: CallTraceArena ;
13
13
use revm:: {
14
+ inspectors:: CustomPrintTracer ,
14
15
interpreter:: {
15
16
CallInputs , CallOutcome , CallScheme , CreateInputs , CreateOutcome , Gas , InstructionResult ,
16
17
Interpreter , InterpreterResult ,
@@ -45,6 +46,8 @@ pub struct InspectorStackBuilder {
45
46
pub logs : Option < bool > ,
46
47
/// Whether coverage info should be collected.
47
48
pub coverage : Option < bool > ,
49
+ /// Whether to print all opcode traces into the console. Useful for debugging the EVM.
50
+ pub print : Option < bool > ,
48
51
/// The chisel state inspector.
49
52
pub chisel_state : Option < usize > ,
50
53
/// Whether to enable call isolation.
@@ -116,6 +119,13 @@ impl InspectorStackBuilder {
116
119
self
117
120
}
118
121
122
+ /// Set whether to enable the trace printer.
123
+ #[ inline]
124
+ pub fn print ( mut self , yes : bool ) -> Self {
125
+ self . print = Some ( yes) ;
126
+ self
127
+ }
128
+
119
129
/// Set whether to enable the tracer.
120
130
#[ inline]
121
131
pub fn trace ( mut self , yes : bool ) -> Self {
@@ -144,6 +154,7 @@ impl InspectorStackBuilder {
144
154
debug,
145
155
logs,
146
156
coverage,
157
+ print,
147
158
chisel_state,
148
159
enable_isolation,
149
160
} = self ;
@@ -162,6 +173,7 @@ impl InspectorStackBuilder {
162
173
stack. collect_coverage ( coverage. unwrap_or ( false ) ) ;
163
174
stack. collect_logs ( logs. unwrap_or ( true ) ) ;
164
175
stack. enable_debugger ( debug. unwrap_or ( false ) ) ;
176
+ stack. print ( print. unwrap_or ( false ) ) ;
165
177
stack. tracing ( trace. unwrap_or ( false ) ) ;
166
178
167
179
stack. enable_isolation ( enable_isolation) ;
@@ -273,6 +285,7 @@ pub struct InspectorStack {
273
285
pub debugger : Option < Debugger > ,
274
286
pub fuzzer : Option < Fuzzer > ,
275
287
pub log_collector : Option < LogCollector > ,
288
+ pub printer : Option < CustomPrintTracer > ,
276
289
pub tracer : Option < TracingInspector > ,
277
290
pub enable_isolation : bool ,
278
291
@@ -357,6 +370,12 @@ impl InspectorStack {
357
370
self . log_collector = yes. then ( Default :: default) ;
358
371
}
359
372
373
+ /// Set whether to enable the trace printer.
374
+ #[ inline]
375
+ pub fn print ( & mut self , yes : bool ) {
376
+ self . printer = yes. then ( Default :: default) ;
377
+ }
378
+
360
379
/// Set whether to enable the tracer.
361
380
#[ inline]
362
381
pub fn tracing ( & mut self , yes : bool ) {
0 commit comments