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

Side by Side Diff: vm/debugger.h

Issue 11026011: Add isolate event handler setup in order to be able to propagate isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 2 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 | « vm/code_generator.cc ('k') | 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 typedef void BreakpointHandler(SourceBreakpoint* bpt, 205 typedef void BreakpointHandler(SourceBreakpoint* bpt,
206 DebuggerStackTrace* stack); 206 DebuggerStackTrace* stack);
207 207
208 208
209 class Debugger { 209 class Debugger {
210 public: 210 public:
211 enum EventType { 211 enum EventType {
212 kBreakpointReached = 1, 212 kBreakpointReached = 1,
213 kBreakpointResolved = 2, 213 kBreakpointResolved = 2,
214 kExceptionThrown = 3, 214 kExceptionThrown = 3,
215 kIsolateCreated = 4,
216 kIsolateShutdown = 5,
217 kIsolateInterrupted = 6,
215 }; 218 };
216 struct DebuggerEvent { 219 struct DebuggerEvent {
217 EventType type; 220 EventType type;
218 union { 221 union {
219 DebuggerStackTrace* stack_trace; 222 DebuggerStackTrace* stack_trace;
220 SourceBreakpoint* breakpoint; 223 SourceBreakpoint* breakpoint;
221 const Object* exception; 224 const Object* exception;
225 Isolate* isolate;
222 }; 226 };
223 }; 227 };
224 typedef void EventHandler(DebuggerEvent *event); 228 typedef void EventHandler(DebuggerEvent *event);
225 229
226 Debugger(); 230 Debugger();
227 ~Debugger(); 231 ~Debugger();
228 232
229 void Initialize(Isolate* isolate); 233 void Initialize(Isolate* isolate);
230 void Shutdown(); 234 void Shutdown();
231 bool IsActive(); 235 bool IsActive();
232 236
233 void NotifyCompilation(const Function& func); 237 void NotifyCompilation(const Function& func);
234 238
235 void SetEventHandler(EventHandler* handler);
236 void SetBreakpointHandler(BreakpointHandler* handler);
237
238 RawFunction* ResolveFunction(const Library& library, 239 RawFunction* ResolveFunction(const Library& library,
239 const String& class_name, 240 const String& class_name,
240 const String& function_name); 241 const String& function_name);
241 242
242 // Set breakpoint at closest location to function entry. 243 // Set breakpoint at closest location to function entry.
243 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function); 244 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function);
244 SourceBreakpoint* SetBreakpointAtLine(const String& script_url, 245 SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
245 intptr_t line_number); 246 intptr_t line_number);
246 247
247 void RemoveBreakpoint(intptr_t bp_id); 248 void RemoveBreakpoint(intptr_t bp_id);
(...skipping 15 matching lines...) Expand all
263 264
264 RawArray* GetInstanceFields(const Instance& obj); 265 RawArray* GetInstanceFields(const Instance& obj);
265 RawArray* GetStaticFields(const Class& cls); 266 RawArray* GetStaticFields(const Class& cls);
266 RawArray* GetLibraryFields(const Library& lib); 267 RawArray* GetLibraryFields(const Library& lib);
267 RawArray* GetGlobalFields(const Library& lib); 268 RawArray* GetGlobalFields(const Library& lib);
268 269
269 intptr_t CacheObject(const Object& obj); 270 intptr_t CacheObject(const Object& obj);
270 RawObject* GetCachedObject(intptr_t obj_id); 271 RawObject* GetCachedObject(intptr_t obj_id);
271 bool IsValidObjectId(intptr_t obj_id); 272 bool IsValidObjectId(intptr_t obj_id);
272 273
274 static void SetEventHandler(EventHandler* handler);
275 static void SetBreakpointHandler(BreakpointHandler* handler);
276
273 // Utility functions. 277 // Utility functions.
274 static const char* QualifiedFunctionName(const Function& func); 278 static const char* QualifiedFunctionName(const Function& func);
275 279
276 RawObject* GetInstanceField(const Class& cls, 280 RawObject* GetInstanceField(const Class& cls,
277 const String& field_name, 281 const String& field_name,
278 const Instance& object); 282 const Instance& object);
279 RawObject* GetStaticField(const Class& cls, 283 RawObject* GetStaticField(const Class& cls,
280 const String& field_name); 284 const String& field_name);
281 285
282 void SignalBpReached(); 286 void SignalBpReached();
283 void SignalExceptionThrown(const Object& exc); 287 void SignalExceptionThrown(const Object& exc);
288 static void SignalIsolateEvent(EventType type);
284 289
285 private: 290 private:
286 enum ResumeAction { 291 enum ResumeAction {
287 kContinue, 292 kContinue,
288 kStepOver, 293 kStepOver,
289 kStepInto, 294 kStepInto,
290 kStepOut 295 kStepOut
291 }; 296 };
292 297
293 void EnsureFunctionIsDeoptimized(const Function& func); 298 void EnsureFunctionIsDeoptimized(const Function& func);
(...skipping 26 matching lines...) Expand all
320 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, 325 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace,
321 const Object& exc); 326 const Object& exc);
322 327
323 void CollectLibraryFields(const GrowableObjectArray& field_list, 328 void CollectLibraryFields(const GrowableObjectArray& field_list,
324 const Library& lib, 329 const Library& lib,
325 const String& prefix, 330 const String& prefix,
326 bool include_private_fields); 331 bool include_private_fields);
327 332
328 Isolate* isolate_; 333 Isolate* isolate_;
329 bool initialized_; 334 bool initialized_;
330 BreakpointHandler* bp_handler_;
331 EventHandler* event_handler_;
332 335
333 // ID number generator. 336 // ID number generator.
334 intptr_t next_id_; 337 intptr_t next_id_;
335 338
336 // Current stack trace. Valid while executing breakpoint callback code. 339 // Current stack trace. Valid while executing breakpoint callback code.
337 DebuggerStackTrace* stack_trace_; 340 DebuggerStackTrace* stack_trace_;
338 341
339 RemoteObjectCache* obj_cache_; 342 RemoteObjectCache* obj_cache_;
340 343
341 SourceBreakpoint* src_breakpoints_; 344 SourceBreakpoint* src_breakpoints_;
342 CodeBreakpoint* code_breakpoints_; 345 CodeBreakpoint* code_breakpoints_;
343 346
344 // Tells debugger what to do when resuming execution after a breakpoint. 347 // Tells debugger what to do when resuming execution after a breakpoint.
345 ResumeAction resume_action_; 348 ResumeAction resume_action_;
346 349
347 // If >= 0, last_bpt_line contains the line number of the last breakpoint 350 // If >= 0, last_bpt_line contains the line number of the last breakpoint
348 // location for which the breakpoint callback function was called. 351 // location for which the breakpoint callback function was called.
349 intptr_t last_bpt_line_; 352 intptr_t last_bpt_line_;
350 353
351 // Do not call back to breakpoint handler if this flag is set. 354 // Do not call back to breakpoint handler if this flag is set.
352 // Effectively this means ignoring breakpoints. Set when Dart code may 355 // Effectively this means ignoring breakpoints. Set when Dart code may
353 // be run as a side effect of getting values of fields. 356 // be run as a side effect of getting values of fields.
354 bool ignore_breakpoints_; 357 bool ignore_breakpoints_;
355 358
356 intptr_t exc_pause_info_; 359 intptr_t exc_pause_info_;
357 360
361 static BreakpointHandler* bp_handler_;
362 static EventHandler* event_handler_;
363
358 friend class SourceBreakpoint; 364 friend class SourceBreakpoint;
359 DISALLOW_COPY_AND_ASSIGN(Debugger); 365 DISALLOW_COPY_AND_ASSIGN(Debugger);
360 }; 366 };
361 367
362 368
363 } // namespace dart 369 } // namespace dart
364 370
365 #endif // VM_DEBUGGER_H_ 371 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « vm/code_generator.cc ('k') | vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698