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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 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
« no previous file with comments | « runtime/vm/datastream.h ('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 RUNTIME_VM_DEBUGGER_H_ 5 #ifndef RUNTIME_VM_DEBUGGER_H_
6 #define RUNTIME_VM_DEBUGGER_H_ 6 #define RUNTIME_VM_DEBUGGER_H_
7 7
8 #include "include/dart_tools_api.h" 8 #include "include/dart_tools_api.h"
9 9
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/port.h" 11 #include "vm/port.h"
12 #include "vm/service_event.h" 12 #include "vm/service_event.h"
13 13
14 DECLARE_FLAG(bool, verbose_debug); 14 DECLARE_FLAG(bool, verbose_debug);
15 15
16 // 'Trace Debugger' TD_Print. 16 // 'Trace Debugger' TD_Print.
17 #if defined(_MSC_VER) 17 #if defined(_MSC_VER)
18 #define TD_Print(format, ...) \ 18 #define TD_Print(format, ...) \
19 if (FLAG_verbose_debug) Log::Current()->Print(format, __VA_ARGS__) 19 if (FLAG_verbose_debug) Log::Current()->Print(format, __VA_ARGS__)
20 #else 20 #else
21 #define TD_Print(format, ...) \ 21 #define TD_Print(format, ...) \
22 if (FLAG_verbose_debug) Log::Current()->Print(format, ##__VA_ARGS__) 22 if (FLAG_verbose_debug) Log::Current()->Print(format, ##__VA_ARGS__)
23 #endif 23 #endif
24 24
25
26 namespace dart { 25 namespace dart {
27 26
28 class CodeBreakpoint; 27 class CodeBreakpoint;
29 class Isolate; 28 class Isolate;
30 class JSONArray; 29 class JSONArray;
31 class JSONStream; 30 class JSONStream;
32 class ObjectPointerVisitor; 31 class ObjectPointerVisitor;
33 class RemoteObjectCache; 32 class RemoteObjectCache;
34 class BreakpointLocation; 33 class BreakpointLocation;
35 class StackFrame; 34 class StackFrame;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ConditionKind kind_; 95 ConditionKind kind_;
97 Breakpoint* next_; 96 Breakpoint* next_;
98 RawInstance* closure_; 97 RawInstance* closure_;
99 BreakpointLocation* bpt_location_; 98 BreakpointLocation* bpt_location_;
100 bool is_synthetic_async_; 99 bool is_synthetic_async_;
101 100
102 friend class BreakpointLocation; 101 friend class BreakpointLocation;
103 DISALLOW_COPY_AND_ASSIGN(Breakpoint); 102 DISALLOW_COPY_AND_ASSIGN(Breakpoint);
104 }; 103 };
105 104
106
107 // BreakpointLocation represents a collection of breakpoint conditions at the 105 // BreakpointLocation represents a collection of breakpoint conditions at the
108 // same token position in Dart source. There may be more than one CodeBreakpoint 106 // same token position in Dart source. There may be more than one CodeBreakpoint
109 // object per BreakpointLocation. 107 // object per BreakpointLocation.
110 // An unresolved breakpoint is one where the underlying code has not 108 // An unresolved breakpoint is one where the underlying code has not
111 // been compiled yet. Since the code has not been compiled, we don't know 109 // been compiled yet. Since the code has not been compiled, we don't know
112 // the definitive source location yet. The requested source location may 110 // the definitive source location yet. The requested source location may
113 // change when the underlying code gets compiled. 111 // change when the underlying code gets compiled.
114 // A latent breakpoint represents a breakpoint location in Dart source 112 // A latent breakpoint represents a breakpoint location in Dart source
115 // that is not loaded in the VM when the breakpoint is requested. 113 // that is not loaded in the VM when the breakpoint is requested.
116 // When a script with matching url is loaded, a latent breakpoint 114 // When a script with matching url is loaded, a latent breakpoint
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 180
183 // Valid for resolved breakpoints: 181 // Valid for resolved breakpoints:
184 RawFunction* function_; 182 RawFunction* function_;
185 intptr_t line_number_; 183 intptr_t line_number_;
186 intptr_t column_number_; 184 intptr_t column_number_;
187 185
188 friend class Debugger; 186 friend class Debugger;
189 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation); 187 DISALLOW_COPY_AND_ASSIGN(BreakpointLocation);
190 }; 188 };
191 189
192
193 // CodeBreakpoint represents a location in compiled code. There may be 190 // CodeBreakpoint represents a location in compiled code. There may be
194 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a 191 // more than one CodeBreakpoint for one BreakpointLocation, e.g. when a
195 // function gets compiled as a regular function and as a closure. 192 // function gets compiled as a regular function and as a closure.
196 class CodeBreakpoint { 193 class CodeBreakpoint {
197 public: 194 public:
198 CodeBreakpoint(const Code& code, 195 CodeBreakpoint(const Code& code,
199 TokenPosition token_pos, 196 TokenPosition token_pos,
200 uword pc, 197 uword pc,
201 RawPcDescriptors::Kind kind); 198 RawPcDescriptors::Kind kind);
202 ~CodeBreakpoint(); 199 ~CodeBreakpoint();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // DebugBreak. This is an instruction that was replaced. DebugBreak 241 // DebugBreak. This is an instruction that was replaced. DebugBreak
245 // will execute it after the breakpoint. 242 // will execute it after the breakpoint.
246 Instr saved_value_; 243 Instr saved_value_;
247 Instr saved_value_fastsmi_; 244 Instr saved_value_fastsmi_;
248 #endif 245 #endif
249 246
250 friend class Debugger; 247 friend class Debugger;
251 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint); 248 DISALLOW_COPY_AND_ASSIGN(CodeBreakpoint);
252 }; 249 };
253 250
254
255 // ActivationFrame represents one dart function activation frame 251 // ActivationFrame represents one dart function activation frame
256 // on the call stack. 252 // on the call stack.
257 class ActivationFrame : public ZoneAllocated { 253 class ActivationFrame : public ZoneAllocated {
258 public: 254 public:
259 enum Kind { 255 enum Kind {
260 kRegular, 256 kRegular,
261 kAsyncSuspensionMarker, 257 kAsyncSuspensionMarker,
262 kAsyncCausal, 258 kAsyncCausal,
263 kAsyncActivation, 259 kAsyncActivation,
264 }; 260 };
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 bool vars_initialized_; 409 bool vars_initialized_;
414 LocalVarDescriptors& var_descriptors_; 410 LocalVarDescriptors& var_descriptors_;
415 ZoneGrowableArray<intptr_t> desc_indices_; 411 ZoneGrowableArray<intptr_t> desc_indices_;
416 PcDescriptors& pc_desc_; 412 PcDescriptors& pc_desc_;
417 413
418 friend class Debugger; 414 friend class Debugger;
419 friend class DebuggerStackTrace; 415 friend class DebuggerStackTrace;
420 DISALLOW_COPY_AND_ASSIGN(ActivationFrame); 416 DISALLOW_COPY_AND_ASSIGN(ActivationFrame);
421 }; 417 };
422 418
423
424 // Array of function activations on the call stack. 419 // Array of function activations on the call stack.
425 class DebuggerStackTrace : public ZoneAllocated { 420 class DebuggerStackTrace : public ZoneAllocated {
426 public: 421 public:
427 explicit DebuggerStackTrace(int capacity) : trace_(capacity) {} 422 explicit DebuggerStackTrace(int capacity) : trace_(capacity) {}
428 423
429 intptr_t Length() const { return trace_.length(); } 424 intptr_t Length() const { return trace_.length(); }
430 425
431 ActivationFrame* FrameAt(int i) const { return trace_[i]; } 426 ActivationFrame* FrameAt(int i) const { return trace_[i]; }
432 427
433 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const; 428 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const;
434 429
435 private: 430 private:
436 void AddActivation(ActivationFrame* frame); 431 void AddActivation(ActivationFrame* frame);
437 void AddMarker(ActivationFrame::Kind marker); 432 void AddMarker(ActivationFrame::Kind marker);
438 void AddAsyncCausalFrame(uword pc, const Code& code); 433 void AddAsyncCausalFrame(uword pc, const Code& code);
439 434
440 ZoneGrowableArray<ActivationFrame*> trace_; 435 ZoneGrowableArray<ActivationFrame*> trace_;
441 436
442 friend class Debugger; 437 friend class Debugger;
443 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace); 438 DISALLOW_COPY_AND_ASSIGN(DebuggerStackTrace);
444 }; 439 };
445 440
446
447 class Debugger { 441 class Debugger {
448 public: 442 public:
449 enum ResumeAction { 443 enum ResumeAction {
450 kContinue, 444 kContinue,
451 kStepInto, 445 kStepInto,
452 kStepOver, 446 kStepOver,
453 kStepOut, 447 kStepOut,
454 kStepRewind, 448 kStepRewind,
455 kStepOverAsyncSuspension, 449 kStepOverAsyncSuspension,
456 }; 450 };
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 void Pause(ServiceEvent* event); 705 void Pause(ServiceEvent* event);
712 706
713 void HandleSteppingRequest(DebuggerStackTrace* stack_trace, 707 void HandleSteppingRequest(DebuggerStackTrace* stack_trace,
714 bool skip_next_step = false); 708 bool skip_next_step = false);
715 709
716 void CacheStackTraces(DebuggerStackTrace* stack_trace, 710 void CacheStackTraces(DebuggerStackTrace* stack_trace,
717 DebuggerStackTrace* async_causal_stack_trace, 711 DebuggerStackTrace* async_causal_stack_trace,
718 DebuggerStackTrace* awaiter_stack_trace); 712 DebuggerStackTrace* awaiter_stack_trace);
719 void ClearCachedStackTraces(); 713 void ClearCachedStackTraces();
720 714
721
722 // Can we rewind to the indicated frame? 715 // Can we rewind to the indicated frame?
723 bool CanRewindFrame(intptr_t frame_index, const char** error) const; 716 bool CanRewindFrame(intptr_t frame_index, const char** error) const;
724 717
725 void RewindToFrame(intptr_t frame_index); 718 void RewindToFrame(intptr_t frame_index);
726 void RewindToUnoptimizedFrame(StackFrame* frame, const Code& code); 719 void RewindToUnoptimizedFrame(StackFrame* frame, const Code& code);
727 void RewindToOptimizedFrame(StackFrame* frame, 720 void RewindToOptimizedFrame(StackFrame* frame,
728 const Code& code, 721 const Code& code,
729 intptr_t post_deopt_frame_index); 722 intptr_t post_deopt_frame_index);
730 723
731 void ResetSteppingFramePointers(); 724 void ResetSteppingFramePointers();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 784
792 Dart_ExceptionPauseInfo exc_pause_info_; 785 Dart_ExceptionPauseInfo exc_pause_info_;
793 786
794 static EventHandler* event_handler_; 787 static EventHandler* event_handler_;
795 788
796 friend class Isolate; 789 friend class Isolate;
797 friend class BreakpointLocation; 790 friend class BreakpointLocation;
798 DISALLOW_COPY_AND_ASSIGN(Debugger); 791 DISALLOW_COPY_AND_ASSIGN(Debugger);
799 }; 792 };
800 793
801
802 } // namespace dart 794 } // namespace dart
803 795
804 #endif // RUNTIME_VM_DEBUGGER_H_ 796 #endif // RUNTIME_VM_DEBUGGER_H_
OLDNEW
« no previous file with comments | « runtime/vm/datastream.h ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698