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

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

Issue 369023002: Fix debugging module(replace int with intptr_t) so it works on Windows x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | runtime/bin/dbg_connection.cc » ('j') | 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 #ifndef BIN_DBG_CONNECTION_H_ 5 #ifndef BIN_DBG_CONNECTION_H_
6 #define BIN_DBG_CONNECTION_H_ 6 #define BIN_DBG_CONNECTION_H_
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 10
(...skipping 19 matching lines...) Expand all
30 namespace dart { 30 namespace dart {
31 namespace bin { 31 namespace bin {
32 32
33 // Forward declarations. 33 // Forward declarations.
34 class DbgMessage; 34 class DbgMessage;
35 class MessageBuffer; 35 class MessageBuffer;
36 36
37 37
38 class DebuggerConnectionHandler { 38 class DebuggerConnectionHandler {
39 public: 39 public:
40 explicit DebuggerConnectionHandler(int debug_fd); 40 explicit DebuggerConnectionHandler(intptr_t debug_fd);
41 ~DebuggerConnectionHandler(); 41 ~DebuggerConnectionHandler();
42 42
43 // Accessors. 43 // Accessors.
44 int debug_fd() const { return debug_fd_; } 44 intptr_t debug_fd() const { return debug_fd_; }
45 45
46 // Return message id of current debug command message. 46 // Return message id of current debug command message.
47 int MessageId(); 47 int MessageId();
48 48
49 // Starts the native thread which listens for connections from 49 // Starts the native thread which listens for connections from
50 // debugger clients, reads and dispatches debug command messages 50 // debugger clients, reads and dispatches debug command messages
51 // from the client. 51 // from the client.
52 static int StartHandler(const char* address, int port_number); 52 static int StartHandler(const char* address, int port_number);
53 53
54 // Initializes the parts of the debugger which are needed by the vm 54 // Initializes the parts of the debugger which are needed by the vm
55 // service. This function should only be called when StartHandler 55 // service. This function should only be called when StartHandler
56 // is not called. 56 // is not called.
57 static void InitForVmService(); 57 static void InitForVmService();
58 58
59 // Called by Isolates when they need to wait for a connection 59 // Called by Isolates when they need to wait for a connection
60 // from debugger clients. 60 // from debugger clients.
61 static void WaitForConnection(); 61 static void WaitForConnection();
62 62
63 // Sends a reply or an error message to a specific debugger client. 63 // Sends a reply or an error message to a specific debugger client.
64 static void SendMsg(int debug_fd, dart::TextBuffer* msg); 64 static void SendMsg(intptr_t debug_fd, dart::TextBuffer* msg);
65 static void SendError(int debug_fd, int msg_id, const char* err_msg); 65 static void SendError(intptr_t debug_fd, int msg_id, const char* err_msg);
66 66
67 // Sends an event message to all debugger clients that are connected. 67 // Sends an event message to all debugger clients that are connected.
68 static void BroadcastMsg(dart::TextBuffer* msg); 68 static void BroadcastMsg(dart::TextBuffer* msg);
69 69
70 private: 70 private:
71 void HandleUnknownMsg(); 71 void HandleUnknownMsg();
72 void HandleMessages(); 72 void HandleMessages();
73 73
74 void CloseDbgConnection(); 74 void CloseDbgConnection();
75 75
76 // The socket that connects with the debugger client. 76 // The socket that connects with the debugger client.
77 // The descriptor is created and closed by the debugger connection thread. 77 // The descriptor is created and closed by the debugger connection thread.
78 int debug_fd_; 78 intptr_t debug_fd_;
79 79
80 // Buffer holding the messages received over the wire from the debugger 80 // Buffer holding the messages received over the wire from the debugger
81 // front end.. 81 // front end..
82 MessageBuffer* msgbuf_; 82 MessageBuffer* msgbuf_;
83 83
84 // Accepts connection requests from debugger client and sets up a 84 // Accepts connection requests from debugger client and sets up a
85 // connection handler object to read and handle messages from the client. 85 // connection handler object to read and handle messages from the client.
86 static void AcceptDbgConnection(int debug_fd); 86 static void AcceptDbgConnection(intptr_t debug_fd);
87 87
88 // Handlers for generic debug command messages which are not specific to 88 // Handlers for generic debug command messages which are not specific to
89 // an isolate. 89 // an isolate.
90 static void HandleInterruptCmd(DbgMessage* msg); 90 static void HandleInterruptCmd(DbgMessage* msg);
91 static void HandleIsolatesListCmd(DbgMessage* msg); 91 static void HandleIsolatesListCmd(DbgMessage* msg);
92 92
93 // Helper methods to manage debugger client connections. 93 // Helper methods to manage debugger client connections.
94 static void AddNewDebuggerConnection(int debug_fd); 94 static void AddNewDebuggerConnection(intptr_t debug_fd);
95 static void RemoveDebuggerConnection(int debug_fd); 95 static void RemoveDebuggerConnection(intptr_t debug_fd);
96 static DebuggerConnectionHandler* GetDebuggerConnectionHandler(int debug_fd); 96 static DebuggerConnectionHandler* GetDebuggerConnectionHandler(
97 intptr_t debug_fd);
97 static bool IsConnected(); 98 static bool IsConnected();
98 99
99 // Helper method for sending messages back to a debugger client. 100 // Helper method for sending messages back to a debugger client.
100 static void SendMsgHelper(int debug_fd, dart::TextBuffer* msg); 101 static void SendMsgHelper(intptr_t debug_fd, dart::TextBuffer* msg);
101 102
102 // mutex/condition variable used by isolates when writing back to the 103 // mutex/condition variable used by isolates when writing back to the
103 // debugger. This is also used to ensure that the isolate waits for 104 // debugger. This is also used to ensure that the isolate waits for
104 // a debugger to be attached when that is requested on the command line. 105 // a debugger to be attached when that is requested on the command line.
105 static dart::Monitor* handler_lock_; 106 static dart::Monitor* handler_lock_;
106 107
107 static bool IsListening() { 108 static bool IsListening() {
108 return listener_fd_ != -1; 109 return listener_fd_ != -1;
109 } 110 }
110 111
111 // The socket that is listening for incoming debugger connections. 112 // The socket that is listening for incoming debugger connections.
112 // This descriptor is created and closed by a native thread. 113 // This descriptor is created and closed by a native thread.
113 static int listener_fd_; 114 static intptr_t listener_fd_;
114 115
115 friend class DebuggerConnectionImpl; 116 friend class DebuggerConnectionImpl;
116 117
117 DISALLOW_IMPLICIT_CONSTRUCTORS(DebuggerConnectionHandler); 118 DISALLOW_IMPLICIT_CONSTRUCTORS(DebuggerConnectionHandler);
118 }; 119 };
119 120
120 } // namespace bin 121 } // namespace bin
121 } // namespace dart 122 } // namespace dart
122 123
123 #endif // BIN_DBG_CONNECTION_H_ 124 #endif // BIN_DBG_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dbg_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698