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

Unified Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 10928050: Open socket for NaCl GDB debug stub in browser process. (Closed) Base URL: svn://svn.chromium.org/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 | « chrome/browser/nacl_host/nacl_process_host.h ('k') | chrome/common/nacl_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/nacl_host/nacl_process_host.cc
===================================================================
--- chrome/browser/nacl_host/nacl_process_host.cc (revision 156494)
+++ chrome/browser/nacl_host/nacl_process_host.cc (working copy)
@@ -40,6 +40,7 @@
#include "ipc/ipc_switches.h"
#include "native_client/src/shared/imc/nacl_imc.h"
#include "net/base/net_util.h"
+#include "net/base/tcp_listen_socket.h"
#include "ppapi/proxy/ppapi_messages.h"
#if defined(OS_POSIX)
@@ -634,6 +635,21 @@
return true;
}
+// TCP port we chose for NaCl debug stub. It can be any other number.
+static const int kDebugStubPort = 4014;
+
+#if defined(OS_POSIX)
+SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
+ SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1",
+ kDebugStubPort);
+ if (listen(s, 1)) {
+ LOG(ERROR) << "listen() failed on debug stub socket";
+ return net::TCPListenSocket::kInvalidSocket;
+ }
+ return s;
+}
+#endif
+
bool NaClProcessHost::StartNaClExecution() {
NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
@@ -684,6 +700,16 @@
params.handles.push_back(memory_fd);
#endif
+#if defined(OS_POSIX)
+ if (enable_debug_stub_) {
+ SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
+ if (server_bound_socket != net::TCPListenSocket::kInvalidSocket) {
+ params.debug_stub_server_bound_socket =
+ nacl::FileDescriptor(server_bound_socket, true);
+ }
+ }
+#endif
+
process_->Send(new NaClProcessMsg_Start(params));
internal_->sockets_for_sel_ldr.clear();
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.h ('k') | chrome/common/nacl_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698