Skip to content

Commit 17718b0

Browse files
authored
gh-91048: Fix _testexternalinspection.c on FreeBSD (#132945)
1 parent 670b6cc commit 17718b0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Modules/_testexternalinspection.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,23 @@ struct _Py_AsyncioModuleDebugOffsets {
4949
static uintptr_t
5050
_Py_RemoteDebug_GetAsyncioDebugAddress(proc_handle_t* handle)
5151
{
52-
uintptr_t address = 0;
52+
uintptr_t address;
5353

5454
#ifdef MS_WINDOWS
5555
// On Windows, search for asyncio debug in executable or DLL
5656
address = search_windows_map_for_section(handle, "AsyncioD", L"_asyncio");
5757
#elif defined(__linux__)
5858
// On Linux, search for asyncio debug in executable or DLL
5959
address = search_linux_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
60-
#else
60+
#elif defined(__APPLE__) && TARGET_OS_OSX
6161
// On macOS, try libpython first, then fall back to python
6262
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
6363
if (address == 0) {
6464
PyErr_Clear();
6565
address = search_map_for_section(handle, "AsyncioDebug", "_asyncio.cpython");
6666
}
67+
#else
68+
address = 0;
6769
#endif
6870

6971
return address;

Python/remote_debug.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ search_windows_map_for_section(proc_handle_t* handle, const char* secname, const
674674
static uintptr_t
675675
_Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
676676
{
677-
uintptr_t address = 0;
677+
uintptr_t address;
678678

679679
#ifdef MS_WINDOWS
680680
// On Windows, search for 'python' in executable or DLL
@@ -690,14 +690,16 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
690690
// Error out: 'python' substring covers both executable and DLL
691691
PyErr_SetString(PyExc_RuntimeError, "Failed to find the PyRuntime section in the process.");
692692
}
693-
#else
693+
#elif defined(__APPLE__) && TARGET_OS_OSX
694694
// On macOS, try libpython first, then fall back to python
695695
address = search_map_for_section(handle, "PyRuntime", "libpython");
696696
if (address == 0) {
697697
// TODO: Differentiate between not found and error
698698
PyErr_Clear();
699699
address = search_map_for_section(handle, "PyRuntime", "python");
700700
}
701+
#else
702+
address = 0;
701703
#endif
702704

703705
return address;
@@ -790,4 +792,4 @@ _Py_RemoteDebug_ReadDebugOffsets(
790792

791793
#ifdef __cplusplus
792794
}
793-
#endif
795+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy