@@ -70,15 +70,16 @@ pub fn execute_bytecode(
7070 profiling,
7171 ( poseidons_16_precomputed, poseidons_24_precomputed) ,
7272 )
73- . unwrap_or_else ( |err| {
73+ . unwrap_or_else ( |( last_pc , err) | {
7474 let lines_history = & instruction_history. lines ;
7575 let latest_instructions = & lines_history[ lines_history. len ( ) . saturating_sub ( STACK_TRACE_INSTRUCTIONS ) ..] ;
7676 println ! (
7777 "\n {}" ,
7878 crate :: diagnostics:: pretty_stack_trace(
7979 & bytecode. program,
8080 latest_instructions,
81- & bytecode. function_locations
81+ & bytecode. function_locations,
82+ last_pc
8283 )
8384 ) ;
8485 if !std_out. is_empty ( ) {
@@ -146,15 +147,15 @@ fn execute_bytecode_helper(
146147 no_vec_runtime_memory : usize ,
147148 profiling : bool ,
148149 ( poseidons_16_precomputed, poseidons_24_precomputed) : ( & Poseidon16History , & Poseidon24History ) ,
149- ) -> Result < ExecutionResult , RunnerError > {
150+ ) -> Result < ExecutionResult , ( CodeAddress , RunnerError ) > {
150151 // set public memory
151152 let mut memory = Memory :: new ( build_public_memory ( public_input) ) ;
152153
153154 let public_memory_size = ( NONRESERVED_PROGRAM_INPUT_START + public_input. len ( ) ) . next_power_of_two ( ) ;
154155 let mut fp = public_memory_size;
155156
156157 for ( i, value) in private_input. iter ( ) . enumerate ( ) {
157- memory. set ( fp + i, * value) ? ;
158+ memory. set ( fp + i, * value) . expect ( "to set private input in memory" ) ;
158159 }
159160
160161 let mut mem_profile = MemoryProfile {
@@ -199,7 +200,7 @@ fn execute_bytecode_helper(
199200
200201 while pc != ENDING_PC {
201202 if pc >= bytecode. instructions . len ( ) {
202- return Err ( RunnerError :: PCOutOfBounds ) ;
203+ return Err ( ( pc , RunnerError :: PCOutOfBounds ) ) ;
203204 }
204205
205206 pcs. push ( pc) ;
@@ -225,7 +226,7 @@ fn execute_bytecode_helper(
225226 profiling,
226227 memory_profile : & mut mem_profile,
227228 } ;
228- hint. execute_hint ( & mut hint_ctx) ?;
229+ hint. execute_hint ( & mut hint_ctx) . map_err ( |e| ( pc , e ) ) ?;
229230 }
230231
231232 let instruction = & bytecode. instructions [ pc] ;
@@ -244,7 +245,7 @@ fn execute_bytecode_helper(
244245 n_poseidon16_precomputed_used : & mut n_poseidon16_precomputed_used,
245246 n_poseidon24_precomputed_used : & mut n_poseidon24_precomputed_used,
246247 } ;
247- instruction. execute_instruction ( & mut instruction_ctx) ?;
248+ instruction. execute_instruction ( & mut instruction_ctx) . map_err ( |e| ( pc , e ) ) ?;
248249 }
249250
250251 assert_eq ! (
0 commit comments