| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 *out_addr = addr; | 102 *out_addr = addr; |
| 103 *out_size = info.RegionSize; | 103 *out_size = info.RegionSize; |
| 104 } | 104 } |
| 105 addr += info.RegionSize; | 105 addr += info.RegionSize; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 #ifdef _DLL | 109 #ifdef _DLL |
| 110 | 110 |
| 111 bool IsInPath(const std::string& path_env_var, const std::string& dir) { | 111 bool IsInPath(const std::string& path_env_var, const std::string& dir) { |
| 112 std::vector<std::string> split; | 112 for (const base::StringPiece& cur : base::SplitStringPiece( |
| 113 base::SplitString(path_env_var, ';', &split); | 113 path_env_var, ";", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| 114 for (std::vector<std::string>::const_iterator i(split.begin()); | 114 if (cur == dir) |
| 115 i != split.end(); | |
| 116 ++i) { | |
| 117 if (*i == dir) | |
| 118 return true; | 115 return true; |
| 119 } | 116 } |
| 120 return false; | 117 return false; |
| 121 } | 118 } |
| 122 | 119 |
| 123 #endif // _DLL | 120 #endif // _DLL |
| 124 | 121 |
| 125 } // namespace | 122 } // namespace |
| 126 | 123 |
| 127 // Allocates |size| bytes of address space in the given process at a | 124 // Allocates |size| bytes of address space in the given process at a |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 void NaClProcessHost::LaunchNaClGdb() { | 548 void NaClProcessHost::LaunchNaClGdb() { |
| 552 const base::CommandLine& command_line = | 549 const base::CommandLine& command_line = |
| 553 *base::CommandLine::ForCurrentProcess(); | 550 *base::CommandLine::ForCurrentProcess(); |
| 554 #if defined(OS_WIN) | 551 #if defined(OS_WIN) |
| 555 base::FilePath nacl_gdb = | 552 base::FilePath nacl_gdb = |
| 556 command_line.GetSwitchValuePath(switches::kNaClGdb); | 553 command_line.GetSwitchValuePath(switches::kNaClGdb); |
| 557 base::CommandLine cmd_line(nacl_gdb); | 554 base::CommandLine cmd_line(nacl_gdb); |
| 558 #else | 555 #else |
| 559 base::CommandLine::StringType nacl_gdb = | 556 base::CommandLine::StringType nacl_gdb = |
| 560 command_line.GetSwitchValueNative(switches::kNaClGdb); | 557 command_line.GetSwitchValueNative(switches::kNaClGdb); |
| 561 base::CommandLine::StringVector argv; | |
| 562 // We don't support spaces inside arguments in --nacl-gdb switch. | 558 // We don't support spaces inside arguments in --nacl-gdb switch. |
| 563 base::SplitString(nacl_gdb, static_cast<base::CommandLine::CharType>(' '), | 559 base::CommandLine cmd_line(base::SplitString( |
| 564 &argv); | 560 nacl_gdb, base::CommandLine::StringType(1, ' '), |
| 565 base::CommandLine cmd_line(argv); | 561 base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)); |
| 566 #endif | 562 #endif |
| 567 cmd_line.AppendArg("--eval-command"); | 563 cmd_line.AppendArg("--eval-command"); |
| 568 base::FilePath::StringType irt_path( | 564 base::FilePath::StringType irt_path( |
| 569 NaClBrowser::GetInstance()->GetIrtFilePath().value()); | 565 NaClBrowser::GetInstance()->GetIrtFilePath().value()); |
| 570 // Avoid back slashes because nacl-gdb uses posix escaping rules on Windows. | 566 // Avoid back slashes because nacl-gdb uses posix escaping rules on Windows. |
| 571 // See issue https://code.google.com/p/nativeclient/issues/detail?id=3482. | 567 // See issue https://code.google.com/p/nativeclient/issues/detail?id=3482. |
| 572 std::replace(irt_path.begin(), irt_path.end(), '\\', '/'); | 568 std::replace(irt_path.begin(), irt_path.end(), '\\', '/'); |
| 573 cmd_line.AppendArgNative(FILE_PATH_LITERAL("nacl-irt \"") + irt_path + | 569 cmd_line.AppendArgNative(FILE_PATH_LITERAL("nacl-irt \"") + irt_path + |
| 574 FILE_PATH_LITERAL("\"")); | 570 FILE_PATH_LITERAL("\"")); |
| 575 if (!manifest_path_.empty()) { | 571 if (!manifest_path_.empty()) { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 NaClStartDebugExceptionHandlerThread( | 1385 NaClStartDebugExceptionHandlerThread( |
| 1390 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), | 1386 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), |
| 1391 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1387 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1392 weak_factory_.GetWeakPtr())); | 1388 weak_factory_.GetWeakPtr())); |
| 1393 return true; | 1389 return true; |
| 1394 } | 1390 } |
| 1395 } | 1391 } |
| 1396 #endif | 1392 #endif |
| 1397 | 1393 |
| 1398 } // namespace nacl | 1394 } // namespace nacl |
| OLD | NEW |