summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2013-09-11 18:23:22 +0000
committerJim Ingham <jingham@apple.com>2013-09-11 18:23:22 +0000
commitd39907935c4cc2e5c85ccef343a020d9d7ef152b (patch)
treecf4e377fdb4f98bf6dc876d3343b50c37d26df5c /lldb/source/Plugins/Platform
parent48c99007132858c5ccb7e3ce13271fae21731f85 (diff)
downloadbcm5719-llvm-d39907935c4cc2e5c85ccef343a020d9d7ef152b.tar.gz
bcm5719-llvm-d39907935c4cc2e5c85ccef343a020d9d7ef152b.zip
Turns out the number of times you need to resume the process for /bin/sh depends on the
setting of the environment variable COMMAND_MODE. Changed the Platform::GetResumeCountForShell to Platform::GetResumeCountForLaunchInfo, and check both the shell and in the case of /bin/sh the environment as well. llvm-svn: 190538
Diffstat (limited to 'lldb/source/Plugins/Platform')
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp2
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp19
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h2
3 files changed, 19 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 42a458442a6..94dcc60bea3 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -415,7 +415,7 @@ PlatformLinux::LaunchProcess (ProcessLaunchInfo &launch_info)
const bool is_localhost = true;
const bool will_debug = launch_info.GetFlags().Test(eLaunchFlagDebug);
const bool first_arg_is_full_shell_command = false;
- uint32_t num_resumes = GetResumeCountForShell (launch_info.GetShell());
+ uint32_t num_resumes = GetResumeCountForLaunchInfo (launch_info);
if (!launch_info.ConvertArgumentsForLaunchingInShell (error,
is_localhost,
will_debug,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 46fe0049050..b5327d5870d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1226,8 +1226,12 @@ PlatformDarwin::GetEnvironment (StringList &env)
}
int32_t
-PlatformDarwin::GetResumeCountForShell (const char *shell)
+PlatformDarwin::GetResumeCountForLaunchInfo (ProcessLaunchInfo &launch_info)
{
+ const char *shell = launch_info.GetShell();
+ if (shell == NULL)
+ return 1;
+
const char *shell_name = strrchr (shell, '/');
if (shell_name == NULL)
shell_name = shell;
@@ -1237,7 +1241,18 @@ PlatformDarwin::GetResumeCountForShell (const char *shell)
if (strcmp (shell_name, "sh") == 0)
{
// /bin/sh re-exec's itself as /bin/bash requiring another resume.
- return 2;
+ // But it only does this if the COMMAND_MODE environment variable
+ // is set to "legacy".
+ char * const *envp = (char * const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector();
+ if (envp != NULL)
+ {
+ for (int i = 0; envp[i] != NULL; i++)
+ {
+ if (strcmp (envp[i], "COMMAND_MODE=legacy" ) == 0)
+ return 2;
+ }
+ }
+ return 1;
}
else if (strcmp (shell_name, "csh") == 0
|| strcmp (shell_name, "tcsh") == 0
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index 6b8f68baee5..4e9b7029b51 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -118,7 +118,7 @@ public:
x86GetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
virtual int32_t
- GetResumeCountForShell (const char *shell);
+ GetResumeCountForLaunchInfo (lldb_private::ProcessLaunchInfo &launch_info);
protected:
virtual lldb_private::Error
OpenPOWER on IntegriCloud