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 #ifndef VM_DEBUGGER_H_ | 5 #ifndef VM_DEBUGGER_H_ |
6 #define VM_DEBUGGER_H_ | 6 #define VM_DEBUGGER_H_ |
7 | 7 |
8 #include "include/dart_debugger_api.h" | 8 #include "include/dart_debugger_api.h" |
9 | 9 |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/port.h" |
11 | 12 |
12 namespace dart { | 13 namespace dart { |
13 | 14 |
14 class SourceBreakpoint; | 15 class SourceBreakpoint; |
15 class CodeBreakpoint; | 16 class CodeBreakpoint; |
16 class Isolate; | 17 class Isolate; |
17 class ObjectPointerVisitor; | 18 class ObjectPointerVisitor; |
18 class ActiveVariables; | 19 class ActiveVariables; |
19 class RemoteObjectCache; | 20 class RemoteObjectCache; |
20 | 21 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 kIsolateCreated = 4, | 216 kIsolateCreated = 4, |
216 kIsolateShutdown = 5, | 217 kIsolateShutdown = 5, |
217 kIsolateInterrupted = 6, | 218 kIsolateInterrupted = 6, |
218 }; | 219 }; |
219 struct DebuggerEvent { | 220 struct DebuggerEvent { |
220 EventType type; | 221 EventType type; |
221 union { | 222 union { |
222 DebuggerStackTrace* stack_trace; | 223 DebuggerStackTrace* stack_trace; |
223 SourceBreakpoint* breakpoint; | 224 SourceBreakpoint* breakpoint; |
224 const Object* exception; | 225 const Object* exception; |
225 Isolate* isolate; | 226 Dart_Port isolate_id; |
226 }; | 227 }; |
227 }; | 228 }; |
228 typedef void EventHandler(DebuggerEvent *event); | 229 typedef void EventHandler(DebuggerEvent *event); |
229 | 230 |
230 Debugger(); | 231 Debugger(); |
231 ~Debugger(); | 232 ~Debugger(); |
232 | 233 |
233 void Initialize(Isolate* isolate); | 234 void Initialize(Isolate* isolate); |
234 void Shutdown(); | 235 void Shutdown(); |
235 bool IsActive(); | 236 bool IsActive(); |
(...skipping 28 matching lines...) Expand all Loading... |
264 | 265 |
265 RawArray* GetInstanceFields(const Instance& obj); | 266 RawArray* GetInstanceFields(const Instance& obj); |
266 RawArray* GetStaticFields(const Class& cls); | 267 RawArray* GetStaticFields(const Class& cls); |
267 RawArray* GetLibraryFields(const Library& lib); | 268 RawArray* GetLibraryFields(const Library& lib); |
268 RawArray* GetGlobalFields(const Library& lib); | 269 RawArray* GetGlobalFields(const Library& lib); |
269 | 270 |
270 intptr_t CacheObject(const Object& obj); | 271 intptr_t CacheObject(const Object& obj); |
271 RawObject* GetCachedObject(intptr_t obj_id); | 272 RawObject* GetCachedObject(intptr_t obj_id); |
272 bool IsValidObjectId(intptr_t obj_id); | 273 bool IsValidObjectId(intptr_t obj_id); |
273 | 274 |
| 275 Dart_Port GetIsolateId() { return isolate_id_; } |
| 276 |
274 static void SetEventHandler(EventHandler* handler); | 277 static void SetEventHandler(EventHandler* handler); |
275 static void SetBreakpointHandler(BreakpointHandler* handler); | 278 static void SetBreakpointHandler(BreakpointHandler* handler); |
276 | 279 |
277 // Utility functions. | 280 // Utility functions. |
278 static const char* QualifiedFunctionName(const Function& func); | 281 static const char* QualifiedFunctionName(const Function& func); |
279 | 282 |
280 RawObject* GetInstanceField(const Class& cls, | 283 RawObject* GetInstanceField(const Class& cls, |
281 const String& field_name, | 284 const String& field_name, |
282 const Instance& object); | 285 const Instance& object); |
283 RawObject* GetStaticField(const Class& cls, | 286 RawObject* GetStaticField(const Class& cls, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 327 |
325 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, | 328 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, |
326 const Object& exc); | 329 const Object& exc); |
327 | 330 |
328 void CollectLibraryFields(const GrowableObjectArray& field_list, | 331 void CollectLibraryFields(const GrowableObjectArray& field_list, |
329 const Library& lib, | 332 const Library& lib, |
330 const String& prefix, | 333 const String& prefix, |
331 bool include_private_fields); | 334 bool include_private_fields); |
332 | 335 |
333 Isolate* isolate_; | 336 Isolate* isolate_; |
| 337 Dart_Port isolate_id_; // A unique ID for the isolate in the debugger. |
334 bool initialized_; | 338 bool initialized_; |
335 | 339 |
336 // ID number generator. | 340 // ID number generator. |
337 intptr_t next_id_; | 341 intptr_t next_id_; |
338 | 342 |
339 // Current stack trace. Valid while executing breakpoint callback code. | 343 // Current stack trace. Valid while executing breakpoint callback code. |
340 DebuggerStackTrace* stack_trace_; | 344 DebuggerStackTrace* stack_trace_; |
341 | 345 |
342 RemoteObjectCache* obj_cache_; | 346 RemoteObjectCache* obj_cache_; |
343 | 347 |
(...skipping 18 matching lines...) Expand all Loading... |
362 static EventHandler* event_handler_; | 366 static EventHandler* event_handler_; |
363 | 367 |
364 friend class SourceBreakpoint; | 368 friend class SourceBreakpoint; |
365 DISALLOW_COPY_AND_ASSIGN(Debugger); | 369 DISALLOW_COPY_AND_ASSIGN(Debugger); |
366 }; | 370 }; |
367 | 371 |
368 | 372 |
369 } // namespace dart | 373 } // namespace dart |
370 | 374 |
371 #endif // VM_DEBUGGER_H_ | 375 #endif // VM_DEBUGGER_H_ |
OLD | NEW |