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

Side by Side Diff: runtime/bin/dbg_connection.cc

Issue 657213002: Fix issue 20133: do not crash if debug port is illegal. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/dbg_connection.h" 5 #include "bin/dbg_connection.h"
6 #include "bin/dbg_message.h" 6 #include "bin/dbg_message.h"
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "bin/lockers.h" 8 #include "bin/lockers.h"
9 #include "bin/log.h" 9 #include "bin/log.h"
10 #include "bin/socket.h" 10 #include "bin/socket.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // Now setup a listener socket and start a thread which will 324 // Now setup a listener socket and start a thread which will
325 // listen, accept connections from debuggers, read and handle/dispatch 325 // listen, accept connections from debuggers, read and handle/dispatch
326 // debugger commands received on these connections. 326 // debugger commands received on these connections.
327 ASSERT(listener_fd_ == -1); 327 ASSERT(listener_fd_ == -1);
328 OSError *os_error; 328 OSError *os_error;
329 AddressList<SocketAddress>* addresses = 329 AddressList<SocketAddress>* addresses =
330 Socket::LookupAddress(address, -1, &os_error); 330 Socket::LookupAddress(address, -1, &os_error);
331 listener_fd_ = ServerSocket::CreateBindListen( 331 listener_fd_ = ServerSocket::CreateBindListen(
332 addresses->GetAt(0)->addr(), port_number, 1); 332 addresses->GetAt(0)->addr(), port_number, 1);
333 delete addresses; 333 delete addresses;
334 if (listener_fd_ < 0) {
335 fprintf(stderr, "%s", "Could not initialize debug socket\n");
336 fflush(stderr);
337 exit(255);
siva 2014/10/15 22:58:41 This file seems to use FATAL("....") whenever it g
srdjan 2014/10/16 15:47:45 FATAL crashes the VM, I assume it is used for the
338 }
339
334 port_number = Socket::GetPort(listener_fd_); 340 port_number = Socket::GetPort(listener_fd_);
335 DebuggerConnectionImpl::StartHandler(port_number); 341 DebuggerConnectionImpl::StartHandler(port_number);
336 return port_number; 342 return port_number;
337 } 343 }
338 344
339 345
340 void DebuggerConnectionHandler::WaitForConnection() { 346 void DebuggerConnectionHandler::WaitForConnection() {
341 ASSERT(handler_lock_ != NULL); 347 ASSERT(handler_lock_ != NULL);
342 MonitorLocker ml(handler_lock_); 348 MonitorLocker ml(handler_lock_);
343 if (!IsListening()) { 349 if (!IsListening()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 506
501 507
502 bool DebuggerConnectionHandler::IsConnected() { 508 bool DebuggerConnectionHandler::IsConnected() {
503 // TODO(asiva): Support multiple debugger connections. 509 // TODO(asiva): Support multiple debugger connections.
504 // Return true if a connection has been established. 510 // Return true if a connection has been established.
505 return singleton_handler != NULL; 511 return singleton_handler != NULL;
506 } 512 }
507 513
508 } // namespace bin 514 } // namespace bin
509 } // namespace dart 515 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698