Skip to content

Commit 6c917cb

Browse files
[3.14] gh-91048: Correct Apple platform includes for iOS. (GH-134712) (#134714)
Correct Apple platform includes for iOS. (cherry picked from commit 965662e) Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent da3d554 commit 6c917cb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Python/remote_debug.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
# include <sys/mman.h>
3636
#endif
3737

38-
#if defined(__APPLE__) && TARGET_OS_OSX
38+
#if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
3939
# include <libproc.h>
4040
# include <mach-o/fat.h>
4141
# include <mach-o/loader.h>
@@ -100,7 +100,7 @@ typedef struct page_cache_entry {
100100
// Define a platform-independent process handle structure
101101
typedef struct {
102102
pid_t pid;
103-
#if defined(__APPLE__)
103+
#if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
104104
mach_port_t task;
105105
#elif defined(MS_WINDOWS)
106106
HANDLE hProcess;
@@ -127,15 +127,15 @@ _Py_RemoteDebug_ClearCache(proc_handle_t *handle)
127127
}
128128
}
129129

130-
#if defined(__APPLE__) && TARGET_OS_OSX
130+
#if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
131131
static mach_port_t pid_to_task(pid_t pid);
132132
#endif
133133

134134
// Initialize the process handle
135135
static int
136136
_Py_RemoteDebug_InitProcHandle(proc_handle_t *handle, pid_t pid) {
137137
handle->pid = pid;
138-
#if defined(__APPLE__)
138+
#if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
139139
handle->task = pid_to_task(handle->pid);
140140
#elif defined(MS_WINDOWS)
141141
handle->hProcess = OpenProcess(
@@ -167,7 +167,7 @@ _Py_RemoteDebug_CleanupProcHandle(proc_handle_t *handle) {
167167
_Py_RemoteDebug_FreePageCache(handle);
168168
}
169169

170-
#if defined(__APPLE__) && TARGET_OS_OSX
170+
#if defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
171171

172172
static uintptr_t
173173
return_section_address64(
@@ -481,7 +481,7 @@ search_map_for_section(proc_handle_t *handle, const char* secname, const char* s
481481
return 0;
482482
}
483483

484-
#endif // (__APPLE__ && TARGET_OS_OSX)
484+
#endif // (__APPLE__ && defined(TARGET_OS_OSX) && TARGET_OS_OSX)
485485

486486
#if defined(__linux__) && HAVE_PROCESS_VM_READV
487487
static uintptr_t
@@ -759,7 +759,7 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
759759
PyErr_SetString(PyExc_RuntimeError, "Failed to find the PyRuntime section in the process.");
760760
_PyErr_ChainExceptions1(exc);
761761
}
762-
#elif defined(__APPLE__) && TARGET_OS_OSX
762+
#elif defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
763763
// On macOS, try libpython first, then fall back to python
764764
address = search_map_for_section(handle, "PyRuntime", "libpython");
765765
if (address == 0) {
@@ -810,7 +810,7 @@ _Py_RemoteDebug_ReadRemoteMemory(proc_handle_t *handle, uintptr_t remote_address
810810
result += read_bytes;
811811
} while ((size_t)read_bytes != local[0].iov_len);
812812
return 0;
813-
#elif defined(__APPLE__) && TARGET_OS_OSX
813+
#elif defined(__APPLE__) && defined(TARGET_OS_OSX) && TARGET_OS_OSX
814814
Py_ssize_t result = -1;
815815
kern_return_t kr = mach_vm_read_overwrite(
816816
handle->task,

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