v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1// Copyright 2012 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_DEBUG_DEBUG_H_
6#define V8_DEBUG_DEBUG_H_
7
8#include <memory>
9#include <optional>
10#include <unordered_map>
11#include <vector>
12
13#include "src/base/enum-set.h"
16#include "src/common/globals.h"
21#include "src/handles/handles.h"
24
25namespace v8 {
26namespace internal {
27
28// Forward declarations.
29class AbstractCode;
30class DebugScope;
31class InterpretedFrame;
32class JavaScriptFrame;
33class JSGeneratorObject;
34class StackFrame;
35
36// Step actions.
37enum StepAction : int8_t {
38 StepNone = -1, // Stepping not prepared.
39 StepOut = 0, // Step out of the current function.
40 StepOver = 1, // Step to the next statement in the current function.
41 StepInto = 2, // Step into new functions invoked or the next statement
42 // in the current function.
44};
45
46// Type of exception break. NOTE: These values are in macros.py as well.
51
52// Type of debug break. NOTE: The order matters for the predicates
53// below inside BreakLocation, so be careful when adding / removing.
63
68
70 public:
73 JavaScriptFrame* frame);
75
76 static void AllAtCurrentStatement(Handle<DebugInfo> debug_info,
77 JavaScriptFrame* frame,
78 std::vector<BreakLocation>* result_out);
79
80 bool IsSuspend() const { return type_ == DEBUG_BREAK_SLOT_AT_SUSPEND; }
81 bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; }
83 bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; }
84 bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; }
85 bool IsDebuggerStatement() const { return type_ == DEBUGGER_STATEMENT; }
87
88 bool HasBreakPoint(Isolate* isolate, Handle<DebugInfo> debug_info) const;
89
91 int position() const { return position_; }
92 int code_offset() const { return code_offset_; }
93
95
97 JavaScriptFrame* frame) const;
98
99 private:
101 int code_offset, int position, int generator_obj_reg_index,
103 : abstract_code_(abstract_code),
105 type_(type),
107 generator_obj_reg_index_(generator_obj_reg_index),
110 }
111
118
119 static int BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info,
120 DirectHandle<AbstractCode> abstract_code,
121 int offset);
122
125
132
133 friend class BreakIterator;
134};
135
137 public:
138 explicit BreakIterator(Handle<DebugInfo> debug_info);
139 BreakIterator(const BreakIterator&) = delete;
141
142 BreakLocation GetBreakLocation();
143 bool Done() const { return source_position_iterator_.done(); }
144 void Next();
145
146 void SkipToPosition(int position);
147 void SkipTo(int count) {
148 while (count-- > 0) Next();
149 }
150
151 int code_offset() { return source_position_iterator_.code_offset(); }
152 int break_index() const { return break_index_; }
153 inline int position() const { return position_; }
154 inline int statement_position() const { return statement_position_; }
155
156 void ClearDebugBreak();
157 void SetDebugBreak();
158
159 DebugBreakType GetDebugBreakType();
160
161 private:
162 int BreakIndexFromPosition(int position);
163
164 Isolate* isolate();
165
172};
173
174// Holds all active DebugInfo objects. This is a composite data structure
175// consisting of
176//
177// - an unsorted list-like structure for fast iteration and
178// deletion-during-iteration, and
179// - a map-like structure for fast SharedFunctionInfo-DebugInfo lookups.
180//
181// DebugInfos are held strongly through global handles.
182//
183// TODO(jgruber): Now that we use an unordered_map as the map-like structure,
184// which supports deletion-during-iteration, the list-like part of this data
185// structure could be removed.
188 using SFIUniqueId = uint32_t; // The type of SFI::unique_id.
189
190 public:
191 explicit DebugInfoCollection(Isolate* isolate) : isolate_(isolate) {}
192
194
195 bool Contains(Tagged<SharedFunctionInfo> sfi) const;
196 std::optional<Tagged<DebugInfo>> Find(Tagged<SharedFunctionInfo> sfi) const;
197
199
200 size_t Size() const { return list_.size(); }
201
202 class Iterator final {
203 public:
204 explicit Iterator(DebugInfoCollection* collection)
205 : collection_(collection) {}
206
207 bool HasNext() const {
209 }
210
212 DCHECK_GE(index_, 0);
213 if (!HasNext()) return {};
215 }
216
217 void Advance() {
218 DCHECK(HasNext());
219 index_++;
220 }
221
222 void DeleteNext() {
223 DCHECK_GE(index_, 0);
224 DCHECK(HasNext());
226 index_--; // `Advance` must be called next.
227 }
228
229 private:
232 int index_ = 0; // `int` because deletion may rewind to -1.
233 };
234
235 private:
237 void DeleteIndex(size_t index);
238
240 std::vector<HandleLocation> list_;
241 std::unordered_map<SFIUniqueId, HandleLocation> map_;
242};
243
244// This class contains the debugger support. The main purpose is to handle
245// setting break points in the code.
246//
247// This class controls the debug info for all functions which currently have
248// active breakpoints in them. This debug info is held in the heap root object
249// debug_info which is a FixedArray. Each entry in this list is of class
250// DebugInfo.
252 public:
253 Debug(const Debug&) = delete;
254 Debug& operator=(const Debug&) = delete;
255
256 // Debug event triggers.
257 void OnDebugBreak(DirectHandle<FixedArray> break_points_hit,
258 StepAction stepAction,
259 debug::BreakReasons break_reasons = {});
261
262 std::optional<Tagged<Object>> OnThrow(DirectHandle<Object> exception)
264 void OnPromiseReject(DirectHandle<Object> promise,
266 void OnCompileError(DirectHandle<Script> script);
267 void OnAfterCompile(DirectHandle<Script> script);
268
269 void HandleDebugBreak(IgnoreBreakMode ignore_break_mode,
270 debug::BreakReasons break_reasons);
271
272 // The break target may not be the top-most frame, since we may be
273 // breaking before entering a function that cannot contain break points.
274 void Break(JavaScriptFrame* frame, DirectHandle<JSFunction> break_target);
275
276 // Scripts handling.
277 DirectHandle<FixedArray> GetLoadedScripts();
278
279 // DebugInfo accessors.
280 std::optional<Tagged<DebugInfo>> TryGetDebugInfo(
282 bool HasDebugInfo(Tagged<SharedFunctionInfo> sfi);
283 bool HasCoverageInfo(Tagged<SharedFunctionInfo> sfi);
284 bool HasBreakInfo(Tagged<SharedFunctionInfo> sfi);
285 bool BreakAtEntry(Tagged<SharedFunctionInfo> sfi);
286
287 // Break point handling.
288 enum BreakPointKind { kRegular, kInstrumentation };
289 bool SetBreakpoint(Handle<SharedFunctionInfo> shared,
290 DirectHandle<BreakPoint> break_point,
291 int* source_position);
292 void ClearBreakPoint(DirectHandle<BreakPoint> break_point);
293 void ChangeBreakOnException(ExceptionBreakType type, bool enable);
294 bool IsBreakOnException(ExceptionBreakType type);
295
296 void SetTerminateOnResume();
297
298 bool SetBreakPointForScript(Handle<Script> script,
300 int* source_position, int* id);
301 bool SetBreakpointForFunction(Handle<SharedFunctionInfo> shared,
303 BreakPointKind kind = kRegular);
304 void RemoveBreakpoint(int id);
305#if V8_ENABLE_WEBASSEMBLY
306 void SetInstrumentationBreakpointForWasmScript(DirectHandle<Script> script,
307 int* id);
308 void RemoveBreakpointForWasmScript(DirectHandle<Script> script, int id);
309
310 void RecordWasmScriptWithBreakpoints(DirectHandle<Script> script);
311#endif // V8_ENABLE_WEBASSEMBLY
312
313 // Find breakpoints from the debug info and the break location and check
314 // whether they are hit. Return an empty handle if not, or a FixedArray with
315 // hit BreakPoint objects. has_break_points is set to true if position has
316 // any non-instrumentation breakpoint.
317 MaybeHandle<FixedArray> GetHitBreakPoints(DirectHandle<DebugInfo> debug_info,
318 int position,
319 bool* has_break_points);
320
321 // Stepping handling.
322 void PrepareStep(StepAction step_action);
323 void PrepareStepIn(DirectHandle<JSFunction> function);
324 void PrepareStepInSuspendedGenerator();
325 void PrepareStepOnThrow();
326 void ClearStepping();
327 void PrepareRestartFrame(JavaScriptFrame* frame, int inlined_frame_index);
328
329 void SetBreakOnNextFunctionCall();
330 void ClearBreakOnNextFunctionCall();
331
332 void DiscardBaselineCode(Tagged<SharedFunctionInfo> shared);
333 void DiscardAllBaselineCode();
334
335 void DeoptimizeFunction(DirectHandle<SharedFunctionInfo> shared);
336 void PrepareFunctionForDebugExecution(
338 void InstallDebugBreakTrampoline();
339 bool GetPossibleBreakpoints(Handle<Script> script, int start_position,
340 int end_position, bool restrict_to_function,
341 std::vector<BreakLocation>* locations);
342
343 bool IsFunctionBlackboxed(DirectHandle<Script> script, const int start,
344 const int end);
345 bool IsBlackboxed(DirectHandle<SharedFunctionInfo> shared);
346 bool ShouldBeSkipped();
347
348 bool CanBreakAtEntry(DirectHandle<SharedFunctionInfo> shared);
349
350 void SetDebugDelegate(debug::DebugDelegate* delegate);
351
352 // Returns whether the operation succeeded.
353 bool EnsureBreakInfo(Handle<SharedFunctionInfo> shared);
354 void CreateBreakInfo(DirectHandle<SharedFunctionInfo> shared);
355 Handle<DebugInfo> GetOrCreateDebugInfo(
357
358 void InstallCoverageInfo(DirectHandle<SharedFunctionInfo> shared,
359 DirectHandle<CoverageInfo> coverage_info);
360 void RemoveAllCoverageInfos();
361
362 // This function is used in FunctionNameUsing* tests.
363 Handle<Object> FindInnermostContainingFunctionInfo(Handle<Script> script,
364 int position);
365
366 Handle<SharedFunctionInfo> FindClosestSharedFunctionInfoFromPosition(
367 int position, Handle<Script> script,
368 Handle<SharedFunctionInfo> outer_shared);
369
370 bool FindSharedFunctionInfosIntersectingRange(
371 Handle<Script> script, int start_position, int end_position,
373
374 MaybeDirectHandle<SharedFunctionInfo> GetTopLevelWithRecompile(
375 Handle<Script> script, bool* did_compile = nullptr);
376
377 static DirectHandle<Object> GetSourceBreakLocations(
379
380 // Check whether this frame is just about to return.
381 bool IsBreakAtReturn(JavaScriptFrame* frame);
382
383 // Walks the call stack to see if any frames are not ignore listed.
384 bool AllFramesOnStackAreBlackboxed();
385
386 // Set new script source, throw an exception if error occurred. When preview
387 // is true: try to set source, throw exception if any without actual script
388 // change. stack_changed is true if after editing script on pause stack is
389 // changed and client should request stack trace again.
390 bool SetScriptSource(Handle<Script> script, Handle<String> source,
391 bool preview, bool allow_top_frame_live_editing,
393
394 int GetFunctionDebuggingId(DirectHandle<JSFunction> function);
395
396 // Threading support.
397 char* ArchiveDebug(char* to);
398 char* RestoreDebug(char* from);
399 static int ArchiveSpacePerThread();
401 void Iterate(RootVisitor* v);
402 void InitThread(const ExecutionAccess& lock) { ThreadInit(); }
403
404 bool CheckExecutionState() { return is_active(); }
405
406 void StartSideEffectCheckMode();
407 void StopSideEffectCheckMode();
408
409 void ApplySideEffectChecks(DirectHandle<DebugInfo> debug_info);
410 void ClearSideEffectChecks(DirectHandle<DebugInfo> debug_info);
411
412 // Make a one-time exception for a next call to given side-effectful API
413 // function.
414 void IgnoreSideEffectsOnNextCallTo(Handle<FunctionTemplateInfo> function);
415
416 bool PerformSideEffectCheck(DirectHandle<JSFunction> function,
418
419 void PrepareBuiltinForSideEffectCheck(Isolate* isolate, Builtin id);
420
421 bool PerformSideEffectCheckForAccessor(
423 AccessorComponent component);
424 bool PerformSideEffectCheckForCallback(Handle<FunctionTemplateInfo> function);
425 bool PerformSideEffectCheckForInterceptor(
426 DirectHandle<InterceptorInfo> interceptor_info);
427
428 bool PerformSideEffectCheckAtBytecode(InterpretedFrame* frame);
429 bool PerformSideEffectCheckForObject(DirectHandle<Object> object);
430
431 // Flags and states.
432 inline bool is_active() const { return is_active_; }
433 inline bool in_debug_scope() const {
434 return !!base::Relaxed_Load(&thread_local_.current_debug_scope_);
435 }
436 inline bool needs_check_on_function_call() const {
437 return hook_on_function_call_;
438 }
439
440 void set_break_points_active(bool v) { break_points_active_ = v; }
441 bool break_points_active() const { return break_points_active_; }
442
443 StackFrameId break_frame_id() { return thread_local_.break_frame_id_; }
444
445 Handle<Object> return_value_handle();
446 Tagged<Object> return_value() { return thread_local_.return_value_; }
448 thread_local_.return_value_ = value;
449 }
450
451 // Support for embedding into generated code.
452 Address is_active_address() { return reinterpret_cast<Address>(&is_active_); }
453
455 return reinterpret_cast<Address>(&hook_on_function_call_);
456 }
457
459 return reinterpret_cast<Address>(&thread_local_.suspended_generator_);
460 }
461
462 StepAction last_step_action() { return thread_local_.last_step_action_; }
464 return thread_local_.break_on_next_function_call_;
465 }
466
468 return thread_local_.scheduled_break_on_next_function_call_;
469 }
470
472 return thread_local_.restart_frame_id_ != StackFrameId::NO_ID;
473 }
475 return IsRestartFrameScheduled() && thread_local_.restart_frame_id_ == id;
476 }
478 thread_local_.restart_frame_id_ = StackFrameId::NO_ID;
479 thread_local_.restart_inline_frame_index_ = -1;
480 }
482 return thread_local_.restart_inline_frame_index_;
483 }
484
485 inline bool break_disabled() const { return break_disabled_; }
486
487 // For functions in which we cannot set a break point, use a canonical
488 // source position for break points.
489 static const int kBreakAtEntryPosition = 0;
490
491 // Use -1 to encode instrumentation breakpoints.
492 static const int kInstrumentationId = -1;
493
494 void RemoveBreakInfoAndMaybeFree(DirectHandle<DebugInfo> debug_info);
495
496 // Stops the timer for the top-most `DebugScope` and records a UMA event.
497 void NotifyDebuggerPausedEventSent();
498
499 static char* Iterate(RootVisitor* v, char* thread_storage);
500
501 // Clear information pertaining to break location muting.
502 void ClearMutedLocation();
503#if V8_ENABLE_WEBASSEMBLY
504 // Mute additional pauses from this Wasm location.
505 void SetMutedWasmLocation(DirectHandle<Script> script, int position);
506#endif // V8_ENABLE_WEBASSEMBLY
507
508 uint64_t IsolateId() const { return isolate_id_; }
509 void SetIsolateId(uint64_t id) { isolate_id_ = id; }
510
511 private:
512 explicit Debug(Isolate* isolate);
513 ~Debug();
514
515 void UpdateDebugInfosForExecutionMode();
516 void UpdateState();
517 void UpdateHookOnFunctionCall();
518 void Unload();
519
520 // Return the number of virtual frames below debugger entry.
521 int CurrentFrameCount();
522
523 inline bool ignore_events() const {
524 return is_suppressed_ || !is_active_ ||
525 isolate_->debug_execution_mode() == DebugInfo::kSideEffects;
526 }
527
529 thread_local_.suspended_generator_ = Smi::zero();
530 }
531
533 return thread_local_.suspended_generator_ != Smi::zero();
534 }
535
536 void OnException(DirectHandle<Object> exception,
538 v8::debug::ExceptionType exception_type);
539
540 void ProcessCompileEvent(bool has_compile_error, DirectHandle<Script> script);
541
542 // Find the closest source position for a break point for a given position.
543 int FindBreakablePosition(Handle<DebugInfo> debug_info, int source_position);
544 // Instrument code to break at break points.
545 void ApplyBreakPoints(Handle<DebugInfo> debug_info);
546 // Clear code from instrumentation.
547 void ClearBreakPoints(Handle<DebugInfo> debug_info);
548 // Clear all code from instrumentation.
549 void ClearAllBreakPoints();
550 // Instrument a function with one-shots.
551 void FloodWithOneShot(Handle<SharedFunctionInfo> function,
552 bool returns_only = false);
553 // Clear all one-shot instrumentations, but restore break points.
554 void ClearOneShot();
555
556 // Mute additional pauses from this JavaScript location.
557 void SetMutedLocation(DirectHandle<SharedFunctionInfo> function,
558 const BreakLocation& location);
559
560 bool IsFrameBlackboxed(JavaScriptFrame* frame);
561
563 bool IsBreakOnInstrumentation(Handle<DebugInfo> debug_info,
564 const BreakLocation& location);
565 bool IsBreakOnDebuggerStatement(DirectHandle<SharedFunctionInfo> function,
566 const BreakLocation& location);
567 MaybeHandle<FixedArray> CheckBreakPoints(Handle<DebugInfo> debug_info,
568 BreakLocation* location,
569 bool* has_break_points);
570 MaybeDirectHandle<FixedArray> CheckBreakPointsForLocations(
571 Handle<DebugInfo> debug_info, std::vector<BreakLocation>& break_locations,
572 bool* has_break_points);
573
574 bool IsMutedAtAnyBreakLocation(DirectHandle<SharedFunctionInfo> function,
575 const std::vector<BreakLocation>& locations);
576#if V8_ENABLE_WEBASSEMBLY
577 bool IsMutedAtWasmLocation(Tagged<Script> script, int position);
578#endif // V8_ENABLE_WEBASSEMBLY
579 // Check whether a BreakPoint object is hit. Evaluate condition depending
580 // on whether this is a regular break location or a break at function entry.
581 bool CheckBreakPoint(DirectHandle<BreakPoint> break_point,
582 bool is_break_at_entry);
583
584 inline void AssertDebugContext() { DCHECK(in_debug_scope()); }
585
586 void ThreadInit();
587
589
590 void ClearAllDebuggerHints();
591
592 // Wraps logic for clearing and maybe freeing all debug infos.
593 using DebugInfoClearFunction = std::function<void(Handle<DebugInfo>)>;
594 void ClearAllDebugInfos(const DebugInfoClearFunction& clear_function);
595
596 void SetTemporaryObjectTrackingDisabled(bool disabled);
597 bool GetTemporaryObjectTrackingDisabled() const;
598
599 debug::DebugDelegate* debug_delegate_ = nullptr;
600
601 // Debugger is active, i.e. there is a debug event listener attached.
602 // This field is atomic because background compilation jobs can read it
603 // through Isolate::NeedsDetailedOptimizedCodeLineInfo.
604 std::atomic<bool> is_active_;
605 // Debugger needs to be notified on every new function call.
606 // Used for stepping and read-only checks
608 // Suppress debug events.
610 // Running liveedit.
611 bool running_live_edit_ = false;
612 // Do not trigger debug break events.
614 // Do not break on break points.
616 // Trigger debug break events for caught exceptions.
618 // Trigger debug break events for uncaught exceptions.
620 // Termination exception because side effect check has failed.
622
623 // List of active debug info objects.
625
626 // Used for side effect check to mark temporary objects.
628 std::unique_ptr<TemporaryObjectsTracker> temporary_objects_;
629
631
632 // Per-thread data.
634 public:
635 // Top debugger entry.
637
638 // Frame id for the frame of the current break.
640
641 // Step action for last step performed.
643
644 // If set, next PrepareStepIn will ignore this function until stepped into
645 // another function, at which point this will be cleared.
647
648 // If set then we need to repeat StepOut action at return.
650
651 // Source statement position from last step next action.
653
654 // Bytecode offset from last step next action.
656
657 // Frame pointer from last step next or step frame action.
659
660 // Frame pointer of the target frame we want to arrive at.
662
663 // Value of the accumulator at the point of entering the debugger.
665
666 // The suspended generator object to track when stepping.
668
669 // Last used inspector breakpoint id.
671
672 // This flag is true when SetBreakOnNextFunctionCall is called and it forces
673 // debugger to break on next function call.
675
676 // This flag is true when we break via stack check (BreakReason::kScheduled)
677 // We don't stay paused there but instead "step in" to the function similar
678 // to what "BreakOnNextFunctionCall" does.
680
681 // Frame ID for the frame that needs to be restarted. StackFrameId::NO_ID
682 // otherwise. The unwinder uses the id to restart execution in this frame
683 // instead of any potential catch handler.
685
686 // If `restart_frame_id_` is an optimized frame, then this index denotes
687 // which of the inlined frames we actually want to restart. The
688 // deoptimizer uses the info to materialize and drop execution into the
689 // right frame.
691
692 // If the most recent breakpoint did not result in a break because its
693 // condition was false, we will mute other break reasons if we are still at
694 // the same location. In that case, this points to the SharedFunctionInfo
695 // (if JavaScript) or Script (if Wasm) of the location where stopping has
696 // been muted; otherwise it is Smi::zero().
698
699 // The source position at which breaking is muted. Only relevant if
700 // muted_function_ is set.
702 };
703
704 static void Iterate(RootVisitor* v, ThreadLocal* thread_local_data);
705
706 // Storage location for registers when handling debug break calls
708
709#if V8_ENABLE_WEBASSEMBLY
710 // This is a global handle, lazily initialized.
711 IndirectHandle<WeakArrayList> wasm_scripts_with_break_points_;
712#endif // V8_ENABLE_WEBASSEMBLY
713
714 // This is a part of machinery for allowing to ignore side effects for one
715 // call to this API function. See Function::NewInstanceWithSideEffectType().
716 // Since the FunctionTemplateInfo is allowlisted right before the call to
717 // constructor there must be never more than one such object at a time.
720
722
723 // The isolate id is set by the inspector via an embedder provided RNG
724 // (if provided) but stored in debug instance so we can access it internally
725 // in V8.
726 uint64_t isolate_id_;
727
728 friend class Isolate;
729 friend class DebugScope;
730 friend class DisableBreak;
732 friend class LiveEdit;
733 friend class SuppressDebug;
734
735 friend DirectHandle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc
736 friend void CheckDebuggerUnloaded(); // In test-debug.cc
737};
738
739// This scope is used to load and enter the debug context and create a new
740// break state. Leaving the scope will restore the previous state.
742 public:
743 explicit DebugScope(Debug* debug);
744 ~DebugScope();
745
746 void set_terminate_on_resume();
747
748 base::TimeDelta ElapsedTimeSinceCreation();
749
750 private:
751 Isolate* isolate() { return debug_->isolate_; }
752
754 DebugScope* prev_; // Previous scope if entered recursively.
755 StackFrameId break_frame_id_; // Previous break frame id.
757 // This is used as a boolean.
758 bool terminate_on_resume_ = false;
759
760 // Measures (for UMA) the duration beginning when we enter this `DebugScope`
761 // until we potentially send a "Debugger.paused" response in the inspector.
763};
764
765// This scope is used to handle return values in nested debug break points.
766// When there are nested debug breaks, we use this to restore the return
767// value to the previous state. This is not merged with DebugScope because
768// return_value_ will not be cleared when we use DebugScope.
770 public:
771 explicit ReturnValueScope(Debug* debug);
773
774 private:
776 Handle<Object> return_value_; // Previous result.
777};
778
779// Stack allocated class for disabling break.
781 public:
782 explicit DisableBreak(Debug* debug, bool disable = true)
783 : debug_(debug), previous_break_disabled_(debug->break_disabled_) {
784 debug_->break_disabled_ = disable;
785 }
787 DisableBreak(const DisableBreak&) = delete;
789
790 private:
793};
794
795// Stack allocated class for disabling temporary object tracking.
816
818 public:
819 explicit SuppressDebug(Debug* debug)
820 : debug_(debug), old_state_(debug->is_suppressed_) {
821 debug_->is_suppressed_ = true;
822 }
824 SuppressDebug(const SuppressDebug&) = delete;
826
827 private:
830};
831
832} // namespace internal
833} // namespace v8
834
835#endif // V8_DEBUG_DEBUG_H_
Isolate * isolate_
#define DISALLOW_GARBAGE_COLLECTION(name)
Builtins::Kind kind
Definition builtins.cc:40
BreakIterator(const BreakIterator &)=delete
BreakIterator & operator=(const BreakIterator &)=delete
SourcePositionTableIterator source_position_iterator_
Definition debug.h:170
void SkipTo(int count)
Definition debug.h:147
Handle< DebugInfo > debug_info_
Definition debug.h:166
int statement_position() const
Definition debug.h:154
int break_index() const
Definition debug.h:152
Handle< AbstractCode > abstract_code_
Definition debug.h:126
static void AllAtCurrentStatement(Handle< DebugInfo > debug_info, JavaScriptFrame *frame, std::vector< BreakLocation > *result_out)
Definition debug.cc:236
BreakLocation(Handle< AbstractCode > abstract_code, DebugBreakType type, int code_offset, int position, int generator_obj_reg_index, int generator_suspend_id)
Definition debug.h:100
static bool IsPausedInJsFunctionEntry(JavaScriptFrame *frame)
Definition debug.cc:201
bool IsCall() const
Definition debug.h:83
bool IsDebugBreakSlot() const
Definition debug.h:84
BreakLocation(int position, DebugBreakType type)
Definition debug.h:112
Tagged< JSGeneratorObject > GetGeneratorObjectForSuspendedFrame(JavaScriptFrame *frame) const
Definition debug.cc:258
static BreakLocation Invalid()
Definition debug.h:71
DebugBreakType type_
Definition debug.h:128
bool IsReturn() const
Definition debug.h:81
int code_offset() const
Definition debug.h:92
bool IsDebugBreakAtEntry() const
Definition debug.h:86
static int BreakIndexFromCodeOffset(Handle< DebugInfo > debug_info, DirectHandle< AbstractCode > abstract_code, int offset)
Definition debug.cc:270
bool IsSuspend() const
Definition debug.h:80
static BreakLocation FromFrame(Handle< DebugInfo > debug_info, JavaScriptFrame *frame)
Definition debug.cc:188
bool IsReturnOrSuspend() const
Definition debug.h:82
bool HasBreakPoint(Isolate *isolate, Handle< DebugInfo > debug_info) const
Definition debug.cc:290
bool IsDebuggerStatement() const
Definition debug.h:85
debug::BreakLocationType type() const
Definition debug.cc:311
DebugInfoCollection *const collection_
Definition debug.h:231
DebugInfoCollection::HandleLocation HandleLocation
Definition debug.h:230
Tagged< DebugInfo > Next() const
Definition debug.h:211
Iterator(DebugInfoCollection *collection)
Definition debug.h:204
void DeleteIndex(size_t index)
Definition debug.cc:594
void Insert(Tagged< SharedFunctionInfo > sfi, Tagged< DebugInfo > debug_info)
Definition debug.cc:547
std::unordered_map< SFIUniqueId, HandleLocation > map_
Definition debug.h:241
V8_EXPORT_PRIVATE Tagged< DebugInfo > EntryAsDebugInfo(size_t index) const
Definition debug.cc:589
DebugInfoCollection(Isolate *isolate)
Definition debug.h:191
bool Contains(Tagged< SharedFunctionInfo > sfi) const
Definition debug.cc:562
std::optional< Tagged< DebugInfo > > Find(Tagged< SharedFunctionInfo > sfi) const
Definition debug.cc:569
std::vector< HandleLocation > list_
Definition debug.h:240
void DeleteSlow(Tagged< SharedFunctionInfo > sfi)
Definition debug.cc:578
Isolate * isolate()
Definition debug.h:751
StackFrameId break_frame_id_
Definition debug.h:755
base::ElapsedTimer timer_
Definition debug.h:762
DebugScope * prev_
Definition debug.h:754
PostponeInterruptsScope no_interrupts_
Definition debug.h:756
Tagged< Object > ignore_step_into_function_
Definition debug.h:646
Tagged< Object > muted_function_
Definition debug.h:697
base::AtomicWord current_debug_scope_
Definition debug.h:636
Tagged< Object > return_value_
Definition debug.h:664
Tagged< Object > suspended_generator_
Definition debug.h:667
Debug(const Debug &)=delete
DebugInfoCollection debug_infos_
Definition debug.h:624
bool break_points_active() const
Definition debug.h:441
void clear_restart_frame()
Definition debug.h:477
bool CheckExecutionState()
Definition debug.h:404
bool ignore_events() const
Definition debug.h:523
Debug & operator=(const Debug &)=delete
int restart_inline_frame_index() const
Definition debug.h:481
void SetTemporaryObjectTrackingDisabled(bool disabled)
Definition debug.cc:3356
void AssertDebugContext()
Definition debug.h:584
Address hook_on_function_call_address()
Definition debug.h:454
bool break_disabled() const
Definition debug.h:485
void ActivateStepOut(StackFrame *frame)
std::atomic< bool > is_active_
Definition debug.h:604
void clear_suspended_generator()
Definition debug.h:528
ThreadLocal thread_local_
Definition debug.h:707
bool break_on_next_function_call() const
Definition debug.h:463
bool break_points_active_
Definition debug.h:615
void InitThread(const ExecutionAccess &lock)
Definition debug.h:402
friend void CheckDebuggerUnloaded()
void set_break_points_active(bool v)
Definition debug.h:440
void SetIsolateId(uint64_t id)
Definition debug.h:509
uint64_t isolate_id_
Definition debug.h:726
bool side_effect_check_failed_
Definition debug.h:621
std::unique_ptr< TemporaryObjectsTracker > temporary_objects_
Definition debug.h:628
Address is_active_address()
Definition debug.h:452
bool break_on_caught_exception_
Definition debug.h:617
StackFrameId break_frame_id()
Definition debug.h:443
void FreeThreadResources()
Definition debug.h:400
StepAction last_step_action()
Definition debug.h:462
bool break_on_uncaught_exception_
Definition debug.h:619
bool ShouldRestartFrame(StackFrameId id) const
Definition debug.h:474
bool scheduled_break_on_function_call() const
Definition debug.h:467
IndirectHandle< FunctionTemplateInfo > ignore_side_effects_for_function_template_info_
Definition debug.h:719
Tagged< Object > return_value()
Definition debug.h:446
bool has_suspended_generator() const
Definition debug.h:532
bool in_debug_scope() const
Definition debug.h:433
bool hook_on_function_call_
Definition debug.h:607
Isolate * isolate_
Definition debug.h:721
bool IsRestartFrameScheduled() const
Definition debug.h:471
std::function< void(Handle< DebugInfo >)> DebugInfoClearFunction
Definition debug.h:593
uint64_t IsolateId() const
Definition debug.h:508
bool is_active() const
Definition debug.h:432
Address suspended_generator_address()
Definition debug.h:458
bool needs_check_on_function_call() const
Definition debug.h:436
friend DirectHandle< FixedArray > GetDebuggedFunctions()
void set_return_value(Tagged< Object > value)
Definition debug.h:447
IndirectHandle< RegExpMatchInfo > regexp_match_info_
Definition debug.h:630
DisableBreak(const DisableBreak &)=delete
DisableBreak(Debug *debug, bool disable=true)
Definition debug.h:782
DisableBreak & operator=(const DisableBreak &)=delete
DisableTemporaryObjectTracking & operator=(const DisableTemporaryObjectTracking &)=delete
DisableTemporaryObjectTracking(const DisableTemporaryObjectTracking &)=delete
Handle< Object > return_value_
Definition debug.h:776
SuppressDebug(const SuppressDebug &)=delete
SuppressDebug & operator=(const SuppressDebug &)=delete
SuppressDebug(Debug *debug)
Definition debug.h:819
int start
int end
const int position_
ZoneVector< OpIndex > candidates
DisallowGarbageCollection no_gc_
Isolate * isolate
int32_t offset
TNode< Object > receiver
ZoneVector< RpoNumber > & result
int position
Definition liveedit.cc:290
Atomic32 AtomicWord
Definition atomicops.h:76
IgnoreBreakMode
Definition debug.h:64
@ kIgnoreIfTopFrameBlackboxed
Definition debug.h:66
@ kIgnoreIfAllFramesBlackboxed
Definition debug.h:65
@ LastStepAction
Definition debug.h:43
ExceptionBreakType
Definition debug.h:47
@ BreakCaughtException
Definition debug.h:48
@ BreakUncaughtException
Definition debug.h:49
@ DEBUG_BREAK_SLOT
Definition debug.h:58
@ DEBUG_BREAK_SLOT_AT_CALL
Definition debug.h:59
@ DEBUG_BREAK_AT_ENTRY
Definition debug.h:56
@ DEBUGGER_STATEMENT
Definition debug.h:57
@ DEBUG_BREAK_SLOT_AT_SUSPEND
Definition debug.h:61
@ NOT_DEBUG_BREAK
Definition debug.h:55
@ DEBUG_BREAK_SLOT_AT_RETURN
Definition debug.h:60
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671
#define V8_NODISCARD
Definition v8config.h:693
std::unique_ptr< ValueMirror > value