@@ -35,7 +35,7 @@ extern "C" {
35
35
# include <sys/mman.h>
36
36
#endif
37
37
38
- #if defined(__APPLE__ ) && TARGET_OS_OSX
38
+ #if defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
39
39
# include <libproc.h>
40
40
# include <mach-o/fat.h>
41
41
# include <mach-o/loader.h>
@@ -100,7 +100,7 @@ typedef struct page_cache_entry {
100
100
// Define a platform-independent process handle structure
101
101
typedef struct {
102
102
pid_t pid ;
103
- #if defined(__APPLE__ )
103
+ #if defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
104
104
mach_port_t task ;
105
105
#elif defined(MS_WINDOWS )
106
106
HANDLE hProcess ;
@@ -127,15 +127,15 @@ _Py_RemoteDebug_ClearCache(proc_handle_t *handle)
127
127
}
128
128
}
129
129
130
- #if defined(__APPLE__ ) && TARGET_OS_OSX
130
+ #if defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
131
131
static mach_port_t pid_to_task (pid_t pid );
132
132
#endif
133
133
134
134
// Initialize the process handle
135
135
static int
136
136
_Py_RemoteDebug_InitProcHandle (proc_handle_t * handle , pid_t pid ) {
137
137
handle -> pid = pid ;
138
- #if defined(__APPLE__ )
138
+ #if defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
139
139
handle -> task = pid_to_task (handle -> pid );
140
140
#elif defined(MS_WINDOWS )
141
141
handle -> hProcess = OpenProcess (
@@ -167,7 +167,7 @@ _Py_RemoteDebug_CleanupProcHandle(proc_handle_t *handle) {
167
167
_Py_RemoteDebug_FreePageCache (handle );
168
168
}
169
169
170
- #if defined(__APPLE__ ) && TARGET_OS_OSX
170
+ #if defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
171
171
172
172
static uintptr_t
173
173
return_section_address64 (
@@ -481,7 +481,7 @@ search_map_for_section(proc_handle_t *handle, const char* secname, const char* s
481
481
return 0 ;
482
482
}
483
483
484
- #endif // (__APPLE__ && TARGET_OS_OSX)
484
+ #endif // (__APPLE__ && defined(TARGET_OS_OSX) && TARGET_OS_OSX)
485
485
486
486
#if defined(__linux__ ) && HAVE_PROCESS_VM_READV
487
487
static uintptr_t
@@ -759,7 +759,7 @@ _Py_RemoteDebug_GetPyRuntimeAddress(proc_handle_t* handle)
759
759
PyErr_SetString (PyExc_RuntimeError , "Failed to find the PyRuntime section in the process." );
760
760
_PyErr_ChainExceptions1 (exc );
761
761
}
762
- #elif defined(__APPLE__ ) && TARGET_OS_OSX
762
+ #elif defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
763
763
// On macOS, try libpython first, then fall back to python
764
764
address = search_map_for_section (handle , "PyRuntime" , "libpython" );
765
765
if (address == 0 ) {
@@ -810,7 +810,7 @@ _Py_RemoteDebug_ReadRemoteMemory(proc_handle_t *handle, uintptr_t remote_address
810
810
result += read_bytes ;
811
811
} while ((size_t )read_bytes != local [0 ].iov_len );
812
812
return 0 ;
813
- #elif defined(__APPLE__ ) && TARGET_OS_OSX
813
+ #elif defined(__APPLE__ ) && defined( TARGET_OS_OSX ) && TARGET_OS_OSX
814
814
Py_ssize_t result = -1 ;
815
815
kern_return_t kr = mach_vm_read_overwrite (
816
816
handle -> task ,
0 commit comments