diff options
author | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 02:12:59 +0000 |
---|---|---|
committer | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 02:12:59 +0000 |
commit | bb4ee2d0dbd93022e7351fe1a65239f087a978a4 (patch) | |
tree | 0004ead657800556ce18f35558db650919d4e60e /components | |
parent | d981c5e59bfbe696dd1699141a100d86e33b673a (diff) | |
download | chromium_src-bb4ee2d0dbd93022e7351fe1a65239f087a978a4.zip chromium_src-bb4ee2d0dbd93022e7351fe1a65239f087a978a4.tar.gz chromium_src-bb4ee2d0dbd93022e7351fe1a65239f087a978a4.tar.bz2 |
Allow multiple NaCl modules to be debugged.
Assigning the first NaCl module to load to port 4014, allowing other to be
dynamic, using a code path currently used for testing.
Expose the port used by each module in the Task Manager UI to make it available
to users debugging NaCl modules.
Follow on changes will add extension api fields to make debuggable modules
discoverable to a web based debugger.
NOTE: The debug stub port on windows is opened at a different layer (inside nacl, only availabled with --disable-sandbox). This will be exposed in a follow on change.
Reviewers:
yoshiki@chromium.org (for task_manager)
pkasting@chromium.org (for browser/ui)
brettw@chromium.org (for content)
noelallen@chromium.org (for nacl)
BUG=328714
TEST=trybots
R=yoshiki@chromium.org,pkasting@chromium.org,brettw@chromium.org,noelallen@chromium.org
Review URL: https://codereview.chromium.org/102073008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/nacl/browser/nacl_process_host.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc index 1f94874..e6e8ef4 100644 --- a/components/nacl/browser/nacl_process_host.cc +++ b/components/nacl/browser/nacl_process_host.cc @@ -667,26 +667,33 @@ void NaClProcessHost::SendMessageToRenderer( } // TCP port we chose for NaCl debug stub. It can be any other number. -static const int kDebugStubPort = 4014; +static const int kInitialDebugStubPort = 4014; #if defined(OS_POSIX) net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); net::SocketDescriptor s = net::kInvalidSocket; - // We allocate currently unused TCP port for debug stub tests. The port - // number is passed to the test via debug stub port listener. - if (nacl_browser->HasGdbDebugStubPortListener()) { - int port; + // We always try to allocate the default port first. If this fails, we then + // allocate any available port. + // On success, if the test system has register a handler + // (GdbDebugStubPortListener), we fire a notification. + int port = kInitialDebugStubPort; + s = net::TCPListenSocket::CreateAndBind("127.0.0.1", port); + if (s == net::kInvalidSocket) { s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port); - if (s != net::kInvalidSocket) { + } + if (s != net::kInvalidSocket) { + if (nacl_browser->HasGdbDebugStubPortListener()) { nacl_browser->FireGdbDebugStubPortOpened(port); } - } else { - s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort); } + // Set debug stub port on the process object. + process_->SetNaClDebugStubPort(port); if (s == net::kInvalidSocket) { LOG(ERROR) << "failed to open socket for debug stub"; return net::kInvalidSocket; + } else { + LOG(WARNING) << "debug stub on port " << port; } if (listen(s, 1)) { LOG(ERROR) << "listen() failed on debug stub socket"; |