@@ -195,11 +195,8 @@ parse_frame_buffer(
195195 RemoteUnwinderObject * unwinder ,
196196 PyObject * * result ,
197197 const char * frame ,
198- uintptr_t * address_of_code_object ,
199198 uintptr_t * previous_frame
200199) {
201- * address_of_code_object = 0 ;
202-
203200 * previous_frame = GET_MEMBER (uintptr_t , frame , unwinder -> debug_offsets .interpreter_frame .previous );
204201 uintptr_t code_object = GET_MEMBER_NO_TAG (uintptr_t , frame , unwinder -> debug_offsets .interpreter_frame .executable );
205202 int frame_valid = is_frame_valid (unwinder , (uintptr_t )frame , code_object );
@@ -217,8 +214,6 @@ parse_frame_buffer(
217214 }
218215#endif
219216
220- * address_of_code_object = code_object ;
221-
222217 CodeObjectContext code_ctx = {
223218 .code_addr = code_object ,
224219 .instruction_pointer = instruction_pointer ,
@@ -232,7 +227,6 @@ parse_frame_object(
232227 RemoteUnwinderObject * unwinder ,
233228 PyObject * * result ,
234229 uintptr_t address ,
235- uintptr_t * address_of_code_object ,
236230 uintptr_t * previous_frame
237231) {
238232 char frame [SIZEOF_INTERP_FRAME ];
@@ -249,7 +243,7 @@ parse_frame_object(
249243 STATS_INC (unwinder , memory_reads );
250244 STATS_ADD (unwinder , memory_bytes_read , SIZEOF_INTERP_FRAME );
251245
252- return parse_frame_buffer (unwinder , result , frame , address_of_code_object , previous_frame );
246+ return parse_frame_buffer (unwinder , result , frame , previous_frame );
253247}
254248
255249int
@@ -258,41 +252,16 @@ parse_frame_from_chunks(
258252 PyObject * * result ,
259253 uintptr_t address ,
260254 uintptr_t * previous_frame ,
261- uintptr_t * stackpointer ,
262255 StackChunkList * chunks
263256) {
264- void * frame_ptr = find_frame_in_chunks (chunks , address );
265- if (!frame_ptr ) {
257+ const char * frame = find_frame_in_chunks (chunks , address );
258+ if (!frame ) {
266259 PyErr_Format (PyExc_RuntimeError , "Frame at address 0x%lx not found in stack chunks" , address );
267260 set_exception_cause (unwinder , PyExc_RuntimeError , "Frame not found in stack chunks" );
268261 return -1 ;
269262 }
270263
271- char * frame = (char * )frame_ptr ;
272- * previous_frame = GET_MEMBER (uintptr_t , frame , unwinder -> debug_offsets .interpreter_frame .previous );
273- * stackpointer = GET_MEMBER (uintptr_t , frame , unwinder -> debug_offsets .interpreter_frame .stackpointer );
274- uintptr_t code_object = GET_MEMBER_NO_TAG (uintptr_t , frame_ptr , unwinder -> debug_offsets .interpreter_frame .executable );
275- int frame_valid = is_frame_valid (unwinder , (uintptr_t )frame , code_object );
276- if (frame_valid != 1 ) {
277- return frame_valid ;
278- }
279-
280- uintptr_t instruction_pointer = GET_MEMBER (uintptr_t , frame , unwinder -> debug_offsets .interpreter_frame .instr_ptr );
281-
282- // Get tlbc_index for free threading builds
283- int32_t tlbc_index = 0 ;
284- #ifdef Py_GIL_DISABLED
285- if (unwinder -> debug_offsets .interpreter_frame .tlbc_index != 0 ) {
286- tlbc_index = GET_MEMBER (int32_t , frame , unwinder -> debug_offsets .interpreter_frame .tlbc_index );
287- }
288- #endif
289-
290- CodeObjectContext code_ctx = {
291- .code_addr = code_object ,
292- .instruction_pointer = instruction_pointer ,
293- .tlbc_index = tlbc_index ,
294- };
295- return parse_code_object (unwinder , result , & code_ctx );
264+ return parse_frame_buffer (unwinder , result , frame , previous_frame );
296265}
297266
298267/* ============================================================================
@@ -316,7 +285,6 @@ process_frame_chain(
316285 int parse_result = 0 ;
317286 PyObject * frame = NULL ;
318287 uintptr_t next_frame_addr = 0 ;
319- uintptr_t stackpointer = 0 ;
320288 last_frame_addr = frame_addr ;
321289
322290 if (++ frame_count > MAX_FRAME_CHAIN_DEPTH ) {
@@ -328,28 +296,23 @@ process_frame_chain(
328296
329297 if (ctx -> chunks && ctx -> chunks -> count > 0 ) {
330298 parse_result = parse_frame_from_chunks (
331- unwinder , & frame , frame_addr , & next_frame_addr , & stackpointer , ctx -> chunks );
299+ unwinder , & frame , frame_addr , & next_frame_addr , ctx -> chunks );
332300 if (parse_result == 0 ) {
333301 goto parsed_frame ;
334302 }
335303 PyErr_Clear ();
336304 }
337- {
338- uintptr_t address_of_code_object = 0 ;
339- if (ctx -> prefetch .frame && ctx -> prefetch .frame_addr == frame_addr ) {
340- parse_result = parse_frame_buffer (
341- unwinder , & frame , ctx -> prefetch .frame ,
342- & address_of_code_object , & next_frame_addr );
343- }
344- else {
345- parse_result = parse_frame_object (
346- unwinder , & frame , frame_addr ,
347- & address_of_code_object , & next_frame_addr );
348- }
349- if (parse_result < 0 ) {
350- set_exception_cause (unwinder , PyExc_RuntimeError , "Failed to parse frame object in chain" );
351- return -1 ;
352- }
305+ if (ctx -> prefetch .frame && ctx -> prefetch .frame_addr == frame_addr ) {
306+ parse_result = parse_frame_buffer (
307+ unwinder , & frame , ctx -> prefetch .frame , & next_frame_addr );
308+ }
309+ else {
310+ parse_result = parse_frame_object (
311+ unwinder , & frame , frame_addr , & next_frame_addr );
312+ }
313+ if (parse_result < 0 ) {
314+ set_exception_cause (unwinder , PyExc_RuntimeError , "Failed to parse frame object in chain" );
315+ return -1 ;
353316 }
354317
355318parsed_frame :
@@ -543,17 +506,16 @@ try_full_cache_hit(
543506 }
544507
545508 PyObject * current_frame = NULL ;
546- uintptr_t code_object_addr = 0 ;
547509 uintptr_t previous_frame = 0 ;
548510 int parse_result ;
549511 if (ctx -> prefetch .frame && ctx -> prefetch .frame_addr == ctx -> frame_addr ) {
550512 parse_result = parse_frame_buffer (unwinder , & current_frame ,
551513 ctx -> prefetch .frame ,
552- & code_object_addr , & previous_frame );
514+ & previous_frame );
553515 }
554516 else {
555517 parse_result = parse_frame_object (unwinder , & current_frame , ctx -> frame_addr ,
556- & code_object_addr , & previous_frame );
518+ & previous_frame );
557519 }
558520 if (parse_result < 0 ) {
559521 return -1 ;
0 commit comments