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

Side by Side Diff: runtime/vm/debugger.h

Issue 340443006: Add support for asynchronous event notification to the observatory. (Closed) Base URL: https://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 | « runtime/bin/vmservice/server.dart ('k') | runtime/vm/debugger.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 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"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 public: 268 public:
269 enum EventType { 269 enum EventType {
270 kBreakpointReached = 1, 270 kBreakpointReached = 1,
271 kBreakpointResolved = 2, 271 kBreakpointResolved = 2,
272 kExceptionThrown = 3, 272 kExceptionThrown = 3,
273 kIsolateCreated = 4, 273 kIsolateCreated = 4,
274 kIsolateShutdown = 5, 274 kIsolateShutdown = 5,
275 kIsolateInterrupted = 6, 275 kIsolateInterrupted = 6,
276 }; 276 };
277 277
278 explicit DebuggerEvent(EventType event_type) 278 explicit DebuggerEvent(Isolate* isolate, EventType event_type)
279 : type_(event_type), 279 : isolate_(isolate),
280 type_(event_type),
280 top_frame_(NULL), 281 top_frame_(NULL),
281 breakpoint_(NULL), 282 breakpoint_(NULL),
282 exception_(NULL), 283 exception_(NULL) {}
283 isolate_id_(0) {} 284
285 Isolate* isolate() const { return isolate_; }
284 286
285 EventType type() const { return type_; } 287 EventType type() const { return type_; }
286 288
287 ActivationFrame* top_frame() const { 289 ActivationFrame* top_frame() const {
288 ASSERT(type_ == kBreakpointReached); 290 ASSERT(type_ == kBreakpointReached);
289 return top_frame_; 291 return top_frame_;
290 } 292 }
291 void set_top_frame(ActivationFrame* frame) { 293 void set_top_frame(ActivationFrame* frame) {
292 ASSERT(type_ == kBreakpointReached); 294 ASSERT(type_ == kBreakpointReached);
293 top_frame_ = frame; 295 top_frame_ = frame;
(...skipping 11 matching lines...) Expand all
305 const Object* exception() const { 307 const Object* exception() const {
306 ASSERT(type_ == kExceptionThrown); 308 ASSERT(type_ == kExceptionThrown);
307 return exception_; 309 return exception_;
308 } 310 }
309 void set_exception(const Object* exception) { 311 void set_exception(const Object* exception) {
310 ASSERT(type_ == kExceptionThrown); 312 ASSERT(type_ == kExceptionThrown);
311 exception_ = exception; 313 exception_ = exception;
312 } 314 }
313 315
314 Dart_Port isolate_id() const { 316 Dart_Port isolate_id() const {
315 ASSERT(type_ == kIsolateCreated || 317 return isolate_->main_port();
316 type_ == kIsolateShutdown ||
317 type_ == kIsolateInterrupted);
318 return isolate_id_;
319 }
320 void set_isolate_id(Dart_Port isolate_id) {
321 ASSERT(type_ == kIsolateCreated ||
322 type_ == kIsolateShutdown ||
323 type_ == kIsolateInterrupted);
324 isolate_id_ = isolate_id;
325 } 318 }
326 319
327 void PrintJSON(JSONStream* js) const; 320 void PrintJSON(JSONStream* js) const;
328 321
329 static const char* EventTypeToCString(EventType type); 322 static const char* EventTypeToCString(EventType type);
330 323
331 private: 324 private:
325 Isolate* isolate_;
332 EventType type_; 326 EventType type_;
333 ActivationFrame* top_frame_; 327 ActivationFrame* top_frame_;
334 SourceBreakpoint* breakpoint_; 328 SourceBreakpoint* breakpoint_;
335 const Object* exception_; 329 const Object* exception_;
336 Dart_Port isolate_id_;
337 }; 330 };
338 331
339 332
340 class Debugger { 333 class Debugger {
341 public: 334 public:
342 typedef void EventHandler(DebuggerEvent *event); 335 typedef void EventHandler(DebuggerEvent* event);
343 336
344 Debugger(); 337 Debugger();
345 ~Debugger(); 338 ~Debugger();
346 339
347 void Initialize(Isolate* isolate); 340 void Initialize(Isolate* isolate);
348 void Shutdown(); 341 void Shutdown();
349 342
350 void NotifyCompilation(const Function& func); 343 void NotifyCompilation(const Function& func);
351 344
352 RawFunction* ResolveFunction(const Library& library, 345 RawFunction* ResolveFunction(const Library& library,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 static bool IsDebuggable(const Function& func); 433 static bool IsDebuggable(const Function& func);
441 434
442 private: 435 private:
443 enum ResumeAction { 436 enum ResumeAction {
444 kContinue, 437 kContinue,
445 kStepOver, 438 kStepOver,
446 kStepOut, 439 kStepOut,
447 kSingleStep 440 kSingleStep
448 }; 441 };
449 442
443 static bool HasEventHandler();
444 static void InvokeEventHandler(DebuggerEvent* event);
445
450 void FindCompiledFunctions(const Script& script, 446 void FindCompiledFunctions(const Script& script,
451 intptr_t start_pos, 447 intptr_t start_pos,
452 intptr_t end_pos, 448 intptr_t end_pos,
453 GrowableObjectArray* function_list); 449 GrowableObjectArray* function_list);
454 RawFunction* FindBestFit(const Script& script, intptr_t token_pos); 450 RawFunction* FindBestFit(const Script& script, intptr_t token_pos);
455 RawFunction* FindInnermostClosure(const Function& function, 451 RawFunction* FindInnermostClosure(const Function& function,
456 intptr_t token_pos); 452 intptr_t token_pos);
457 intptr_t ResolveBreakpointPos(const Function& func, 453 intptr_t ResolveBreakpointPos(const Function& func,
458 intptr_t requested_token_pos, 454 intptr_t requested_token_pos,
459 intptr_t last_token_pos); 455 intptr_t last_token_pos);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 546
551 friend class Isolate; 547 friend class Isolate;
552 friend class SourceBreakpoint; 548 friend class SourceBreakpoint;
553 DISALLOW_COPY_AND_ASSIGN(Debugger); 549 DISALLOW_COPY_AND_ASSIGN(Debugger);
554 }; 550 };
555 551
556 552
557 } // namespace dart 553 } // namespace dart
558 554
559 #endif // VM_DEBUGGER_H_ 555 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698