OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * A client object passed to the v8 debugger whose ownership will be taken by | 85 * A client object passed to the v8 debugger whose ownership will be taken by |
86 * it. v8 is always responsible for deleting the object. | 86 * it. v8 is always responsible for deleting the object. |
87 */ | 87 */ |
88 class ClientData { | 88 class ClientData { |
89 public: | 89 public: |
90 virtual ~ClientData() {} | 90 virtual ~ClientData() {} |
91 }; | 91 }; |
92 | 92 |
93 | 93 |
94 /** | 94 /** |
95 * A message object passed to the debug message handler. | |
96 */ | |
97 class Message { | |
98 public: | |
99 /** | |
100 * Check type of message. | |
101 */ | |
102 virtual bool IsEvent() const = 0; | |
103 virtual bool IsResponse() const = 0; | |
104 virtual DebugEvent GetEvent() const = 0; | |
105 | |
106 /** | |
107 * Indicate whether this is a response to a continue command which will | |
108 * start the VM running after this is processed. | |
109 */ | |
110 virtual bool WillStartRunning() const = 0; | |
111 | |
112 /** | |
113 * Access to execution state and event data. Don't store these cross | |
114 * callbacks as their content becomes invalid. These objects are from the | |
115 * debugger event that started the debug message loop. | |
116 */ | |
117 virtual Handle<Object> GetExecutionState() const = 0; | |
118 virtual Handle<Object> GetEventData() const = 0; | |
119 | |
120 /** | |
121 * Get the debugger protocol JSON. | |
122 */ | |
123 virtual Handle<String> GetJSON() const = 0; | |
124 | |
125 /** | |
126 * Get the context active when the debug event happened. Note this is not | |
127 * the current active context as the JavaScript part of the debugger is | |
128 * running in it's own context which is entered at this point. | |
129 */ | |
130 virtual Handle<Context> GetEventContext() const = 0; | |
131 | |
132 /** | |
133 * Client data passed with the corresponding request if any. This is the | |
134 * client_data data value passed into Debug::SendCommand along with the | |
135 * request that led to the message or NULL if the message is an event. The | |
136 * debugger takes ownership of the data and will delete it even if there is | |
137 * no message handler. | |
138 */ | |
139 virtual ClientData* GetClientData() const = 0; | |
140 }; | |
141 | |
142 | |
143 /** | |
144 * Debug event callback function. | 95 * Debug event callback function. |
145 * | 96 * |
146 * \param event the type of the debug event that triggered the callback | 97 * \param event the type of the debug event that triggered the callback |
147 * (enum DebugEvent) | 98 * (enum DebugEvent) |
148 * \param exec_state execution state (JavaScript object) | 99 * \param exec_state execution state (JavaScript object) |
149 * \param event_data event specific data (JavaScript object) | 100 * \param event_data event specific data (JavaScript object) |
150 * \param data value passed by the user to SetDebugEventListener | 101 * \param data value passed by the user to SetDebugEventListener |
151 */ | 102 */ |
152 typedef void (*EventCallback)(DebugEvent event, | 103 typedef void (*EventCallback)(DebugEvent event, |
153 Handle<Object> exec_state, | 104 Handle<Object> exec_state, |
154 Handle<Object> event_data, | 105 Handle<Object> event_data, |
155 Handle<Value> data); | 106 Handle<Value> data); |
156 | 107 |
157 | 108 |
158 /** | 109 /** |
159 * Debug message callback function. | 110 * Debug message callback function. |
160 * | 111 * |
161 * \param message the debug message handler message object | 112 * \param message the debug message |
162 * \param length length of the message | 113 * \param length length of the message |
163 * \param data the data value passed when registering the message handler | 114 * \param data the data value passed when registering the message handler |
164 | 115 * \param client_data the data value passed into Debug::SendCommand along |
| 116 * with the request that led to the message or NULL if the message is an |
| 117 * asynchronous event. The debugger takes ownership of the data and will |
| 118 * delete it before dying even if there is no message handler. |
165 * A MessageHandler does not take posession of the message string, | 119 * A MessageHandler does not take posession of the message string, |
166 * and must not rely on the data persisting after the handler returns. | 120 * and must not rely on the data persisting after the handler returns. |
167 */ | 121 */ |
168 typedef void (*MessageHandler)(const Message& message); | 122 typedef void (*MessageHandler)(const uint16_t* message, int length, |
| 123 ClientData* client_data); |
169 | 124 |
170 /** | 125 /** |
171 * Debug host dispatch callback function. | 126 * Debug host dispatch callback function. |
172 */ | 127 */ |
173 typedef void (*HostDispatchHandler)(); | 128 typedef void (*HostDispatchHandler)(); |
174 | 129 |
175 // Set a C debug event listener. | 130 // Set a C debug event listener. |
176 static bool SetDebugEventListener(EventCallback that, | 131 static bool SetDebugEventListener(EventCallback that, |
177 Handle<Value> data = Handle<Value>()); | 132 Handle<Value> data = Handle<Value>()); |
178 | 133 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 }; | 179 }; |
225 | 180 |
226 | 181 |
227 } // namespace v8 | 182 } // namespace v8 |
228 | 183 |
229 | 184 |
230 #undef EXPORT | 185 #undef EXPORT |
231 | 186 |
232 | 187 |
233 #endif // V8_DEBUG_H_ | 188 #endif // V8_DEBUG_H_ |
OLD | NEW |