35 {
36
37class CodeBreakpoint;
38class Isolate;
39class JSONArray;
40class JSONStream;
41class ObjectPointerVisitor;
42class BreakpointLocation;
43class StackFrame;
44
45
46
47
48class Breakpoint {
49 public:
50 Breakpoint(intptr_t id,
51 BreakpointLocation* bpt_location,
52 bool is_single_shot,
53 const Closure& closure)
55 next_(nullptr),
57 bpt_location_(bpt_location),
58 is_single_shot_(is_single_shot) {}
59
60 intptr_t
id()
const {
return id_; }
61 Breakpoint*
next()
const {
return next_; }
62 void set_next(Breakpoint* n) { next_ = n; }
63
64 BreakpointLocation* bpt_location() const { return bpt_location_; }
65 void set_bpt_location(BreakpointLocation* new_bpt_location);
66
67 bool is_single_shot() const { return is_single_shot_; }
68 ClosurePtr
closure()
const {
return closure_; }
69
70 void Enable() {
72 enabled_ = true;
73 }
74
75 void Disable() {
77 enabled_ = false;
78 }
79
81
82 void PrintJSON(JSONStream* stream);
83
84 private:
85 void VisitObjectPointers(ObjectPointerVisitor* visitor);
86
87 intptr_t id_;
88 Breakpoint* next_;
89 ClosurePtr closure_;
90 BreakpointLocation* bpt_location_;
91 bool is_single_shot_;
92 bool enabled_ = false;
93
94 friend class BreakpointLocation;
96};
97
98
99
100
101
102
103
104
105
106
107
108
109class BreakpointLocation {
110 public:
111
112 BreakpointLocation(Debugger* debugger,
113 const GrowableHandlePtrArray<const Script>&
scripts,
114 TokenPosition token_pos,
115 TokenPosition end_token_pos,
116 intptr_t requested_line_number,
117 intptr_t requested_column_number);
118
119 BreakpointLocation(Debugger* debugger,
120 const String& url,
121 intptr_t requested_line_number,
122 intptr_t requested_column_number);
123
124 ~BreakpointLocation();
125
126 TokenPosition token_pos() const { return token_pos_.load(); }
127 intptr_t line_number();
128 TokenPosition end_token_pos() const { return end_token_pos_.load(); }
129
130 ScriptPtr
script()
const {
131 if (scripts_.length() == 0) {
132 return Script::null();
133 }
134 return scripts_.At(0);
135 }
136 StringPtr url() const { return url_; }
137
138 intptr_t requested_line_number() const { return requested_line_number_; }
139 intptr_t requested_column_number() const { return requested_column_number_; }
140
141 void GetCodeLocation(Script* script, TokenPosition* token_pos) const;
142
143 Breakpoint* AddRepeated(Debugger* dbg);
144 Breakpoint* AddSingleShot(Debugger* dbg);
145 Breakpoint* AddBreakpoint(Debugger* dbg,
146 const Closure& closure,
147 bool single_shot);
148
149 bool AnyEnabled() const;
150 bool IsResolved() const { return code_token_pos_.IsReal(); }
151 bool IsLatent() const { return !token_pos().IsReal(); }
152
153 bool EnsureIsResolved(const Function& target_function,
154 TokenPosition exact_token_pos);
155
156 Debugger* debugger() { return debugger_; }
157
158 private:
159 void VisitObjectPointers(ObjectPointerVisitor* visitor);
160
161 void SetResolved(const Function& func, TokenPosition token_pos);
162
163 BreakpointLocation*
next()
const {
return this->next_; }
164 void set_next(BreakpointLocation* value) { next_ =
value; }
165
166 void AddBreakpoint(Breakpoint* bpt, Debugger* dbg);
167
168 Breakpoint* breakpoints() const { return this->conditions_; }
169 void set_breakpoints(Breakpoint* head) { this->conditions_ =
head; }
170
171
172 Breakpoint* FindHitBreakpoint(ActivationFrame* top_frame);
173
174 SafepointRwLock* line_number_lock() { return line_number_lock_.get(); }
175
176 Debugger* debugger_;
177 MallocGrowableArray<ScriptPtr> scripts_;
178 StringPtr url_;
179 std::unique_ptr<SafepointRwLock> line_number_lock_;
180 intptr_t line_number_;
181 std::atomic<TokenPosition> token_pos_;
182 std::atomic<TokenPosition> end_token_pos_;
183 BreakpointLocation* next_;
184 Breakpoint* conditions_;
185 intptr_t requested_line_number_;
186 intptr_t requested_column_number_;
187
188
189 TokenPosition code_token_pos_;
190
191 friend class Debugger;
192 friend class GroupDebugger;
194};
195
196
197
198
199
200
201
202
203
204
205
206
207
208class CodeBreakpoint {
209 public:
210
211
212
213
214 CodeBreakpoint(const Code& code,
215 BreakpointLocation* loc,
216 uword pc,
217 UntaggedPcDescriptors::Kind kind);
218 ~CodeBreakpoint();
219
220
221
222 FunctionPtr function() const { return Code::Handle(code_).function(); }
223
224 uword pc()
const {
return pc_; }
225 bool HasBreakpointLocation(BreakpointLocation* breakpoint_location);
226 bool FindAndDeleteBreakpointLocation(BreakpointLocation* breakpoint_location);
227 bool HasNoBreakpointLocations() {
228 return breakpoint_locations_.length() == 0;
229 }
230
231 void Enable();
232 void Disable();
233 bool IsEnabled() const { return enabled_count_ > 0; }
234
235 CodePtr OrigStubAddress() const;
236
237 const char* ToCString() const;
238
239 private:
240 void VisitObjectPointers(ObjectPointerVisitor* visitor);
241
242
243 BreakpointLocation* FindBreakpointForDebugger(Debugger* debugger);
244
245
246
247 void AddBreakpointLocation(BreakpointLocation* breakpoint_location) {
248 ASSERT(breakpoint_locations_.length() == 0 ||
249 (breakpoint_location->token_pos() ==
250 breakpoint_locations_.At(0)->token_pos() &&
251 breakpoint_location->url() == breakpoint_locations_.At(0)->url()));
252 breakpoint_locations_.Add(breakpoint_location);
253 }
254
255 void set_next(CodeBreakpoint* value) { next_ =
value; }
256 CodeBreakpoint*
next()
const {
return this->next_; }
257
258 void PatchCode();
259 void RestoreCode();
260
261 CodePtr code_;
263 int enabled_count_;
264
265
266
267 MallocGrowableArray<BreakpointLocation*> breakpoint_locations_;
268 CodeBreakpoint* next_;
269
270 UntaggedPcDescriptors::Kind breakpoint_kind_;
271 CodePtr saved_value_;
272
273 friend class Debugger;
274 friend class GroupDebugger;
276};
277
278
279
280class ActivationFrame : public ZoneAllocated {
281 public:
283 kRegular,
284 kAsyncSuspensionMarker,
285 kAsyncAwaiter,
286 };
287
288 ActivationFrame(uword pc,
289 uword fp,
290 uword sp,
291 const Code& code,
292 const Array& deopt_frame,
293 intptr_t deopt_frame_offset);
294
295
296
297
298
299
300 ActivationFrame(uword pc, const Code& code, const Closure& closure);
301
302 explicit ActivationFrame(
Kind kind);
303
304 Kind kind()
const {
return kind_; }
305
306 uword pc()
const {
return pc_; }
307 uword fp()
const {
return fp_; }
308 uword sp()
const {
return sp_; }
309
310 uword GetCallerSp()
const {
return fp() + (kCallerSpSlotFromFp *
kWordSize); }
311
312
313
314 const Closure&
closure()
const {
return closure_; }
315
316 const Function& function() const { return function_; }
317 const Code&
code()
const {
319 return code_;
320 }
321
322 enum Relation {
323 kCallee,
324 kSelf,
325 kCaller,
326 };
327
328 Relation CompareTo(uword other_fp) const;
329
330 StringPtr QualifiedFunctionName();
331 StringPtr SourceUrl();
332 ScriptPtr SourceScript();
333 LibraryPtr Library();
334 TokenPosition TokenPos();
335 intptr_t LineNumber();
336 intptr_t ColumnNumber();
337
338
339
340 bool IsDebuggable() const;
341
342
343 bool IsRewindable() const;
344
345
346
347
348 intptr_t ContextLevel();
349
350 const char* ToCString();
351
352 intptr_t NumLocalVariables();
353
354 void VariableAt(intptr_t i,
356 TokenPosition* declaration_token_pos,
357 TokenPosition* visible_start_token_pos,
358 TokenPosition* visible_end_token_pos,
359 Object* value);
360
361 ArrayPtr GetLocalVariables();
362 ObjectPtr GetParameter(intptr_t index);
363 ClosurePtr GetClosure();
365
366 const Context& GetSavedCurrentContext();
367 ObjectPtr GetSuspendStateVar();
368 ObjectPtr GetSuspendableFunctionData();
369
370 TypeArgumentsPtr BuildParameters(
371 const GrowableObjectArray& param_names,
372 const GrowableObjectArray& param_values,
373 const GrowableObjectArray& type_params_names,
374 const GrowableObjectArray& type_params_bounds,
375 const GrowableObjectArray& type_params_defaults);
376
377 ObjectPtr EvaluateCompiledExpression(const ExternalTypedData& kernel_data,
378 const Array& arguments,
379 const Array& type_definitions,
380 const TypeArguments& type_arguments);
381
382 void PrintToJSONObject(JSONObject* jsobj);
383
384 bool HandlesException(const Instance& exc_obj);
385
386 private:
387 void PrintToJSONObjectRegular(JSONObject* jsobj);
388 void PrintToJSONObjectAsyncAwaiter(JSONObject* jsobj);
389 void PrintToJSONObjectAsyncSuspensionMarker(JSONObject* jsobj);
390 void PrintContextMismatchError(intptr_t ctx_slot,
391 intptr_t frame_ctx_level,
392 intptr_t var_ctx_level);
393 void PrintDescriptorsError(
const char*
message);
394
395 intptr_t TryIndex();
396 intptr_t DeoptId();
397 void GetPcDescriptors();
398 void GetVarDescriptors();
399 void GetDescIndices();
400
401 static const char* KindToCString(
Kind kind) {
402 switch (kind) {
403 case kRegular:
404 return "Regular";
405 case kAsyncAwaiter:
406
407 return "AsyncCausal";
408 case kAsyncSuspensionMarker:
409 return "AsyncSuspensionMarker";
410 default:
412 return "";
413 }
414 }
415
416 ObjectPtr GetStackVar(VariableIndex var_index);
417 ObjectPtr GetRelativeContextVar(intptr_t ctxt_level,
418 intptr_t slot_index,
419 intptr_t frame_ctx_level);
420 ObjectPtr GetContextVar(intptr_t ctxt_level, intptr_t slot_index);
421
425
426
427 Context& ctx_ = Context::ZoneHandle();
428 const Code& code_;
429 const Function& function_;
430 const Closure& closure_;
431
432 bool token_pos_initialized_ = false;
433 TokenPosition token_pos_ = TokenPosition::kNoSource;
434 intptr_t try_index_ = -1;
436
437 intptr_t line_number_ = -1;
438 intptr_t column_number_ = -1;
439 intptr_t context_level_ = -1;
440
441
442 const Array& deopt_frame_;
443 const intptr_t deopt_frame_offset_;
444
446
447 bool vars_initialized_ = false;
448 LocalVarDescriptors& var_descriptors_ = LocalVarDescriptors::ZoneHandle();
449 ZoneGrowableArray<intptr_t> desc_indices_;
450 PcDescriptors& pc_desc_ = PcDescriptors::ZoneHandle();
451
452 friend class Debugger;
453 friend class DebuggerStackTrace;
455};
456
457
458class DebuggerStackTrace : public ZoneAllocated {
459 public:
460 explicit DebuggerStackTrace(int capacity)
461 : thread_(Thread::Current()), zone_(thread_->zone()), trace_(capacity) {}
462
463 intptr_t Length() const { return trace_.length(); }
464
465 ActivationFrame* FrameAt(int i) const { return trace_[i]; }
466
467 ActivationFrame* GetHandlerFrame(const Instance& exc_obj) const;
468
469 static DebuggerStackTrace* Collect();
470 static DebuggerStackTrace* CollectAsyncAwaiters();
471
472
473
474
475 static DebuggerStackTrace* From(const class StackTrace& ex_trace);
476
477 bool has_async_catch_error() const { return has_async_catch_error_; }
478 void set_has_async_catch_error(bool has_async_catch_error) {
479 has_async_catch_error_ = has_async_catch_error;
480 }
481
482 private:
483 void AddActivation(ActivationFrame*
frame);
484 void AddAsyncSuspension();
485 void AddAsyncAwaiterFrame(uword pc, const Code& code, const Closure& closure);
486
487 void AppendCodeFrames(StackFrame*
frame,
const Code& code);
488
489 Thread* thread_;
490 Zone* zone_;
491 Code& inlined_code_ = Code::Handle();
492 Array& deopt_frame_ = Array::Handle();
493 ZoneGrowableArray<ActivationFrame*> trace_;
494 bool has_async_catch_error_ = false;
495
496 friend class Debugger;
497
499};
500
501
502typedef enum {
508
509class DebuggerKeyValueTrait : public AllStatic {
510 public:
511 typedef const Debugger*
Key;
513
520 Pair& operator=(
const Pair&) =
default;
521 };
522
523 static Key KeyOf(
Pair kv) {
return kv.key; }
524 static Value ValueOf(
Pair kv) {
return kv.value; }
526 return Utils::WordHash(
reinterpret_cast<intptr_t
>(
key));
527 }
528 static bool IsKeyEqual(
Pair kv,
Key key) {
return kv.key ==
key; }
529};
530
531class DebuggerSet : public MallocDirectChainedHashMap<DebuggerKeyValueTrait> {
532 public:
533 typedef DebuggerKeyValueTrait::Key
Key;
534 typedef DebuggerKeyValueTrait::Value
Value;
535 typedef DebuggerKeyValueTrait::Pair
Pair;
536
537 virtual ~DebuggerSet() { Clear(); }
538
539 void Insert(
const Key&
key) {
541 MallocDirectChainedHashMap<DebuggerKeyValueTrait>::Insert(pair);
542 }
543
544 void Remove(
const Key&
key) {
545 MallocDirectChainedHashMap<DebuggerKeyValueTrait>::Remove(
key);
546 }
547};
548
549class BoolCallable : public ValueObject {
550 public:
551 BoolCallable() {}
552 virtual ~BoolCallable() {}
553
554 virtual bool Call() = 0;
555
556 private:
558};
559
560template <typename T>
561class LambdaBoolCallable : public BoolCallable {
562 public:
563 explicit LambdaBoolCallable(
T& lambda) : lambda_(lambda) {}
564 bool Call() { return lambda_(); }
565
566 private:
569};
570
571class GroupDebugger {
572 public:
573 explicit GroupDebugger(IsolateGroup* isolate_group);
574 ~GroupDebugger();
575
576 void MakeCodeBreakpointAtUnsafe(const Function& func,
577 BreakpointLocation* bpt);
578 void MakeCodeBreakpointAt(const Function& func, BreakpointLocation* bpt);
579
580
581 CodeBreakpoint* GetCodeBreakpoint(uword breakpoint_address);
582 BreakpointLocation* GetBreakpointLocationFor(Debugger* debugger,
583 uword breakpoint_address,
584 CodeBreakpoint** pcbpt);
585 CodePtr GetPatchedStubAddress(uword breakpoint_address);
586
587 void RegisterBreakpointLocation(BreakpointLocation* location);
588 void UnregisterBreakpointLocation(BreakpointLocation* location);
589
590 void RemoveBreakpointLocation(BreakpointLocation* bpt_location);
591 void UnlinkCodeBreakpoints(BreakpointLocation* bpt_location);
592
593
594
595 bool HasActiveBreakpoint(uword pc);
596 bool HasCodeBreakpointInFunctionUnsafe(const Function& func);
597 bool HasCodeBreakpointInFunction(const Function& func);
598 bool HasCodeBreakpointInCode(const Code& code);
599
600 bool HasBreakpointInFunction(const Function& func);
601 bool HasBreakpointInCode(const Code& code);
602
603 void SyncBreakpointLocation(BreakpointLocation* loc);
604
605 void Pause();
606
607 bool EnsureLocationIsInFunction(Zone* zone,
608 const Function& function,
609 BreakpointLocation* location);
610 void NotifyCompilation(const Function& func);
611
612 void VisitObjectPointers(ObjectPointerVisitor* visitor);
613
614 SafepointRwLock* code_breakpoints_lock() {
615 return code_breakpoints_lock_.get();
616 }
617
618 SafepointRwLock* breakpoint_locations_lock() {
619 return breakpoint_locations_lock_.get();
620 }
621
622 RwLock* single_stepping_set_lock() { return single_stepping_set_lock_.get(); }
623
624 void RegisterSingleSteppingDebugger(Thread* thread, const Debugger* debugger);
625 void UnregisterSingleSteppingDebugger(Thread* thread,
626 const Debugger* debugger);
627
628
629
630 bool HasBreakpointUnsafe(Thread* thread, const Function& function);
631 bool HasBreakpoint(Thread* thread, const Function& function);
632 bool IsDebugging(Thread* thread, const Function& function);
633
634 IsolateGroup* isolate_group() { return isolate_group_; }
635
636 private:
637 IsolateGroup* isolate_group_;
638
639 std::unique_ptr<SafepointRwLock> code_breakpoints_lock_;
640 CodeBreakpoint* code_breakpoints_;
641
642
643
644
645 std::unique_ptr<SafepointRwLock> breakpoint_locations_lock_;
646 MallocGrowableArray<BreakpointLocation*> breakpoint_locations_;
647
648 std::unique_ptr<RwLock> single_stepping_set_lock_;
649 DebuggerSet single_stepping_set_;
650
651 void RemoveUnlinkedCodeBreakpoints();
652 void RegisterCodeBreakpoint(CodeBreakpoint* bpt);
653
654 bool needs_breakpoint_cleanup_;
655};
656
657class Debugger {
658 public:
659 enum ResumeAction {
661 kStepInto,
662 kStepOver,
663 kStepOut,
664 kStepRewind,
665 kStepOverAsyncSuspension,
666 };
667
668 explicit Debugger(Isolate* isolate);
669 ~Debugger();
670
671 Isolate* isolate() const { return isolate_; }
672
673 void NotifyIsolateCreated();
674 void Shutdown();
675
676 void NotifyDoneLoading();
677
678
679 Breakpoint* SetBreakpointAtEntry(const Function& target_function,
680 bool single_shot);
681 Breakpoint* SetBreakpointAtActivation(const Instance& closure,
682 bool single_shot);
683 Breakpoint* BreakpointAtActivation(const Instance& closure);
684
685
686 Breakpoint* SetBreakpointAtLine(const String& script_url,
687 intptr_t line_number);
688 Breakpoint* SetBreakpointAtLineCol(const String& script_url,
689 intptr_t line_number,
690 intptr_t column_number);
691
692 BreakpointLocation* BreakpointLocationAtLineCol(const String& script_url,
693 intptr_t line_number,
694 intptr_t column_number);
695
696
697 bool SetBreakpointState(Breakpoint* bpt, bool enable);
698
699 void RemoveBreakpoint(intptr_t bp_id);
700 Breakpoint* GetBreakpointById(intptr_t id);
701
702 void AsyncStepInto(const Closure& awaiter);
703
704 void Continue();
705
706 bool SetResumeAction(ResumeAction
action,
707 intptr_t frame_index = 1,
708 const char**
error =
nullptr);
709
710 bool IsStepping()
const {
return resume_action_ !=
kContinue; }
711
712 bool IsSingleStepping() const { return resume_action_ == kStepInto; }
713
714 bool IsPaused() const { return pause_event_ != nullptr; }
715
716 bool ignore_breakpoints() const { return ignore_breakpoints_; }
717 void set_ignore_breakpoints(bool ignore_breakpoints) {
718 ignore_breakpoints_ = ignore_breakpoints;
719 }
720
721
722
723
724
725 void EnterSingleStepMode();
726
727
728
729
730
731 const ServiceEvent* PauseEvent() const { return pause_event_; }
732
733 void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info);
735
736 void VisitObjectPointers(ObjectPointerVisitor* visitor);
737
738
739
740
741
742 DebuggerStackTrace* StackTrace();
743
744 DebuggerStackTrace* AsyncAwaiterStackTrace();
745
746
747 ErrorPtr PauseBreakpoint();
748
749
750 ErrorPtr PauseStepping();
751
752
753 ErrorPtr PauseInterrupted();
754
755
756 ErrorPtr PausePostRequest();
757
758
759 void PauseException(const Instance& exc);
760
761
762
763 void PauseDeveloper(const String& msg);
764
765 void PrintBreakpointsToJSONArray(JSONArray* jsarr) const;
766 void PrintSettingsToJSONObject(JSONObject* jsobj) const;
767
768 static bool IsDebuggable(const Function& func);
769
770 intptr_t limitBreakpointId() { return next_id_; }
771
772
773 void RewindPostDeopt();
774
775
776
777 void SetBreakpointAtResumption(const Object& function_data);
778
779
780 void ResumptionBreakpoint();
781
782 private:
783 ErrorPtr PauseRequest(ServiceEvent::EventKind kind);
784
785
786 bool SetupStepOverAsyncSuspension(
const char**
error);
787
788 bool NeedsIsolateEvents();
789 bool NeedsDebugEvents();
790
791 void SendBreakpointEvent(ServiceEvent::EventKind kind, Breakpoint* bpt);
792
793 void FindCompiledFunctions(
794 const GrowableHandlePtrArray<const Script>&
scripts,
795 TokenPosition start_pos,
796 TokenPosition end_pos,
797 GrowableObjectArray* code_function_list);
798 bool FindBestFit(const Script& script,
799 TokenPosition token_pos,
800 TokenPosition last_token_pos,
801 Function* best_fit);
802 void DeoptimizeWorld();
803 void RunWithStoppedDeoptimizedWorld(std::function<void()> fun);
804 void NotifySingleStepping(bool value);
805 BreakpointLocation* SetCodeBreakpoints(
806 const GrowableHandlePtrArray<const Script>&
scripts,
807 TokenPosition token_pos,
808 TokenPosition last_token_pos,
809 intptr_t requested_line,
810 intptr_t requested_column,
811 TokenPosition exact_token_pos,
812 const GrowableObjectArray& functions);
814 TokenPosition token_pos,
815 TokenPosition last_token_pos,
816 intptr_t requested_line,
817 intptr_t requested_column,
818 const Function& function);
820 const GrowableHandlePtrArray<const Script>&
scripts,
821 TokenPosition token_pos,
822 TokenPosition last_token_pos,
823 intptr_t requested_line,
824 intptr_t requested_column,
825 const Function& function);
826 bool RemoveBreakpointFromTheList(intptr_t bp_id, BreakpointLocation** list);
827 Breakpoint* GetBreakpointByIdInTheList(intptr_t id, BreakpointLocation* list);
828 BreakpointLocation* GetLatentBreakpoint(const String& url,
829 intptr_t line,
830 intptr_t column);
831 void RegisterBreakpointLocationUnsafe(BreakpointLocation* loc);
832 void RegisterBreakpointLocation(BreakpointLocation* bpt);
833 BreakpointLocation* GetResolvedBreakpointLocation(
834 const String& script_url,
835 TokenPosition code_token_pos);
836 BreakpointLocation* GetBreakpointLocation(
837 const String& script_url,
838 TokenPosition token_pos,
839 intptr_t requested_line,
840 intptr_t requested_column,
841 TokenPosition code_token_pos = TokenPosition::kNoSource);
842
843 void PrintBreakpointsListToJSONArray(BreakpointLocation* sbpt,
844 JSONArray* jsarr) const;
845
846 void SignalPausedEvent(ActivationFrame* top_frame, Breakpoint* bpt);
847
848 intptr_t nextId() { return next_id_++; }
849
850 bool ShouldPauseOnException(DebuggerStackTrace* stack_trace,
851 const Instance& exc);
852
853
854
855 void Pause(ServiceEvent*
event);
856
857 void HandleSteppingRequest(bool skip_next_step = false);
858
859 void CacheStackTraces(DebuggerStackTrace* stack_trace,
860 DebuggerStackTrace* async_awaiter_stack_trace);
861 void ClearCachedStackTraces();
862
863 void RewindToFrame(intptr_t frame_index);
864 void RewindToUnoptimizedFrame(StackFrame*
frame,
const Code& code);
865 void RewindToOptimizedFrame(StackFrame*
frame,
866 const Code& code,
867 intptr_t post_deopt_frame_index);
868
869 void ResetSteppingFramePointer();
870 void SetSyncSteppingFramePointer(DebuggerStackTrace* stack_trace);
871
872 GroupDebugger* group_debugger() { return isolate_->group()->debugger(); }
873
874 Isolate* isolate_;
875
876
877 intptr_t next_id_;
878
879 BreakpointLocation* latent_locations_;
880 BreakpointLocation* breakpoint_locations_;
881
882
883 ResumeAction resume_action_;
884 void set_resume_action(ResumeAction
action);
885 intptr_t resume_frame_index_;
886 intptr_t post_deopt_frame_index_;
887
888
889
890
891 bool ignore_breakpoints_;
892
893
894
895
896
897 ServiceEvent* pause_event_;
898
899
900 DebuggerStackTrace* stack_trace_;
901 DebuggerStackTrace* async_awaiter_stack_trace_;
902
903
904
905
907
908
909
910 uword last_stepping_fp_;
911 TokenPosition last_stepping_pos_;
912
913
914
915
916 bool skip_next_step_;
917
919
920
921
922 MallocGrowableArray<ObjectPtr> breakpoints_at_resumption_;
923
924 friend class Isolate;
925 friend class BreakpointLocation;
927};
928
929class DisableBreakpointsScope : public ValueObject {
930 public:
931 DisableBreakpointsScope(Debugger* debugger, bool disable)
932 : debugger_(debugger) {
933 ASSERT(debugger_ !=
nullptr);
934 initial_state_ = debugger_->ignore_breakpoints();
935 debugger_->set_ignore_breakpoints(disable);
936 }
937
938 ~DisableBreakpointsScope() {
939 debugger_->set_ignore_breakpoints(initial_state_);
940 }
941
942 private:
943 Debugger* debugger_;
944 bool initial_state_;
945
947};
948
949}
950
951#endif
952
953#endif
static float next(float f)
static constexpr intptr_t kNone
const uint8_t uint32_t uint32_t GError ** error
void SetBreakpoint(Dart_NativeArguments args)
constexpr intptr_t kWordSize
@ kInvalidExceptionPauseInfo
@ kPauseOnUnhandledExceptions
std::function< void()> closure
T * GetReceiver(Dart_NativeArguments args)
static Target * is_enabled(Benchmark *bench, const Config &config)