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

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

Issue 17846009: Better single stepping in VM debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/vm/dart_entry.cc ('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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 // Set breakpoint at closest location to function entry. 260 // Set breakpoint at closest location to function entry.
261 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function); 261 SourceBreakpoint* SetBreakpointAtEntry(const Function& target_function);
262 SourceBreakpoint* SetBreakpointAtLine(const String& script_url, 262 SourceBreakpoint* SetBreakpointAtLine(const String& script_url,
263 intptr_t line_number); 263 intptr_t line_number);
264 void OneTimeBreakAtEntry(const Function& target_function); 264 void OneTimeBreakAtEntry(const Function& target_function);
265 265
266 void RemoveBreakpoint(intptr_t bp_id); 266 void RemoveBreakpoint(intptr_t bp_id);
267 SourceBreakpoint* GetBreakpointById(intptr_t id); 267 SourceBreakpoint* GetBreakpointById(intptr_t id);
268 268
269 void SetStepOver() { resume_action_ = kStepOver; } 269 void SetStepOver();
270 void SetStepInto() { resume_action_ = kStepInto; } 270 void SetSingleStep();
271 void SetStepOut() { resume_action_ = kStepOut; } 271 void SetStepOut();
272 bool IsStepping() const { return resume_action_ != kContinue; }
272 273
273 void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info); 274 void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info);
274 Dart_ExceptionPauseInfo GetExceptionPauseInfo(); 275 Dart_ExceptionPauseInfo GetExceptionPauseInfo();
275 276
276 void VisitObjectPointers(ObjectPointerVisitor* visitor); 277 void VisitObjectPointers(ObjectPointerVisitor* visitor);
277 278
278 // Called from Runtime when a breakpoint in Dart code is reached. 279 // Called from Runtime when a breakpoint in Dart code is reached.
279 void BreakpointCallback(); 280 void BreakpointCallback();
280 281
281 // Returns true if there is at least one breakpoint set in func. 282 // Returns true if there is at least one breakpoint set in func.
282 // Checks for both user-defined and internal temporary breakpoints. 283 // Checks for both user-defined and internal temporary breakpoints.
283 bool HasBreakpoint(const Function& func); 284 bool HasBreakpoint(const Function& func);
284 285
285 DebuggerStackTrace* StackTrace() const { return stack_trace_; } 286 DebuggerStackTrace* StackTrace();
286 287
287 RawArray* GetInstanceFields(const Instance& obj); 288 RawArray* GetInstanceFields(const Instance& obj);
288 RawArray* GetStaticFields(const Class& cls); 289 RawArray* GetStaticFields(const Class& cls);
289 RawArray* GetLibraryFields(const Library& lib); 290 RawArray* GetLibraryFields(const Library& lib);
290 RawArray* GetGlobalFields(const Library& lib); 291 RawArray* GetGlobalFields(const Library& lib);
291 292
292 intptr_t CacheObject(const Object& obj); 293 intptr_t CacheObject(const Object& obj);
293 RawObject* GetCachedObject(intptr_t obj_id); 294 RawObject* GetCachedObject(intptr_t obj_id);
294 bool IsValidObjectId(intptr_t obj_id); 295 bool IsValidObjectId(intptr_t obj_id);
295 296
296 Dart_Port GetIsolateId() { return isolate_id_; } 297 Dart_Port GetIsolateId() { return isolate_id_; }
297 298
298 static void SetEventHandler(EventHandler* handler); 299 static void SetEventHandler(EventHandler* handler);
299 300
300 // Utility functions. 301 // Utility functions.
301 static const char* QualifiedFunctionName(const Function& func); 302 static const char* QualifiedFunctionName(const Function& func);
302 303
303 RawObject* GetInstanceField(const Class& cls, 304 RawObject* GetInstanceField(const Class& cls,
304 const String& field_name, 305 const String& field_name,
305 const Instance& object); 306 const Instance& object);
306 RawObject* GetStaticField(const Class& cls, 307 RawObject* GetStaticField(const Class& cls,
307 const String& field_name); 308 const String& field_name);
308 309
309 void SignalBpReached(); 310 void SignalBpReached();
311 void SingleStepCallback();
312
310 void SignalExceptionThrown(const Instance& exc); 313 void SignalExceptionThrown(const Instance& exc);
311 static void SignalIsolateEvent(EventType type); 314 static void SignalIsolateEvent(EventType type);
312 315
313 uword GetPatchedStubAddress(uword breakpoint_address); 316 uword GetPatchedStubAddress(uword breakpoint_address);
314 317
315 private: 318 private:
316 enum ResumeAction { 319 enum ResumeAction {
317 kContinue, 320 kContinue,
318 kStepOver, 321 kStepOver,
319 kStepInto, 322 kStepOut,
320 kStepOut 323 kSingleStep
321 }; 324 };
322 325
323 intptr_t ResolveBreakpointPos(const Function& func, 326 intptr_t ResolveBreakpointPos(const Function& func,
324 intptr_t first_token_pos, 327 intptr_t first_token_pos,
325 intptr_t last_token_pos); 328 intptr_t last_token_pos);
326 void DeoptimizeWorld(); 329 void DeoptimizeWorld();
327 void InstrumentForStepping(const Function& target_function); 330 void InstrumentForStepping(const Function& target_function);
328 SourceBreakpoint* SetBreakpoint(const Function& target_function, 331 SourceBreakpoint* SetBreakpoint(const Function& target_function,
329 intptr_t first_token_pos, 332 intptr_t first_token_pos,
330 intptr_t last_token_pos); 333 intptr_t last_token_pos);
331 void RemoveInternalBreakpoints(); 334 void RemoveInternalBreakpoints();
332 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt); 335 void UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt);
333 void RegisterSourceBreakpoint(SourceBreakpoint* bpt); 336 void RegisterSourceBreakpoint(SourceBreakpoint* bpt);
334 void RegisterCodeBreakpoint(CodeBreakpoint* bpt); 337 void RegisterCodeBreakpoint(CodeBreakpoint* bpt);
335 SourceBreakpoint* GetSourceBreakpoint(const Function& func, 338 SourceBreakpoint* GetSourceBreakpoint(const Function& func,
336 intptr_t token_pos); 339 intptr_t token_pos);
337 void MakeCodeBreakpointsAt(const Function& func, 340 void MakeCodeBreakpointsAt(const Function& func,
338 intptr_t token_pos, 341 intptr_t token_pos,
339 SourceBreakpoint* bpt); 342 SourceBreakpoint* bpt);
340 // Returns NULL if no breakpoint exists for the given address. 343 // Returns NULL if no breakpoint exists for the given address.
341 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address); 344 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
342 345
343 void SyncBreakpoint(SourceBreakpoint* bpt); 346 void SyncBreakpoint(SourceBreakpoint* bpt);
344 347
348 ActivationFrame* TopDartFrame() const;
345 static DebuggerStackTrace* CollectStackTrace(); 349 static DebuggerStackTrace* CollectStackTrace();
346 void SignalBpResolved(SourceBreakpoint *bpt); 350 void SignalBpResolved(SourceBreakpoint *bpt);
351 void SignalPausedEvent(ActivationFrame* top_frame);
347 352
348 bool IsDebuggable(const Function& func); 353 bool IsDebuggable(const Function& func);
349 354
350 intptr_t nextId() { return next_id_++; } 355 intptr_t nextId() { return next_id_++; }
351 356
352 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace, 357 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace,
353 const Instance& exc); 358 const Instance& exc);
354 359
355 void CollectLibraryFields(const GrowableObjectArray& field_list, 360 void CollectLibraryFields(const GrowableObjectArray& field_list,
356 const Library& lib, 361 const Library& lib,
(...skipping 16 matching lines...) Expand all
373 CodeBreakpoint* code_breakpoints_; 378 CodeBreakpoint* code_breakpoints_;
374 379
375 // Tells debugger what to do when resuming execution after a breakpoint. 380 // Tells debugger what to do when resuming execution after a breakpoint.
376 ResumeAction resume_action_; 381 ResumeAction resume_action_;
377 382
378 // Do not call back to breakpoint handler if this flag is set. 383 // Do not call back to breakpoint handler if this flag is set.
379 // Effectively this means ignoring breakpoints. Set when Dart code may 384 // Effectively this means ignoring breakpoints. Set when Dart code may
380 // be run as a side effect of getting values of fields. 385 // be run as a side effect of getting values of fields.
381 bool ignore_breakpoints_; 386 bool ignore_breakpoints_;
382 387
388 // True while debugger calls event_handler_. Used to prevent recursive
389 // debugger events.
390 bool in_event_notification_;
391
383 Dart_ExceptionPauseInfo exc_pause_info_; 392 Dart_ExceptionPauseInfo exc_pause_info_;
384 393
385 static BreakpointHandler* bp_handler_;
386 static EventHandler* event_handler_; 394 static EventHandler* event_handler_;
387 395
388 friend class Isolate; 396 friend class Isolate;
389 friend class SourceBreakpoint; 397 friend class SourceBreakpoint;
390 DISALLOW_COPY_AND_ASSIGN(Debugger); 398 DISALLOW_COPY_AND_ASSIGN(Debugger);
391 }; 399 };
392 400
393 401
394 } // namespace dart 402 } // namespace dart
395 403
396 #endif // VM_DEBUGGER_H_ 404 #endif // VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698