mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-91048: Fix _testexternalinspection.c on FreeBSD (#132945)
This commit is contained in:
parent
670b6cc096
commit
17718b0503
2 changed files with 9 additions and 5 deletions
|
@ -49,7 +49,7 @@ struct _Py_AsyncioModuleDebugOffsets {
|
||||||
static uintptr_t
|
static uintptr_t
|
||||||
_Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
|
_Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
|
||||||
{
|
{
|
||||||
uintptr_t address = 0;
|
uintptr_t address;
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
// On Windows, search for asyncio debug in executable or DLL
|
// On Windows, search for asyncio debug in executable or DLL
|
||||||
|
@ -57,13 +57,15 @@ _Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
// On Linux, search for asyncio debug in executable or DLL
|
// On Linux, search for asyncio debug in executable or DLL
|
||||||
address = search_linux_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
address = search_linux_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
||||||
#else
|
#elif defined(__APPLE__) && TARGET_OS_OSX
|
||||||
// On macOS, try libpython first, then fall back to python
|
// On macOS, try libpython first, then fall back to python
|
||||||
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
||||||
if (address == 0) {
|
if (address == 0) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
address = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
|
|
|
@ -674,7 +674,7 @@ search_windows_map_for_section(proc_handle_t* handle, const char* secname, const
|
||||||
static uintptr_t
|
static uintptr_t
|
||||||
_Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
|
_Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
|
||||||
{
|
{
|
||||||
uintptr_t address = 0;
|
uintptr_t address;
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
// On Windows, search for 'python' in executable or DLL
|
// On Windows, search for 'python' in executable or DLL
|
||||||
|
@ -690,7 +690,7 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
|
||||||
// Error out: 'python' substring covers both executable and DLL
|
// Error out: 'python' substring covers both executable and DLL
|
||||||
PyErr_SetString(PyExc_RuntimeError, "Failed to find the PyRuntime section in the process.");
|
PyErr_SetString(PyExc_RuntimeError, "Failed to find the PyRuntime section in the process.");
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(__APPLE__) && TARGET_OS_OSX
|
||||||
// On macOS, try libpython first, then fall back to python
|
// On macOS, try libpython first, then fall back to python
|
||||||
address = search_map_for_section(handle, "PyRuntime", "libpython");
|
address = search_map_for_section(handle, "PyRuntime", "libpython");
|
||||||
if (address == 0) {
|
if (address == 0) {
|
||||||
|
@ -698,6 +698,8 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
address = search_map_for_section(handle, "PyRuntime", "python");
|
address = search_map_for_section(handle, "PyRuntime", "python");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
address = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue