Loading...
Searching...
No Matches
v8-debug.h
Go to the documentation of this file.
1// Copyright 2021 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 INCLUDE_V8_DEBUG_H_
6#define INCLUDE_V8_DEBUG_H_
7
8#include <stdint.h>
9
10#include <span>
11
12#include "v8-script.h" // NOLINT(build/include_directory)
13#include "v8config.h" // NOLINT(build/include_directory)
14
15namespace v8 {
16
17class Isolate;
18class String;
19
24 public:
29
36 int GetLineNumber() const { return GetLocation().GetLineNumber() + 1; }
37
45 int GetColumn() const { return GetLocation().GetColumnNumber() + 1; }
46
51 int GetSourcePosition() const;
52
59 int GetScriptId() const;
60
66
74
79
85
90
95 bool IsEval() const;
96
101 bool IsConstructor() const;
102
106 bool IsWasm() const;
107
111 bool IsUserJavaScript() const;
112
117 bool IsScriptOpaque() const;
118};
119
126 public:
134 kLineNumber = 1,
135 kColumnOffset = 1 << 1 | kLineNumber,
136 kScriptName = 1 << 2,
137 kFunctionName = 1 << 3,
138 kIsEval = 1 << 4,
139 kIsConstructor = 1 << 5,
140 kScriptNameOrSourceURL = 1 << 6,
141 kScriptId = 1 << 7,
142 kExposeFramesAcrossSecurityOrigins = 1 << 8,
143 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
144 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
145 };
146
148 int id;
150 };
151
152 struct ScriptData {
153 int id;
156 };
157
161 int GetID() const;
162
166 Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
167
171 int GetFrameCount() const;
172
181 Isolate* isolate, int frame_limit, StackTraceOptions options = kDetailed);
182
194
203 static int CurrentScriptId(Isolate* isolate);
204
215 V8_DEPRECATE_SOON("Use CurrentScriptData instead")
216 static std::span<v8::StackTrace::ScriptIdAndContext>
217 CurrentScriptIdsAndContexts(Isolate* isolate,
218 std::span<ScriptIdAndContext> frame_data);
219
233 static std::span<v8::StackTrace::ScriptData> CurrentScriptData(
234 Isolate* isolate, std::span<ScriptData> frame_data);
235};
236
237} // namespace v8
238
239#endif // INCLUDE_V8_DEBUG_H_
Definition: v8-isolate.h:298
Definition: v8-local-handle.h:360
Definition: v8-script.h:127
Definition: v8-debug.h:23
int GetSourcePosition() const
int GetLineNumber() const
Definition: v8-debug.h:36
int GetColumn() const
Definition: v8-debug.h:45
bool IsUserJavaScript() const
Local< String > GetScriptName() const
Local< String > GetScriptNameOrSourceURL() const
Location GetLocation() const
Local< String > GetScriptSourceMappingURL() const
bool IsConstructor() const
bool IsScriptOpaque() const
bool IsEval() const
Local< String > GetFunctionName() const
int GetScriptId() const
Local< String > GetScriptSource() const
bool IsWasm() const
Definition: v8-debug.h:125
Local< StackFrame > GetFrame(Isolate *isolate, uint32_t index) const
static Local< StackTrace > CurrentStackTrace(Isolate *isolate, int frame_limit, StackTraceOptions options=kDetailed)
static Local< String > CurrentScriptNameOrSourceURL(Isolate *isolate)
static int CurrentScriptId(Isolate *isolate)
StackTraceOptions
Definition: v8-debug.h:133
int GetFrameCount() const
int GetID() const
Definition: libplatform.h:15
Definition: v8-debug.h:152
v8::Local< v8::Context > context
Definition: v8-debug.h:155
v8::Local< v8::Function > function
Definition: v8-debug.h:154
int id
Definition: v8-debug.h:153
Definition: v8-debug.h:147
int id
Definition: v8-debug.h:148
v8::Local< v8::Context > context
Definition: v8-debug.h:149
#define V8_EXPORT
Definition: v8config.h:874
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:631