summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHan Ming Ong <hanming@apple.com>2012-12-10 23:02:33 +0000
committerHan Ming Ong <hanming@apple.com>2012-12-10 23:02:33 +0000
commit717c97e884daef690dedfb9a91e5b495afa7d6a5 (patch)
tree5579263d8c5e4ca60679211e2e71895d0668f1c4
parent517fc8b264b50454aea4b1367f2d9d6558908afd (diff)
downloadbcm5719-llvm-717c97e884daef690dedfb9a91e5b495afa7d6a5.tar.gz
bcm5719-llvm-717c97e884daef690dedfb9a91e5b495afa7d6a5.zip
<rdar://problem/12850287>
When there is XPC connection error, we will report it now. llvm-svn: 169787
-rw-r--r--lldb/source/Host/macosx/Host.mm53
1 files changed, 33 insertions, 20 deletions
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index cc7045247c6..0e499597f0a 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -1377,7 +1377,7 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
return error;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS));
-
+
uid_t requested_uid = launch_info.GetUserID();
const char *xpc_service = nil;
bool send_auth = false;
@@ -1394,7 +1394,7 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
}
else
{
- error.SetError(4, eErrorTypeGeneric);
+ error.SetError(3, eErrorTypeGeneric);
error.SetErrorStringWithFormat("Launching root via XPC needs to externalize authorization reference.");
if (log)
{
@@ -1406,7 +1406,7 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
}
else
{
- error.SetError(3, eErrorTypeGeneric);
+ error.SetError(4, eErrorTypeGeneric);
error.SetErrorStringWithFormat("Launching via XPC is only currently available for either the login user or root.");
if (log)
{
@@ -1422,7 +1422,7 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
if (type == XPC_TYPE_ERROR) {
if (event == XPC_ERROR_CONNECTION_INTERRUPTED) {
- // The service has either canceled itself, crashed, or been terminated.
+ // The service has either canceled itself, crashed, or been terminated.
// The XPC connection is still valid and sending a message to it will re-launch the service.
// If the service is state-full, this is the time to initialize the new service.
return;
@@ -1435,12 +1435,12 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
// printf("Unexpected error from service: %s", xpc_dictionary_get_string(event, XPC_ERROR_KEY_DESCRIPTION));
}
- } else {
+ } else {
// printf("Received unexpected event in handler");
}
});
- xpc_connection_set_finalizer_f (conn, xpc_finalizer_t(xpc_release));
+ xpc_connection_set_finalizer_f (conn, xpc_finalizer_t(xpc_release));
xpc_connection_resume (conn);
xpc_object_t message = xpc_dictionary_create (nil, nil, 0);
@@ -1457,24 +1457,36 @@ LaunchProcessXPC (const char *exe_path, ProcessLaunchInfo &launch_info, ::pid_t
xpc_dictionary_set_int64(message, LauncherXPCServicePosixspawnFlagsKey, GetPosixspawnFlags(launch_info));
xpc_object_t reply = xpc_connection_send_message_with_reply_sync(conn, message);
-
- pid = xpc_dictionary_get_int64(reply, LauncherXPCServiceChildPIDKey);
- if (pid == 0)
+ xpc_type_t returnType = xpc_get_type(reply);
+ if (returnType == XPC_TYPE_DICTIONARY)
{
- int errorType = xpc_dictionary_get_int64(reply, LauncherXPCServiceErrorTypeKey);
- int errorCode = xpc_dictionary_get_int64(reply, LauncherXPCServiceCodeTypeKey);
-
- error.SetError(errorCode, eErrorTypeGeneric);
- error.SetErrorStringWithFormat("Problems with launching via XPC. Error type : %i, code : %i", errorType, errorCode);
- if (log)
+ pid = xpc_dictionary_get_int64(reply, LauncherXPCServiceChildPIDKey);
+ if (pid == 0)
{
- error.PutToLog(log.get(), "%s", error.AsCString());
+ int errorType = xpc_dictionary_get_int64(reply, LauncherXPCServiceErrorTypeKey);
+ int errorCode = xpc_dictionary_get_int64(reply, LauncherXPCServiceCodeTypeKey);
+
+ error.SetError(errorCode, eErrorTypeGeneric);
+ error.SetErrorStringWithFormat("Problems with launching via XPC. Error type : %i, code : %i", errorType, errorCode);
+ if (log)
+ {
+ error.PutToLog(log.get(), "%s", error.AsCString());
+ }
+
+ if (authorizationRef)
+ {
+ AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults);
+ authorizationRef = NULL;
+ }
}
-
- if (authorizationRef)
+ }
+ else if (returnType == XPC_TYPE_ERROR)
+ {
+ error.SetError(5, eErrorTypeGeneric);
+ error.SetErrorStringWithFormat("Problems with launching via XPC. XPC error : %s", xpc_dictionary_get_string(reply, XPC_ERROR_KEY_DESCRIPTION));
+ if (log)
{
- AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults);
- authorizationRef = NULL;
+ error.PutToLog(log.get(), "%s", error.AsCString());
}
}
@@ -1658,6 +1670,7 @@ LaunchProcessPosixSpawn (const char *exe_path, ProcessLaunchInfo &launch_info, :
static bool
ShouldLaunchUsingXPC(const char *exe_path, ProcessLaunchInfo &launch_info)
{
+ return true;
bool result = false;
#if !NO_XPC_SERVICES
OpenPOWER on IntegriCloud