diff options
-rw-r--r-- | lldb/source/Target/Target.cpp | 21 |
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)); |