| OLD | NEW |
| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 #include <stdio.h> // NOLINT | 9 #include <stdio.h> // NOLINT |
| 10 #include <stdlib.h> // NOLINT | 10 #include <stdlib.h> // NOLINT |
| 11 #include <sys/epoll.h> // NOLINT | 11 #include <sys/epoll.h> // NOLINT |
| 12 | 12 |
| 13 #include "bin/dbg_connection.h" | 13 #include "bin/dbg_connection.h" |
| 14 #include "bin/fdutils.h" | 14 #include "bin/fdutils.h" |
| 15 #include "bin/log.h" | 15 #include "bin/log.h" |
| 16 #include "bin/socket.h" | 16 #include "bin/socket.h" |
| 17 | 17 |
| 18 #include "platform/signal_blocker.h" | 18 #include "platform/signal_blocker.h" |
| 19 | 19 |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 namespace bin { | 22 namespace bin { |
| 23 | 23 |
| 24 int DebuggerConnectionImpl::epoll_fd_ = -1; | 24 intptr_t DebuggerConnectionImpl::epoll_fd_ = -1; |
| 25 int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1}; | 25 int DebuggerConnectionImpl::wakeup_fds_[2] = {-1, -1}; |
| 26 | 26 |
| 27 | 27 |
| 28 void DebuggerConnectionImpl::HandleEvent(struct epoll_event* event) { | 28 void DebuggerConnectionImpl::HandleEvent(struct epoll_event* event) { |
| 29 if (event->data.fd == DebuggerConnectionHandler::listener_fd_) { | 29 if (event->data.fd == DebuggerConnectionHandler::listener_fd_) { |
| 30 if (DebuggerConnectionHandler::IsConnected()) { | 30 if (DebuggerConnectionHandler::IsConnected()) { |
| 31 FATAL("Cannot connect to more than one debugger.\n"); | 31 FATAL("Cannot connect to more than one debugger.\n"); |
| 32 } | 32 } |
| 33 int fd = ServerSocket::Accept(event->data.fd); | 33 intptr_t fd = ServerSocket::Accept(event->data.fd); |
| 34 if (fd < 0) { | 34 if (fd < 0) { |
| 35 FATAL("Accepting new debugger connection failed.\n"); | 35 FATAL("Accepting new debugger connection failed.\n"); |
| 36 } | 36 } |
| 37 FDUtils::SetBlocking(fd); | 37 FDUtils::SetBlocking(fd); |
| 38 DebuggerConnectionHandler::AcceptDbgConnection(fd); | 38 DebuggerConnectionHandler::AcceptDbgConnection(fd); |
| 39 // TODO(hausner): add the debugger wire socket fd to the event poll queue | 39 // TODO(hausner): add the debugger wire socket fd to the event poll queue |
| 40 // once we poll the debugger connection. | 40 // once we poll the debugger connection. |
| 41 } else if (event->data.fd == wakeup_fds_[0]) { | 41 } else if (event->data.fd == wakeup_fds_[0]) { |
| 42 // Sync message. Not yet implemented. | 42 // Sync message. Not yet implemented. |
| 43 UNIMPLEMENTED(); | 43 UNIMPLEMENTED(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 | 123 |
| 124 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { | 124 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { |
| 125 return TEMP_FAILURE_RETRY(read(socket, buf, len)); | 125 return TEMP_FAILURE_RETRY(read(socket, buf, len)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace bin | 128 } // namespace bin |
| 129 } // namespace dart | 129 } // namespace dart |
| 130 | 130 |
| 131 #endif // defined(TARGET_OS_ANDROID) | 131 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |