@@ -669,12 +669,12 @@ struct jit_descriptor {
669669 uint32_t action_flag ;
670670 struct jit_code_entry * relevant_entry ;
671671 struct jit_code_entry * first_entry ;
672+ PyMutex mutex ;
672673};
673674
674675Py_EXPORTED_SYMBOL volatile struct jit_descriptor __jit_debug_descriptor = {
675676 1 , JIT_NOACTION , NULL , NULL
676677};
677- static PyMutex gdb_jit_mutex = {0 };
678678
679679Py_EXPORTED_SYMBOL void __attribute__((noinline ))
680680__jit_debug_register_code (void )
@@ -862,7 +862,7 @@ gdb_jit_register_code(
862862 entry -> symfile_size = total_size ;
863863 entry -> code_addr = code_addr ;
864864
865- PyMutex_Lock (& gdb_jit_mutex );
865+ PyMutex_Lock (( PyMutex * ) & __jit_debug_descriptor . mutex );
866866 entry -> prev = NULL ;
867867 entry -> next = __jit_debug_descriptor .first_entry ;
868868 if (entry -> next != NULL ) {
@@ -874,7 +874,7 @@ gdb_jit_register_code(
874874 __jit_debug_register_code ();
875875 __jit_debug_descriptor .action_flag = JIT_NOACTION ;
876876 __jit_debug_descriptor .relevant_entry = NULL ;
877- PyMutex_Unlock (& gdb_jit_mutex );
877+ PyMutex_Unlock (( PyMutex * ) & __jit_debug_descriptor . mutex );
878878}
879879#endif // __linux__ && __ELF__
880880
@@ -926,13 +926,13 @@ _PyJitUnwind_GdbUnregisterCode(const void *code_addr)
926926 return ;
927927 }
928928
929- PyMutex_Lock (& gdb_jit_mutex );
929+ PyMutex_Lock (( PyMutex * ) & __jit_debug_descriptor . mutex );
930930 struct jit_code_entry * entry = __jit_debug_descriptor .first_entry ;
931931 while (entry != NULL && entry -> code_addr != code_addr ) {
932932 entry = entry -> next ;
933933 }
934934 if (entry == NULL ) {
935- PyMutex_Unlock (& gdb_jit_mutex );
935+ PyMutex_Unlock (( PyMutex * ) & __jit_debug_descriptor . mutex );
936936 return ;
937937 }
938938
@@ -951,7 +951,7 @@ _PyJitUnwind_GdbUnregisterCode(const void *code_addr)
951951 __jit_debug_register_code ();
952952 __jit_debug_descriptor .action_flag = JIT_NOACTION ;
953953 __jit_debug_descriptor .relevant_entry = NULL ;
954- PyMutex_Unlock (& gdb_jit_mutex );
954+ PyMutex_Unlock (( PyMutex * ) & __jit_debug_descriptor . mutex );
955955
956956 PyMem_RawFree ((void * )entry -> symfile_addr );
957957 PyMem_RawFree (entry );
0 commit comments