summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-04-30 20:29:09 +0000
committerGreg Clayton <gclayton@apple.com>2014-04-30 20:29:09 +0000
commit40286e0b6dc48cdfbcc2c54450afb5fc29b95494 (patch)
tree428be49dc244988e89375c2e467a85a91c485e10 /lldb/source/Target
parentbb4928902330a7b89dba608d3aa22868d1b6e033 (diff)
downloadbcm5719-llvm-40286e0b6dc48cdfbcc2c54450afb5fc29b95494.tar.gz
bcm5719-llvm-40286e0b6dc48cdfbcc2c54450afb5fc29b95494.zip
Sometimes when launching through a shell, we can run into cases where the /bin/sh or /usr/bin/arch can crash the process due to security measures. Now we correctly report when a process exited in the process of launching so we can show the reason why it crashed instead of just showing “initial process state wasn't stopped: exited”.
llvm-svn: 207700
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Target.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 33d332318a0..fa1b70f2ef9 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -2434,6 +2434,27 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info)
error = error2;
}
}
+ else if (state == eStateExited)
+ {
+ bool with_shell = launch_info.GetShell();
+ const int exit_status = m_process_sp->GetExitStatus();
+ const char *exit_desc = m_process_sp->GetExitDescription();
+#define LAUNCH_SHELL_MESSAGE "\n'r' and 'run' are aliases that default to launching through a shell.\nTry launching without going through a shell by using 'process launch'."
+ if (exit_desc && exit_desc[0])
+ {
+ if (with_shell)
+ error.SetErrorStringWithFormat ("process exited with status %i (%s)" LAUNCH_SHELL_MESSAGE, exit_status, exit_desc);
+ else
+ error.SetErrorStringWithFormat ("process exited with status %i (%s)", exit_status, exit_desc);
+ }
+ else
+ {
+ if (with_shell)
+ error.SetErrorStringWithFormat ("process exited with status %i" LAUNCH_SHELL_MESSAGE, exit_status);
+ else
+ error.SetErrorStringWithFormat ("process exited with status %i", exit_status);
+ }
+ }
else
{
error.SetErrorStringWithFormat ("initial process state wasn't stopped: %s", StateAsCString(state));
OpenPOWER on IntegriCloud