diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 21:42:40 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 21:42:40 +0000 |
commit | 74a890ce848a7a9e8cfd9812a35b8ddd90f12983 (patch) | |
tree | 18e024e9674e52484cb626087f8767e1a0197df8 /content/browser/utility_process_host_impl.cc | |
parent | 117413e05a8d7bb2695902e0797b9cf9936f00e9 (diff) | |
download | chromium_src-74a890ce848a7a9e8cfd9812a35b8ddd90f12983.zip chromium_src-74a890ce848a7a9e8cfd9812a35b8ddd90f12983.tar.gz chromium_src-74a890ce848a7a9e8cfd9812a35b8ddd90f12983.tar.bz2 |
Posix: Fix --utility-cmd-prefix to not run /proc/self/exe.
BUG=148894
Review URL: https://chromiumcodereview.appspot.com/10907210
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/utility_process_host_impl.cc')
-rw-r--r-- | content/browser/utility_process_host_impl.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc index 347e6c5..550df75 100644 --- a/content/browser/utility_process_host_impl.cc +++ b/content/browser/utility_process_host_impl.cc @@ -111,7 +111,23 @@ bool UtilityProcessHostImpl::StartProcess() { if (channel_id.empty()) return false; - FilePath exe_path = ChildProcessHost::GetChildPath(child_flags_); + const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); + int child_flags = child_flags_; + +#if defined(OS_POSIX) + bool has_cmd_prefix = browser_command_line.HasSwitch( + switches::kUtilityCmdPrefix); + + // When running under gdb, forking /proc/self/exe ends up forking the gdb + // executable instead of Chromium. It is almost safe to assume that no + // updates will happen while a developer is running with + // |switches::kUtilityCmdPrefix|. See ChildProcessHost::GetChildPath() for + // a similar case with Valgrind. + if (has_cmd_prefix) + child_flags = ChildProcessHost::CHILD_NORMAL; +#endif + + FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); if (exe_path.empty()) { NOTREACHED() << "Unable to get utility process binary name."; return false; @@ -125,7 +141,6 @@ bool UtilityProcessHostImpl::StartProcess() { content::GetContentClient()->browser()->GetApplicationLocale(); cmd_line->AppendSwitchASCII(switches::kLang, locale); - const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); if (browser_command_line.HasSwitch(switches::kChromeFrame)) cmd_line->AppendSwitch(switches::kChromeFrame); if (no_sandbox_ || browser_command_line.HasSwitch(switches::kNoSandbox)) @@ -136,8 +151,6 @@ bool UtilityProcessHostImpl::StartProcess() { #if defined(OS_POSIX) // TODO(port): Sandbox this on Linux. Also, zygote this to work with // Linux updating. - bool has_cmd_prefix = browser_command_line.HasSwitch( - switches::kUtilityCmdPrefix); if (has_cmd_prefix) { // launch the utility child process with some prefix (usually "xterm -e gdb // --args"). |