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

Side by Side Diff: mojo/runner/init.cc

Issue 1140553002: Make --wait-for-debugger work for mandoline launcher process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/runner/init.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "base/command_line.h"
9 #include "base/debug/debugger.h"
7 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h"
12 #include "base/strings/string_split.h"
13 #include "base/strings/utf_string_conversions.h"
14 #include "mojo/runner/switches.h"
15
16 #if defined(OS_WIN)
17 #include <windows.h>
18 #endif
8 19
9 namespace mojo { 20 namespace mojo {
10 namespace runner { 21 namespace runner {
11 22
12 void InitializeLogging() { 23 void InitializeLogging() {
13 logging::LoggingSettings settings; 24 logging::LoggingSettings settings;
14 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 25 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
15 logging::InitLogging(settings); 26 logging::InitLogging(settings);
16 // To view log output with IDs and timestamps use "adb logcat -v threadtime". 27 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
17 logging::SetLogItems(false, // Process ID 28 logging::SetLogItems(false, // Process ID
18 false, // Thread ID 29 false, // Thread ID
19 false, // Timestamp 30 false, // Timestamp
20 false); // Tick count 31 false); // Tick count
21 } 32 }
22 33
34 void WaitForDebuggerIfNecessary() {
35 const base::CommandLine* command_line =
36 base::CommandLine::ForCurrentProcess();
37 if (command_line->HasSwitch(switches::kWaitForDebugger)) {
38 std::vector<std::string> apps_to_debug;
39 base::SplitString(
40 command_line->GetSwitchValueASCII(switches::kWaitForDebugger), ',',
41 &apps_to_debug);
42 std::string app = command_line->GetSwitchValueASCII(switches::kApp);
43 if (app.empty())
44 app = "launcher"; // If we're not in a child process look for "launcher".
45 if (apps_to_debug.empty() || ContainsValue(apps_to_debug, app)) {
46 #if defined(OS_WIN)
47 base::string16 appw = base::UTF8ToUTF16(app);
48 MessageBox(NULL, appw.c_str(), appw.c_str(), MB_OK | MB_SETFOREGROUND);
49 #else
50 LOG(ERROR) << app << " waiting for GDB. pid: " << getpid();
51 base::debug::WaitForDebugger(60, true);
52 #endif
53 }
54 }
55 }
56
23 } // namespace runner 57 } // namespace runner
24 } // namespace mojo 58 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/init.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698