|
| 1 | +#ifndefPy_INTERNAL_REMOTE_DEBUG_H |
| 2 | +#definePy_INTERNAL_REMOTE_DEBUG_H |
| 3 | +#ifdef__cplusplus |
| 4 | +extern"C" { |
| 5 | +#endif |
| 6 | + |
| 7 | +#ifndefPy_BUILD_CORE |
| 8 | +# error "this header requires Py_BUILD_CORE define" |
| 9 | +#endif |
| 10 | + |
| 11 | +#include<stdio.h> |
| 12 | + |
| 13 | +#ifndefMS_WINDOWS |
| 14 | +#include<unistd.h> |
| 15 | +#endif |
| 16 | + |
| 17 | +// Define a platform-independent process handle structure |
| 18 | +typedefstruct { |
| 19 | +pid_tpid; |
| 20 | +#ifdefMS_WINDOWS |
| 21 | +HANDLEhProcess; |
| 22 | +#endif |
| 23 | +}proc_handle_t; |
| 24 | + |
| 25 | +// Initialize a process handle |
| 26 | +PyAPI_FUNC(int)_Py_RemoteDebug_InitProcHandle(proc_handle_t*handle,pid_tpid); |
| 27 | + |
| 28 | +// Cleanup a process handle |
| 29 | +PyAPI_FUNC(void)_Py_RemoteDebug_CleanupProcHandle(proc_handle_t*handle); |
| 30 | + |
| 31 | +// Get the PyRuntime section address from a process |
| 32 | +PyAPI_FUNC(uintptr_t)_Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t*handle); |
| 33 | + |
| 34 | +// Get the PyAsyncioDebug section address from a process |
| 35 | +PyAPI_FUNC(uintptr_t)_Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t*handle); |
| 36 | + |
| 37 | +// Read memory from a remote process |
| 38 | +PyAPI_FUNC(int)_Py_RemoteDebug_ReadRemoteMemory(proc_handle_t*handle,uintptr_tremote_address,size_tlen,void*dst); |
| 39 | + |
| 40 | +// Write memory to a remote process |
| 41 | +PyAPI_FUNC(int)_Py_RemoteDebug_WriteRemoteMemory(proc_handle_t*handle,uintptr_tremote_address,size_tlen,constvoid*src); |
| 42 | + |
| 43 | +// Read debug offsets from a remote process |
| 44 | +PyAPI_FUNC(int)_Py_RemoteDebug_ReadDebugOffsets(proc_handle_t*handle,uintptr_t*runtime_start_address,_Py_DebugOffsets*debug_offsets); |
| 45 | + |
| 46 | +#ifdef__cplusplus |
| 47 | +} |
| 48 | +#endif |
| 49 | +#endif/* !Py_INTERNAL_DEBUG_OFFSETS_H */ |