|
9 | 9 | #include "lldb/Host/Host.h"
|
10 | 10 |
|
11 | 11 | #include <AvailabilityMacros.h>
|
| 12 | +#include <TargetConditionals.h> |
12 | 13 |
|
13 |
| -// On device doesn't have supporty for XPC. |
14 |
| -#if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) |
15 |
| -#define NO_XPC_SERVICES 1 |
16 |
| -#endif |
17 |
| - |
18 |
| -#if !defined(NO_XPC_SERVICES) |
| 14 | +#if TARGET_OS_OSX |
19 | 15 | #define __XPC_PRIVATE_H__
|
20 | 16 | #include <xpc/xpc.h>
|
21 | 17 |
|
|
135 | 131 | return false;
|
136 | 132 | }
|
137 | 133 |
|
| 134 | +#if TARGET_OS_OSX |
| 135 | + |
138 | 136 | static void *AcceptPIDFromInferior(void *arg) {
|
139 | 137 | const char *connect_url = (const char *)arg;
|
140 | 138 | ConnectionFileDescriptor file_conn;
|
|
153 | 151 | return NULL;
|
154 | 152 | }
|
155 | 153 |
|
156 |
| -#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) |
157 |
| - |
158 | 154 | const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
|
159 | 155 | " activate\n"
|
160 | 156 | " do script \"/bin/bash -c '%s';exit\"\n"
|
@@ -307,13 +303,13 @@ repeat with the_window in (get windows)\n\
|
307 | 303 | return error;
|
308 | 304 | }
|
309 | 305 |
|
310 |
| -#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) |
| 306 | +#endif // TARGET_OS_OSX |
311 | 307 |
|
312 | 308 | bool Host::OpenFileInExternalEditor(const FileSpec &file_spec,
|
313 | 309 | uint32_t line_no) {
|
314 |
| -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) |
| 310 | +#if !TARGET_OS_OSX |
315 | 311 | return false;
|
316 |
| -#else |
| 312 | +#else // !TARGET_OS_OSX |
317 | 313 | // We attach this to an 'odoc' event to specify a particular selection
|
318 | 314 | typedef struct {
|
319 | 315 | int16_t reserved0; // must be zero
|
@@ -404,7 +400,7 @@ repeat with the_window in (get windows)\n\
|
404 | 400 | }
|
405 | 401 |
|
406 | 402 | return true;
|
407 |
| -#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) |
| 403 | +#endif // TARGET_OS_OSX |
408 | 404 | }
|
409 | 405 |
|
410 | 406 | Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); }
|
@@ -689,7 +685,7 @@ static bool GetMacOSXProcessUserAndGroup(ProcessInstanceInfo &process_info) {
|
689 | 685 | return false;
|
690 | 686 | }
|
691 | 687 |
|
692 |
| -#if !NO_XPC_SERVICES |
| 688 | +#if TARGET_OS_OSX |
693 | 689 | static void PackageXPCArguments(xpc_object_t message, const char *prefix,
|
694 | 690 | const Args &args) {
|
695 | 691 | size_t count = args.GetArgumentCount();
|
@@ -841,7 +837,7 @@ static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info) {
|
841 | 837 | static Status LaunchProcessXPC(const char *exe_path,
|
842 | 838 | ProcessLaunchInfo &launch_info,
|
843 | 839 | lldb::pid_t &pid) {
|
844 |
| -#if !NO_XPC_SERVICES |
| 840 | +#if TARGET_OS_OSX |
845 | 841 | Status error = getXPCAuthorization(launch_info);
|
846 | 842 | if (error.Fail())
|
847 | 843 | return error;
|
@@ -1194,7 +1190,7 @@ static Status LaunchProcessPosixSpawn(const char *exe_path,
|
1194 | 1190 | static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
|
1195 | 1191 | bool result = false;
|
1196 | 1192 |
|
1197 |
| -#if !NO_XPC_SERVICES |
| 1193 | +#if TARGET_OS_OSX |
1198 | 1194 | bool launchingAsRoot = launch_info.GetUserID() == 0;
|
1199 | 1195 | bool currentUserIsRoot = HostInfo::GetEffectiveUserID() == 0;
|
1200 | 1196 |
|
@@ -1226,7 +1222,7 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) {
|
1226 | 1222 | }
|
1227 | 1223 |
|
1228 | 1224 | if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) {
|
1229 |
| -#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) |
| 1225 | +#if TARGET_OS_OSX |
1230 | 1226 | return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(),
|
1231 | 1227 | launch_info);
|
1232 | 1228 | #else
|
|
0 commit comments