[3.14] Fix compiler warnings in remote debugging (#141060) (#141067)
Some checks are pending
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / iOS (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Lint / lint (push) Waiting to run

Fix compiler warnings in remote debugging (#141060)

Example of fixed warnings on 32-bit Windows:

    Python\remote_debugging.c(24,53): warning C4244: 'function':
    conversion from 'uint64_t' to 'uintptr_t', possible loss of data

    Modules\_remote_debugging_module.c(789,44): warning C4244:
    'function': conversion from 'uint64_t' to 'size_t', possible loss
    of data

(cherry picked from commit f458ac01ba)
This commit is contained in:
Victor Stinner 2025-11-05 20:49:39 +01:00 committed by GitHub
parent 8675f55f6a
commit 36e9f672f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 35 deletions

View file

@ -19,7 +19,7 @@ cleanup_proc_handle(proc_handle_t *handle) {
}
static int
read_memory(proc_handle_t *handle, uint64_t remote_address, size_t len, void* dst)
read_memory(proc_handle_t *handle, uintptr_t remote_address, size_t len, void* dst)
{
return _Py_RemoteDebug_ReadRemoteMemory(handle, remote_address, len, dst);
}
@ -235,7 +235,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
int is_remote_debugging_enabled = 0;
if (0 != read_memory(
handle,
interpreter_state_addr + debug_offsets.debugger_support.remote_debugging_enabled,
interpreter_state_addr + (uintptr_t)debug_offsets.debugger_support.remote_debugging_enabled,
sizeof(int),
&is_remote_debugging_enabled))
{
@ -255,7 +255,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
if (tid != 0) {
if (0 != read_memory(
handle,
interpreter_state_addr + debug_offsets.interpreter_state.threads_head,
interpreter_state_addr + (uintptr_t)debug_offsets.interpreter_state.threads_head,
sizeof(void*),
&thread_state_addr))
{
@ -264,7 +264,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
while (thread_state_addr != 0) {
if (0 != read_memory(
handle,
thread_state_addr + debug_offsets.thread_state.native_thread_id,
thread_state_addr + (uintptr_t)debug_offsets.thread_state.native_thread_id,
sizeof(this_tid),
&this_tid))
{
@ -277,7 +277,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
if (0 != read_memory(
handle,
thread_state_addr + debug_offsets.thread_state.next,
thread_state_addr + (uintptr_t)debug_offsets.thread_state.next,
sizeof(void*),
&thread_state_addr))
{
@ -294,7 +294,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
} else {
if (0 != read_memory(
handle,
interpreter_state_addr + debug_offsets.interpreter_state.threads_main,
interpreter_state_addr + (uintptr_t)debug_offsets.interpreter_state.threads_main,
sizeof(void*),
&thread_state_addr))
{
@ -346,7 +346,7 @@ send_exec_to_proc_handle(proc_handle_t *handle, int tid, const char *debugger_sc
uintptr_t eval_breaker;
if (0 != read_memory(
handle,
thread_state_addr + debug_offsets.debugger_support.eval_breaker,
thread_state_addr + (uintptr_t)debug_offsets.debugger_support.eval_breaker,
sizeof(uintptr_t),
&eval_breaker))
{