Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1419)

Unified Diff: content/browser/utility_process_host_impl.cc

Issue 10907210: Posix: Fix --utility-cmd-prefix to not run /proc/self/exe. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/utility_process_host_impl.cc
===================================================================
--- content/browser/utility_process_host_impl.cc (revision 156435)
+++ content/browser/utility_process_host_impl.cc (working copy)
@@ -111,7 +111,23 @@
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 @@
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 @@
#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").
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698