OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/runner/init.h" | 5 #include "mojo/runner/init.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 logging::SetLogItems(false, // Process ID | 31 logging::SetLogItems(false, // Process ID |
32 false, // Thread ID | 32 false, // Thread ID |
33 false, // Timestamp | 33 false, // Timestamp |
34 false); // Tick count | 34 false); // Tick count |
35 } | 35 } |
36 | 36 |
37 void WaitForDebuggerIfNecessary() { | 37 void WaitForDebuggerIfNecessary() { |
38 const base::CommandLine* command_line = | 38 const base::CommandLine* command_line = |
39 base::CommandLine::ForCurrentProcess(); | 39 base::CommandLine::ForCurrentProcess(); |
40 if (command_line->HasSwitch(switches::kWaitForDebugger)) { | 40 if (command_line->HasSwitch(switches::kWaitForDebugger)) { |
41 std::vector<std::string> apps_to_debug; | 41 std::vector<std::string> apps_to_debug = base::SplitString( |
42 base::SplitString( | 42 command_line->GetSwitchValueASCII(switches::kWaitForDebugger), ",", |
43 command_line->GetSwitchValueASCII(switches::kWaitForDebugger), ',', | 43 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
44 &apps_to_debug); | |
45 std::string app = "launcher"; | 44 std::string app = "launcher"; |
46 if (command_line->HasSwitch(switches::kChildProcess)) { | 45 if (command_line->HasSwitch(switches::kChildProcess)) { |
47 app = command_line->GetSwitchValuePath(switches::kChildProcess) | 46 app = command_line->GetSwitchValuePath(switches::kChildProcess) |
48 .BaseName() | 47 .BaseName() |
49 .RemoveExtension() | 48 .RemoveExtension() |
50 .MaybeAsASCII(); | 49 .MaybeAsASCII(); |
51 } | 50 } |
52 if (apps_to_debug.empty() || ContainsValue(apps_to_debug, app)) { | 51 if (apps_to_debug.empty() || ContainsValue(apps_to_debug, app)) { |
53 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
54 base::string16 appw = base::UTF8ToUTF16(app); | 53 base::string16 appw = base::UTF8ToUTF16(app); |
55 MessageBox(NULL, appw.c_str(), appw.c_str(), MB_OK | MB_SETFOREGROUND); | 54 MessageBox(NULL, appw.c_str(), appw.c_str(), MB_OK | MB_SETFOREGROUND); |
56 #else | 55 #else |
57 LOG(ERROR) << app << " waiting for GDB. pid: " << getpid(); | 56 LOG(ERROR) << app << " waiting for GDB. pid: " << getpid(); |
58 base::debug::WaitForDebugger(60, true); | 57 base::debug::WaitForDebugger(60, true); |
59 #endif | 58 #endif |
60 } | 59 } |
61 } | 60 } |
62 } | 61 } |
63 | 62 |
64 } // namespace runner | 63 } // namespace runner |
65 } // namespace mojo | 64 } // namespace mojo |
OLD | NEW |