@@ -778,7 +778,7 @@ create_task_result(
778
778
PyObject * tn = NULL ;
779
779
char task_obj [async_offsets -> asyncio_task_object .size ];
780
780
uintptr_t coro_addr ;
781
-
781
+
782
782
result = PyList_New (0 );
783
783
if (result == NULL ) {
784
784
goto error ;
@@ -788,7 +788,7 @@ create_task_result(
788
788
if (call_stack == NULL ) {
789
789
goto error ;
790
790
}
791
-
791
+
792
792
if (PyList_Append (result , call_stack )) {
793
793
goto error ;
794
794
}
@@ -802,7 +802,7 @@ create_task_result(
802
802
if (tn == NULL ) {
803
803
goto error ;
804
804
}
805
-
805
+
806
806
if (PyList_Append (result , tn )) {
807
807
goto error ;
808
808
}
@@ -823,7 +823,7 @@ create_task_result(
823
823
if (call_stack == NULL ) {
824
824
goto error ;
825
825
}
826
-
826
+
827
827
if (parse_coro_chain (handle , offsets , async_offsets , coro_addr ,
828
828
call_stack , code_object_cache ) < 0 ) {
829
829
Py_DECREF (call_stack );
@@ -1005,22 +1005,22 @@ setup_async_result_structure(PyObject **result, PyObject **calls)
1005
1005
if (* result == NULL ) {
1006
1006
return -1 ;
1007
1007
}
1008
-
1008
+
1009
1009
* calls = PyList_New (0 );
1010
1010
if (* calls == NULL ) {
1011
1011
Py_DECREF (* result );
1012
1012
* result = NULL ;
1013
1013
return -1 ;
1014
1014
}
1015
-
1015
+
1016
1016
if (PyList_SetItem (* result , 0 , * calls )) { /* steals ref to 'calls' */
1017
1017
Py_DECREF (* calls );
1018
1018
Py_DECREF (* result );
1019
1019
* result = NULL ;
1020
1020
* calls = NULL ;
1021
1021
return -1 ;
1022
1022
}
1023
-
1023
+
1024
1024
return 0 ;
1025
1025
}
1026
1026
@@ -1031,12 +1031,12 @@ add_task_info_to_result(
1031
1031
uintptr_t running_task_addr
1032
1032
) {
1033
1033
PyObject * tn = parse_task_name (
1034
- & self -> handle , & self -> debug_offsets , & self -> async_debug_offsets ,
1034
+ & self -> handle , & self -> debug_offsets , & self -> async_debug_offsets ,
1035
1035
running_task_addr );
1036
1036
if (tn == NULL ) {
1037
1037
return -1 ;
1038
1038
}
1039
-
1039
+
1040
1040
if (PyList_Append (result , tn )) {
1041
1041
Py_DECREF (tn );
1042
1042
return -1 ;
@@ -1047,7 +1047,7 @@ add_task_info_to_result(
1047
1047
if (awaited_by == NULL ) {
1048
1048
return -1 ;
1049
1049
}
1050
-
1050
+
1051
1051
if (PyList_Append (result , awaited_by )) {
1052
1052
Py_DECREF (awaited_by );
1053
1053
return -1 ;
@@ -1100,7 +1100,7 @@ process_single_task_node(
1100
1100
PyTuple_SET_ITEM (result_item , 0 , task_id ); // steals ref
1101
1101
PyTuple_SET_ITEM (result_item , 1 , tn ); // steals ref
1102
1102
PyTuple_SET_ITEM (result_item , 2 , current_awaited_by ); // steals ref
1103
-
1103
+
1104
1104
// References transferred to tuple
1105
1105
task_id = NULL ;
1106
1106
tn = NULL ;
@@ -1305,7 +1305,7 @@ parse_code_object(proc_handle_t *handle,
1305
1305
1306
1306
uintptr_t ip = instruction_pointer ;
1307
1307
ptrdiff_t addrq ;
1308
-
1308
+
1309
1309
#ifdef Py_GIL_DISABLED
1310
1310
// In free threading builds, we need to handle thread-local bytecode (TLBC)
1311
1311
// The instruction pointer might point to TLBC, so we need to calculate the offset
@@ -1314,7 +1314,7 @@ parse_code_object(proc_handle_t *handle,
1314
1314
// Try to read the TLBC array to get the correct bytecode base
1315
1315
uintptr_t tlbc_array_addr = real_address + offsets -> code_object .co_tlbc ;
1316
1316
uintptr_t tlbc_array_ptr ;
1317
-
1317
+
1318
1318
if (read_ptr (handle , tlbc_array_addr , & tlbc_array_ptr ) == 0 && tlbc_array_ptr != 0 ) {
1319
1319
// Read the TLBC array size
1320
1320
Py_ssize_t tlbc_size ;
@@ -1323,7 +1323,7 @@ parse_code_object(proc_handle_t *handle,
1323
1323
for (Py_ssize_t i = 0 ; i < tlbc_size ; i ++ ) {
1324
1324
uintptr_t tlbc_entry_addr = tlbc_array_ptr + sizeof (Py_ssize_t ) + (i * sizeof (void * ));
1325
1325
uintptr_t tlbc_bytecode_addr ;
1326
-
1326
+
1327
1327
if (read_ptr (handle , tlbc_entry_addr , & tlbc_bytecode_addr ) == 0 && tlbc_bytecode_addr != 0 ) {
1328
1328
// Check if IP is within this TLBC range (rough estimate)
1329
1329
if (ip >= tlbc_bytecode_addr && ip < tlbc_bytecode_addr + 0x10000 ) {
@@ -1335,10 +1335,10 @@ parse_code_object(proc_handle_t *handle,
1335
1335
}
1336
1336
}
1337
1337
}
1338
-
1338
+
1339
1339
// Fall back to main bytecode
1340
1340
addrq = (uint16_t * )ip - (uint16_t * )meta -> addr_code_adaptive ;
1341
-
1341
+
1342
1342
found_offset :
1343
1343
(void )tlbc_index ; // Suppress unused parameter warning
1344
1344
#else
@@ -1403,7 +1403,7 @@ process_single_stack_chunk(
1403
1403
) {
1404
1404
// Start with default size assumption
1405
1405
size_t current_size = _PY_DATA_STACK_CHUNK_SIZE ;
1406
-
1406
+
1407
1407
char * this_chunk = PyMem_RawMalloc (current_size );
1408
1408
if (!this_chunk ) {
1409
1409
PyErr_NoMemory ();
@@ -1423,7 +1423,7 @@ process_single_stack_chunk(
1423
1423
PyErr_NoMemory ();
1424
1424
return -1 ;
1425
1425
}
1426
-
1426
+
1427
1427
if (_Py_RemoteDebug_PagedReadRemoteMemory (handle , chunk_addr , actual_size , this_chunk ) < 0 ) {
1428
1428
PyMem_RawFree (this_chunk );
1429
1429
return -1 ;
@@ -1447,7 +1447,7 @@ copy_stack_chunks(proc_handle_t *handle,
1447
1447
StackChunkInfo * chunks = NULL ;
1448
1448
size_t count = 0 ;
1449
1449
size_t max_chunks = 16 ;
1450
-
1450
+
1451
1451
if (read_ptr (handle , tstate_addr + offsets -> thread_state .datastack_chunk , & chunk_addr )) {
1452
1452
return -1 ;
1453
1453
}
@@ -1728,7 +1728,7 @@ find_running_task_and_coro(
1728
1728
) {
1729
1729
* running_task_addr = (uintptr_t )NULL ;
1730
1730
if (find_running_task (
1731
- & self -> handle , self -> runtime_start_address ,
1731
+ & self -> handle , self -> runtime_start_address ,
1732
1732
& self -> debug_offsets , & self -> async_debug_offsets ,
1733
1733
running_task_addr ) < 0 ) {
1734
1734
chain_exceptions (PyExc_RuntimeError , "Failed to find running task" );
@@ -1950,14 +1950,14 @@ append_awaited_by_for_thread(
1950
1950
) {
1951
1951
char task_node [SIZEOF_LLIST_NODE ];
1952
1952
1953
- if (_Py_RemoteDebug_PagedReadRemoteMemory (handle , head_addr ,
1953
+ if (_Py_RemoteDebug_PagedReadRemoteMemory (handle , head_addr ,
1954
1954
sizeof (task_node ), task_node ) < 0 ) {
1955
1955
return -1 ;
1956
1956
}
1957
1957
1958
1958
size_t iteration_count = 0 ;
1959
1959
const size_t MAX_ITERATIONS = 2 << 15 ; // A reasonable upper bound
1960
-
1960
+
1961
1961
while (GET_MEMBER (uintptr_t , task_node , debug_offsets -> llist_node .next ) != head_addr ) {
1962
1962
if (++ iteration_count > MAX_ITERATIONS ) {
1963
1963
PyErr_SetString (PyExc_RuntimeError , "Task list appears corrupted" );
@@ -2069,10 +2069,10 @@ process_frame_chain(
2069
2069
}
2070
2070
2071
2071
// Try chunks first, fallback to direct memory read
2072
- if (parse_frame_from_chunks (handle , & frame , offsets , frame_addr ,
2072
+ if (parse_frame_from_chunks (handle , & frame , offsets , frame_addr ,
2073
2073
& next_frame_addr , chunks , code_object_cache ) < 0 ) {
2074
2074
PyErr_Clear ();
2075
- if (parse_frame_object (handle , & frame , offsets , frame_addr ,
2075
+ if (parse_frame_object (handle , & frame , offsets , frame_addr ,
2076
2076
& next_frame_addr , code_object_cache ) < 0 ) {
2077
2077
return -1 ;
2078
2078
}
@@ -2133,7 +2133,7 @@ unwind_stack_for_thread(
2133
2133
goto error ;
2134
2134
}
2135
2135
2136
- if (process_frame_chain (handle , offsets , frame_addr , & chunks ,
2136
+ if (process_frame_chain (handle , offsets , frame_addr , & chunks ,
2137
2137
code_object_cache , frame_info ) < 0 ) {
2138
2138
goto error ;
2139
2139
}
@@ -2407,13 +2407,13 @@ _remote_debugging_RemoteUnwinder_get_async_stack_trace_impl(RemoteUnwinderObject
2407
2407
2408
2408
PyObject * result = NULL ;
2409
2409
PyObject * calls = NULL ;
2410
-
2410
+
2411
2411
if (setup_async_result_structure (& result , & calls ) < 0 ) {
2412
2412
goto cleanup ;
2413
2413
}
2414
2414
2415
2415
uintptr_t running_task_addr , running_coro_addr , running_task_code_obj ;
2416
- if (find_running_task_and_coro (self , & running_task_addr ,
2416
+ if (find_running_task_and_coro (self , & running_task_addr ,
2417
2417
& running_coro_addr , & running_task_code_obj ) < 0 ) {
2418
2418
goto cleanup ;
2419
2419
}
0 commit comments