Commit e71d328f authored by Philip Pfaffe's avatar Philip Pfaffe Committed by Commit Bot

Report additional wasm script info on the CDP

Add a scriptLanguage enum to the new scripts events. This overhauls
crrev.com/c/2011083 that was related. Report the code section offset
as well as the script language on the Debugger.scriptParsed and
Debugger.scriptFailedToParse events.

Bug: chromium:1057569
Change-Id: I40b43f28f0b3e094720db4fc1f07db1a0c293ee0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2083025Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66749}
parent a48da5f6
......@@ -503,6 +503,12 @@ domain Debugger
# Fired when the virtual machine resumed execution.
event resumed
# Enum of possible script languages.
type ScriptLanguage extends string
enum
JavaScript
WebAssembly
# Fired when virtual machine fails to parse the script.
event scriptFailedToParse
parameters
......@@ -534,6 +540,10 @@ domain Debugger
optional integer length
# JavaScript top stack frame of where the script parsed event was triggered if available.
experimental optional Runtime.StackTrace stackTrace
# If the scriptLanguage is WebAssembly, the code section offset in the module.
experimental optional integer codeOffset
# The language of the script.
experimental optional Debugger.ScriptLanguage scriptLanguage
# Fired when virtual machine parses script. This event is also fired for all known and uncollected
# scripts upon enabling debugger.
......@@ -569,6 +579,10 @@ domain Debugger
optional integer length
# JavaScript top stack frame of where the script parsed event was triggered if available.
experimental optional Runtime.StackTrace stackTrace
# If the scriptLanguage is WebAssembly, the code section offset in the module.
experimental optional integer codeOffset
# The language of the script.
experimental optional Debugger.ScriptLanguage scriptLanguage
experimental domain HeapProfiler
depends on Runtime
......
......@@ -9848,6 +9848,15 @@ uint32_t debug::WasmScript::GetFunctionHash(int function_index) {
function_bytes.length(), 0);
}
int debug::WasmScript::CodeOffset() const {
i::Handle<i::Script> script = Utils::OpenHandle(this);
DCHECK_EQ(i::Script::TYPE_WASM, script->type());
i::wasm::NativeModule* native_module = script->wasm_native_module();
const i::wasm::WasmModule* module = native_module->module();
return module->code.offset();
}
debug::Location::Location(int line_number, int column_number)
: line_number_(line_number),
column_number_(column_number),
......
......@@ -181,6 +181,9 @@ class WasmScript : public Script {
int GetContainingFunction(int byte_offset) const;
uint32_t GetFunctionHash(int function_index);
int CodeOffset() const;
int CodeLength() const;
};
V8_EXPORT_PRIVATE void GetLoadedScripts(
......
......@@ -11,6 +11,7 @@
#include "src/debug/debug-interface.h"
#include "src/inspector/injected-script.h"
#include "src/inspector/inspected-context.h"
#include "src/inspector/protocol/Debugger.h"
#include "src/inspector/protocol/Protocol.h"
#include "src/inspector/remote-object-id.h"
#include "src/inspector/search-util.h"
......@@ -1401,6 +1402,15 @@ bool V8DebuggerAgentImpl::isPaused() const {
return m_debugger->isPausedInContextGroup(m_session->contextGroupId());
}
static String16 getScriptLanguage(const V8DebuggerScript& script) {
switch (script.getLanguage()) {
case V8DebuggerScript::Language::WebAssembly:
return protocol::Debugger::ScriptLanguageEnum::WebAssembly;
case V8DebuggerScript::Language::JavaScript:
return protocol::Debugger::ScriptLanguageEnum::JavaScript;
}
}
void V8DebuggerAgentImpl::didParseSource(
std::unique_ptr<V8DebuggerScript> script, bool success) {
v8::HandleScope handles(m_isolate);
......@@ -1431,6 +1441,11 @@ void V8DebuggerAgentImpl::didParseSource(
bool isModule = script->isModule();
String16 scriptId = script->scriptId();
String16 scriptURL = script->sourceURL();
String16 scriptLanguage = getScriptLanguage(*script);
Maybe<int> codeOffset =
script->getLanguage() == V8DebuggerScript::Language::JavaScript
? Maybe<int>()
: script->codeOffset();
m_scripts[scriptId] = std::move(script);
// Release the strong reference to get notified when debugger is the only
......@@ -1466,7 +1481,8 @@ void V8DebuggerAgentImpl::didParseSource(
scriptRef->endLine(), scriptRef->endColumn(), contextId,
scriptRef->hash(), std::move(executionContextAuxDataParam),
std::move(sourceMapURLParam), hasSourceURLParam, isModuleParam,
scriptRef->length(), std::move(stackTrace));
scriptRef->length(), std::move(stackTrace), std::move(codeOffset),
std::move(scriptLanguage));
return;
}
......@@ -1477,14 +1493,16 @@ void V8DebuggerAgentImpl::didParseSource(
scriptId, scriptURL, 0, 0, 0, 0, contextId, scriptRef->hash(),
std::move(executionContextAuxDataParam), isLiveEditParam,
std::move(sourceMapURLParam), hasSourceURLParam, isModuleParam, 0,
std::move(stackTrace));
std::move(stackTrace), std::move(codeOffset),
std::move(scriptLanguage));
} else {
m_frontend.scriptParsed(
scriptId, scriptURL, scriptRef->startLine(), scriptRef->startColumn(),
scriptRef->endLine(), scriptRef->endColumn(), contextId,
scriptRef->hash(), std::move(executionContextAuxDataParam),
isLiveEditParam, std::move(sourceMapURLParam), hasSourceURLParam,
isModuleParam, scriptRef->length(), std::move(stackTrace));
isModuleParam, scriptRef->length(), std::move(stackTrace),
std::move(codeOffset), std::move(scriptLanguage));
}
std::vector<protocol::DictionaryValue*> potentialBreakpoints;
......
......@@ -6,6 +6,7 @@
#include "src/base/memory.h"
#include "src/inspector/inspected-context.h"
#include "src/inspector/protocol/Debugger.h"
#include "src/inspector/string-util.h"
#include "src/inspector/v8-debugger-agent-impl.h"
#include "src/inspector/v8-inspector-impl.h"
......@@ -120,10 +121,16 @@ class ActualScript : public V8DebuggerScript {
if (!script->IsWasm()) return v8::Nothing<v8::MemorySpan<const uint8_t>>();
return v8::Just(v8::debug::WasmScript::Cast(*script)->Bytecode());
}
Language getLanguage() const override { return m_language; }
int startLine() const override { return m_startLine; }
int startColumn() const override { return m_startColumn; }
int endLine() const override { return m_endLine; }
int endColumn() const override { return m_endColumn; }
int codeOffset() const override {
auto script = this->script();
if (!script->IsWasm()) return 0;
return v8::debug::WasmScript::Cast(*script)->CodeOffset();
}
bool isSourceLoadedLazily() const override { return false; }
int length() const override {
v8::HandleScope scope(m_isolate);
......@@ -274,6 +281,11 @@ class ActualScript : public V8DebuggerScript {
}
USE(script->ContextId().To(&m_executionContextId));
if (script->IsWasm()) {
m_language = V8DebuggerScript::Language::WebAssembly;
} else {
m_language = V8DebuggerScript::Language::JavaScript;
}
m_isModule = script->IsModule();
......@@ -297,6 +309,7 @@ class ActualScript : public V8DebuggerScript {
V8DebuggerAgentImpl* m_agent;
String16 m_sourceMappingURL;
Language m_language;
bool m_isLiveEdit = false;
bool m_isModule = false;
mutable String16 m_hash;
......
......@@ -46,6 +46,7 @@ class V8InspectorClient;
class V8DebuggerScript {
public:
enum class Language { JavaScript, WebAssembly };
static std::unique_ptr<V8DebuggerScript> Create(
v8::Isolate* isolate, v8::Local<v8::debug::Script> script,
bool isLiveEdit, V8DebuggerAgentImpl* agent, V8InspectorClient* client);
......@@ -59,11 +60,13 @@ class V8DebuggerScript {
virtual const String16& sourceMappingURL() const = 0;
virtual String16 source(size_t pos, size_t len = UINT_MAX) const = 0;
virtual v8::Maybe<v8::MemorySpan<const uint8_t>> wasmBytecode() const = 0;
virtual Language getLanguage() const = 0;
virtual const String16& hash() const = 0;
virtual int startLine() const = 0;
virtual int startColumn() const = 0;
virtual int endLine() const = 0;
virtual int endColumn() const = 0;
virtual int codeOffset() const = 0;
int executionContextId() const { return m_executionContextId; }
virtual bool isLiveEdit() const = 0;
virtual bool isModule() const = 0;
......
......@@ -2190,6 +2190,7 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(
int num_functions, uint32_t offset,
std::shared_ptr<WireBytesStorage> wire_bytes_storage,
int code_section_length) {
DCHECK_LE(0, code_section_length);
before_code_section_ = false;
TRACE_STREAMING("Start the code section with %d functions...\n",
num_functions);
......@@ -2219,6 +2220,8 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(
uses_liftoff);
job_->DoImmediately<AsyncCompileJob::PrepareAndStartCompile>(
decoder_.shared_module(), false, code_size_estimate);
decoder_.set_code_section(offset, static_cast<uint32_t>(code_section_length));
auto* compilation_state = Impl(job_->native_module_->compilation_state());
compilation_state->SetWireBytesStorage(std::move(wire_bytes_storage));
DCHECK_EQ(job_->native_module_->module()->origin, kWasmOrigin);
......
......@@ -913,6 +913,8 @@ class ModuleDecoderImpl : public Decoder {
if (failed()) break;
DecodeFunctionBody(i, size, offset, verify_functions);
}
DCHECK_GE(pc_offset(), pos);
set_code_section(pos, pc_offset() - pos);
}
bool CheckFunctionsCount(uint32_t functions_count, uint32_t offset) {
......@@ -1204,6 +1206,10 @@ class ModuleDecoderImpl : public Decoder {
return result;
}
void set_code_section(uint32_t offset, uint32_t size) {
module_->code = {offset, size};
}
// Decodes an entire module.
ModuleResult DecodeModule(Counters* counters, AccountingAllocator* allocator,
bool verify_functions = true) {
......@@ -2036,6 +2042,10 @@ ModuleResult ModuleDecoder::FinishDecoding(bool verify_functions) {
return impl_->FinishDecoding(verify_functions);
}
void ModuleDecoder::set_code_section(uint32_t offset, uint32_t size) {
return impl_->set_code_section(offset, size);
}
size_t ModuleDecoder::IdentifyUnknownSection(ModuleDecoder* decoder,
Vector<const uint8_t> bytes,
uint32_t offset,
......
......@@ -194,6 +194,8 @@ class ModuleDecoder {
ModuleResult FinishDecoding(bool verify_functions = true);
void set_code_section(uint32_t offset, uint32_t size);
const std::shared_ptr<WasmModule>& shared_module() const;
WasmModule* module() const { return shared_module().get(); }
......
......@@ -255,6 +255,7 @@ struct V8_EXPORT_PRIVATE WasmModule {
uint32_t num_declared_functions = 0; // excluding imported
uint32_t num_exported_functions = 0;
uint32_t num_declared_data_segments = 0; // From the DataCount section.
WireBytesRef code = {0, 0};
WireBytesRef name = {0, 0};
std::vector<const FunctionSig*> signatures; // by signature index
std::vector<uint32_t> signature_ids; // by signature index
......
......@@ -1215,6 +1215,39 @@ STREAM_TEST(TestCompileErrorFunctionName) {
}
}
STREAM_TEST(TestSetModuleCodeSection) {
StreamTester tester;
uint8_t code[] = {
U32V_1(1), // functions count
U32V_1(4), // body size
U32V_1(0), // locals count
kExprLocalGet, 0, kExprEnd // body
};
const uint8_t bytes[] = {
WASM_MODULE_HEADER, // module header
kTypeSectionCode, // section code
U32V_1(1 + SIZEOF_SIG_ENTRY_x_x), // section size
U32V_1(1), // type count
SIG_ENTRY_x_x(kLocalI32, kLocalI32), // signature entry
kFunctionSectionCode, // section code
U32V_1(1 + 1), // section size
U32V_1(1), // functions count
0, // signature index
kCodeSectionCode, // section code
U32V_1(arraysize(code)), // section size
};
tester.OnBytesReceived(bytes, arraysize(bytes));
tester.OnBytesReceived(code, arraysize(code));
tester.FinishStream();
tester.RunCompilerTasks();
CHECK_EQ(tester.native_module()->module()->code.offset(), arraysize(bytes));
CHECK_EQ(tester.native_module()->module()->code.length(), arraysize(code));
CHECK(tester.IsPromiseFulfilled());
}
#undef STREAM_TEST
} // namespace wasm
......
......@@ -13,6 +13,7 @@ Running test: testLoadedModulesOnDebuggerEnable
isModule : true
length : 39
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -33,6 +34,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled
isModule : true
length : 39
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -50,6 +52,7 @@ Running test: testScriptEventsWhenDebuggerIsEnabled
isModule : true
length : 1
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
......@@ -10,6 +10,7 @@ getPossibleBreakpoints should not crash during lazy compilation (crbug.com/71533
isModule : false
length : 56
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
......@@ -12,6 +12,7 @@ Check script with url:
isModule : false
length : 16
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -31,6 +32,7 @@ Check script with sourceURL comment:
isModule : false
length : 37
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -49,6 +51,7 @@ Check script failed to parse:
isModule : false
length : 15
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -67,6 +70,7 @@ Check script failed to parse with sourceURL comment:
isModule : false
length : 36
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
......@@ -13,6 +13,7 @@ scriptParsed
isModule : false
length : 42
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -32,6 +33,7 @@ scriptParsed
isModule : false
length : 52
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -51,6 +53,7 @@ scriptParsed
isModule : false
length : 43
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -70,6 +73,7 @@ scriptParsed
isModule : false
length : 46
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -89,6 +93,7 @@ scriptParsed
isModule : false
length : 50
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : oneline-map
startColumn : 0
startLine : 0
......@@ -108,6 +113,7 @@ scriptParsed
isModule : false
length : 60
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : oneline-without-nl-map
startColumn : 0
startLine : 0
......@@ -127,6 +133,7 @@ scriptParsed
isModule : false
length : 51
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : twoline-map
startColumn : 0
startLine : 0
......@@ -146,6 +153,7 @@ scriptParsed
isModule : false
length : 54
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : threeline-map
startColumn : 0
startLine : 0
......@@ -165,6 +173,7 @@ scriptParsed
isModule : false
length : 88
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : source-mapping-url-map
startColumn : 0
startLine : 0
......@@ -184,6 +193,7 @@ scriptParsed
isModule : false
length : 89
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : source-mapping-url-map
startColumn : 0
startLine : 0
......@@ -203,6 +213,7 @@ scriptParsed
isModule : false
length : 40
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -222,6 +233,7 @@ scriptParsed
isModule : false
length : 41
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -241,6 +253,7 @@ scriptParsed
isModule : false
length : 18
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -260,6 +273,7 @@ scriptParsed
isModule : false
length : 96
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -279,6 +293,7 @@ scriptParsed
isModule : false
length : 39
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -298,6 +313,7 @@ scriptParsed
isModule : false
length : 19
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -317,6 +333,7 @@ scriptParsed
isModule : false
length : 20
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -336,6 +353,7 @@ scriptParsed
isModule : false
length : 21
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -355,6 +373,7 @@ scriptParsed
isModule : false
length : 22
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -374,6 +393,7 @@ scriptParsed
isModule : false
length : 42
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -393,6 +413,7 @@ scriptParsed
isModule : false
length : 52
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -412,6 +433,7 @@ scriptParsed
isModule : false
length : 43
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -431,6 +453,7 @@ scriptParsed
isModule : false
length : 46
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -450,6 +473,7 @@ scriptParsed
isModule : false
length : 50
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : oneline-map
startColumn : 0
startLine : 0
......@@ -469,6 +493,7 @@ scriptParsed
isModule : false
length : 60
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : oneline-without-nl-map
startColumn : 0
startLine : 0
......@@ -488,6 +513,7 @@ scriptParsed
isModule : false
length : 51
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : twoline-map
startColumn : 0
startLine : 0
......@@ -507,6 +533,7 @@ scriptParsed
isModule : false
length : 54
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : threeline-map
startColumn : 0
startLine : 0
......@@ -526,6 +553,7 @@ scriptParsed
isModule : false
length : 88
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : source-mapping-url-map
startColumn : 0
startLine : 0
......@@ -545,6 +573,7 @@ scriptParsed
isModule : false
length : 89
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : source-mapping-url-map
startColumn : 0
startLine : 0
......@@ -564,6 +593,7 @@ scriptParsed
isModule : false
length : 40
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -583,6 +613,7 @@ scriptParsed
isModule : false
length : 41
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -602,6 +633,7 @@ scriptParsed
isModule : false
length : 18
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -621,6 +653,7 @@ scriptParsed
isModule : false
length : 96
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -640,6 +673,7 @@ scriptParsed
isModule : false
length : 39
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......@@ -669,6 +703,7 @@ scriptFailedToParse
isModule : false
length : 31
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -687,6 +722,7 @@ scriptFailedToParse
isModule : false
length : 56
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL : failed-map
startColumn : 0
startLine : 0
......@@ -706,6 +742,7 @@ scriptParsed
isModule : false
length : 19
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -725,6 +762,7 @@ scriptParsed
isModule : false
length : 20
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -744,6 +782,7 @@ scriptParsed
isModule : false
length : 21
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -763,6 +802,7 @@ scriptParsed
isModule : false
length : 22
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
......@@ -11,6 +11,7 @@ Debugger.scriptParsed.stackTrace should contain only one frame
isModule : false
length : 0
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......
......@@ -12,6 +12,7 @@ Runtime.evaluate with valid expression
isModule : false
length : 29
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -30,6 +31,7 @@ Runtime.evaluate with syntax error
isModule : false
length : 39
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -49,6 +51,7 @@ Runtime.callFunctionOn with valid functionDeclaration
isModule : false
length : 18
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -67,6 +70,7 @@ Runtime.callFunctionOn with syntax error
isModule : false
length : 3
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -86,6 +90,7 @@ Runtime.compileScript with valid expression
isModule : false
length : 4
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -104,6 +109,7 @@ Runtime.compileScript with syntax error
isModule : false
length : 1
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -124,6 +130,7 @@ Runtime.evaluate compiled script with stack trace
isModule : false
length : 8
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -142,6 +149,7 @@ Runtime.evaluate compiled script with stack trace
isModule : false
length : 86
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......@@ -171,6 +179,7 @@ Runtime.evaluate compiled script with stack trace
isModule : false
length : 4
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......@@ -201,6 +210,7 @@ Runtime.evaluate compile script error with stack trace
isModule : false
length : 12
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -219,6 +229,7 @@ Runtime.evaluate compile script error with stack trace
isModule : false
length : 98
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......@@ -247,6 +258,7 @@ Runtime.evaluate compile script error with stack trace
isModule : false
length : 3
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
stackTrace : {
callFrames : [
......
......@@ -9,6 +9,7 @@ Tests scripts hasing
isModule : false
length : 1
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -24,6 +25,7 @@ Tests scripts hasing
isModule : false
length : 3
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -39,6 +41,7 @@ Tests scripts hasing
isModule : false
length : 8106
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
Tests how wasm scripts are reported
Check that each inspector gets a wasm script at module creation time.
Session #1: Script #0 parsed. URL: wasm://wasm/7b04570e. Source map URL:
Session #2: Script #0 parsed. URL: wasm://wasm/7b04570e. Source map URL:
Session #1: Script #1 parsed. URL: wasm://wasm/ba7c35be. Source map URL: wasm://dwarf
Session #2: Script #1 parsed. URL: wasm://wasm/ba7c35be. Source map URL: wasm://dwarf
Session #1: Script #2 parsed. URL: wasm://wasm/1baa71fe. Source map URL: abc
Session #2: Script #2 parsed. URL: wasm://wasm/1baa71fe. Source map URL: abc
Session #1: Script #3 parsed. URL: wasm://wasm/95e97206. Source map URL: abc
Session #2: Script #3 parsed. URL: wasm://wasm/95e97206. Source map URL: abc
Session #1: Script #4 parsed. URL: wasm://wasm/7ab47392. Source map URL: abc
Session #2: Script #4 parsed. URL: wasm://wasm/7ab47392. Source map URL: abc
Session #1: Script #0 parsed. URL: wasm://wasm/7b04570e. Source map URL: , module begin: 0, module end: 0, code offset: 34
Session #2: Script #0 parsed. URL: wasm://wasm/7b04570e. Source map URL: , module begin: 0, module end: 0, code offset: 34
Session #1: Script #1 parsed. URL: wasm://wasm/ba7c35be. Source map URL: wasm://dwarf, module begin: 0, module end: 0, code offset: 34
Session #2: Script #1 parsed. URL: wasm://wasm/ba7c35be. Source map URL: wasm://dwarf, module begin: 0, module end: 0, code offset: 34
Session #1: Script #2 parsed. URL: wasm://wasm/1baa71fe. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #2: Script #2 parsed. URL: wasm://wasm/1baa71fe. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #1: Script #3 parsed. URL: wasm://wasm/95e97206. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #2: Script #3 parsed. URL: wasm://wasm/95e97206. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #1: Script #4 parsed. URL: wasm://wasm/7ab47392. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #2: Script #4 parsed. URL: wasm://wasm/7ab47392. Source map URL: abc, module begin: 0, module end: 0, code offset: 34
Session #1: Source for wasm://wasm/7b04570e:
Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e
Imports: []
......
......@@ -85,9 +85,13 @@ function trackScripts(debuggerParams) {
Protocol.Debugger.enable(debuggerParams);
Protocol.Debugger.onScriptParsed(handleScriptParsed);
async function loadScript({url, scriptId, sourceMapURL}) {
InspectorTest.log(`Session #${sessionId}: Script #${scripts.length} parsed. URL: ${url}. Source map URL: ${sourceMapURL}`);
let {result: {scriptSource, bytecode}} = await Protocol.Debugger.getScriptSource({scriptId});
async function loadScript(
{url, scriptId, sourceMapURL, startColumn, endColumn, codeOffset}) {
InspectorTest.log(`Session #${sessionId}: Script #${
scripts.length} parsed. URL: ${url}. Source map URL: ${
sourceMapURL}, module begin: ${startColumn}, module end: ${endColumn}, code offset: ${codeOffset}`);
let {result: {scriptSource, bytecode}} =
await Protocol.Debugger.getScriptSource({scriptId});
if (bytecode) {
if (scriptSource) {
InspectorTest.log('Unexpected scriptSource with bytecode: ');
......
......@@ -11,6 +11,7 @@ Checks basic ES6 modules support.
isModule : true
length : 83
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -29,6 +30,7 @@ Checks basic ES6 modules support.
isModule : true
length : 84
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -47,6 +49,7 @@ Checks basic ES6 modules support.
isModule : true
length : 286
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......@@ -206,6 +209,7 @@ console.log(239)
isModule : true
length : 1
scriptId : <scriptId>
scriptLanguage : JavaScript
sourceMapURL :
startColumn : 0
startLine : 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment