@@ -71,15 +71,16 @@ pub fn execute_bytecode(
7171 ( poseidons_16_precomputed, poseidons_24_precomputed) ,
7272 merkle_path_hints,
7373 )
74- . unwrap_or_else ( |err| {
74+ . unwrap_or_else ( |( last_pc , err) | {
7575 let lines_history = & instruction_history. lines ;
7676 let latest_instructions = & lines_history[ lines_history. len ( ) . saturating_sub ( STACK_TRACE_INSTRUCTIONS ) ..] ;
7777 println ! (
7878 "\n {}" ,
7979 crate :: diagnostics:: pretty_stack_trace(
8080 & bytecode. program,
8181 latest_instructions,
82- & bytecode. function_locations
82+ & bytecode. function_locations,
83+ last_pc
8384 )
8485 ) ;
8586 if !std_out. is_empty ( ) {
@@ -148,15 +149,15 @@ fn execute_bytecode_helper(
148149 profiling : bool ,
149150 ( poseidons_16_precomputed, poseidons_24_precomputed) : ( & Poseidon16History , & Poseidon24History ) ,
150151 mut merkle_path_hints : VecDeque < Vec < [ F ; 8 ] > > ,
151- ) -> Result < ExecutionResult , RunnerError > {
152+ ) -> Result < ExecutionResult , ( CodeAddress , RunnerError ) > {
152153 // set public memory
153154 let mut memory = Memory :: new ( build_public_memory ( public_input) ) ;
154155
155156 let public_memory_size = ( NONRESERVED_PROGRAM_INPUT_START + public_input. len ( ) ) . next_power_of_two ( ) ;
156157 let mut fp = public_memory_size;
157158
158159 for ( i, value) in private_input. iter ( ) . enumerate ( ) {
159- memory. set ( fp + i, * value) ? ;
160+ memory. set ( fp + i, * value) . expect ( "to set private input in memory" ) ;
160161 }
161162
162163 let mut mem_profile = MemoryProfile {
@@ -200,7 +201,7 @@ fn execute_bytecode_helper(
200201
201202 while pc != ENDING_PC {
202203 if pc >= bytecode. instructions . len ( ) {
203- return Err ( RunnerError :: PCOutOfBounds ) ;
204+ return Err ( ( pc , RunnerError :: PCOutOfBounds ) ) ;
204205 }
205206
206207 pcs. push ( pc) ;
@@ -227,7 +228,7 @@ fn execute_bytecode_helper(
227228 profiling,
228229 memory_profile : & mut mem_profile,
229230 } ;
230- hint. execute_hint ( & mut hint_ctx) ?;
231+ hint. execute_hint ( & mut hint_ctx) . map_err ( |e| ( pc , e ) ) ?;
231232 }
232233
233234 let instruction = & bytecode. instructions [ pc] ;
@@ -247,7 +248,9 @@ fn execute_bytecode_helper(
247248 n_poseidon16_precomputed_used : & mut n_poseidon16_precomputed_used,
248249 n_poseidon24_precomputed_used : & mut n_poseidon24_precomputed_used,
249250 } ;
250- instruction. execute_instruction ( & mut instruction_ctx) ?;
251+ instruction
252+ . execute_instruction ( & mut instruction_ctx)
253+ . map_err ( |e| ( pc, e) ) ?;
251254 }
252255
253256 assert_eq ! (
0 commit comments