[stringrefs] Support stringrefs in DevTools inspection
When a string is in a local or on the value stack at a breakpoint, DevTools should be able to show its value. Bug: v8:12868 Change-Id: I79014d74c8ef7b212469382bdedca85568b3bcc7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3834038 Commit-Queue: Philip Pfaffe <pfaffe@chromium.org> Auto-Submit: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/main@{#82542}
This commit is contained in:
parent
a849c595ed
commit
564c0978f4
@ -905,7 +905,6 @@ Handle<WasmValueObject> WasmValueObject::New(
|
||||
}
|
||||
case wasm::kRefNull:
|
||||
case wasm::kRef: {
|
||||
// TODO(12868): Support stringrefs.
|
||||
t = GetRefTypeName(isolate, value.type(), module_object->native_module());
|
||||
Handle<Object> ref = value.to_ref();
|
||||
if (ref->IsWasmStruct()) {
|
||||
@ -916,6 +915,7 @@ Handle<WasmValueObject> WasmValueObject::New(
|
||||
v = handle(Handle<WasmInternalFunction>::cast(ref)->external(),
|
||||
isolate);
|
||||
} else if (ref->IsJSFunction() || ref->IsSmi() || ref->IsNull() ||
|
||||
ref->IsString() ||
|
||||
value.type().is_reference_to(wasm::HeapType::kExtern)) {
|
||||
v = ref;
|
||||
} else {
|
||||
|
@ -3,18 +3,20 @@ Tests GC object inspection.
|
||||
Running test: test
|
||||
Instantiating.
|
||||
Waiting for wasm script (ignoring first non-wasm script).
|
||||
Setting breakpoint at offset 100 on script wasm://wasm/00670fd6
|
||||
Setting breakpoint at offset 103 on script wasm://wasm/476d7da6
|
||||
Calling main()
|
||||
Paused:
|
||||
Script wasm://wasm/00670fd6 byte offset 100: Wasm opcode 0x21 (kExprLocalSet)
|
||||
Script wasm://wasm/476d7da6 byte offset 103: Wasm opcode 0x1a (kExprDrop)
|
||||
Scope:
|
||||
at $main (0:100):
|
||||
at $main (0:103):
|
||||
- scope (wasm-expression-stack):
|
||||
0: Array ((ref $ArrC))
|
||||
1: hello world (stringref)
|
||||
object details:
|
||||
0: Struct ((ref null $StrA))
|
||||
length: 1 (number)
|
||||
- scope (local):
|
||||
$var0: hello world (stringref)
|
||||
$varA: Struct ((ref null $StrA))
|
||||
$varB: null ((ref null $ArrC))
|
||||
object details:
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --experimental-wasm-gc
|
||||
// Flags: --experimental-wasm-gc --experimental-wasm-stringref
|
||||
|
||||
utils.load('test/inspector/wasm-inspector-test.js');
|
||||
|
||||
@ -14,7 +14,7 @@ const module_bytes = [
|
||||
0x00, 0x61, 0x73, 0x6d, 1, 0, 0, 0, // wasm magic
|
||||
|
||||
0x01, // type section
|
||||
0x18, // section length
|
||||
0x19, // section length
|
||||
0x01, // number of type section entries
|
||||
0x4f, // recursive type group
|
||||
0x04, // number of types in the recursive group
|
||||
@ -33,7 +33,7 @@ const module_bytes = [
|
||||
0x6c, 0x00, 0x01, // mut ref null $StrA
|
||||
// type 3: func
|
||||
0x60, // signature
|
||||
0x00, // number of params
|
||||
0x01, 0x64, // 1 param: stringref
|
||||
0x00, // number of results
|
||||
|
||||
0x03, // function section
|
||||
@ -59,10 +59,10 @@ const module_bytes = [
|
||||
|
||||
/////////////////////////// CODE SECTION //////////////////////////
|
||||
0x0a, // code section
|
||||
0x2c, // section length
|
||||
0x2f, // section length
|
||||
0x01, // number of functions
|
||||
|
||||
0x2a, // function 0: size
|
||||
0x2d, // function 0: size
|
||||
0x02, // number of locals
|
||||
0x01, 0x6c, 0x00, // (local $varA (ref null $StrA))
|
||||
0x01, 0x6c, 0x02, // (local $varC (ref null $ArrC))
|
||||
@ -71,16 +71,18 @@ const module_bytes = [
|
||||
0x41, 0xFF, 0xFF, 0x01, // i32.const 32767
|
||||
0xfb, 0x08, 0x01, // struct.new_default $StrB
|
||||
0xfb, 0x07, 0x00, // struct.new $StrA
|
||||
0x22, 0x00, // local.tee $varA
|
||||
0x22, 0x01, // local.tee $varA
|
||||
// $varA.$pointer.$next = $varA
|
||||
0xfb, 0x03, 0x00, 0x02, // struct.get $StrA $pointer
|
||||
0x20, 0x00, // local.get $varA
|
||||
0x20, 0x01, // local.get $varA
|
||||
0xfb, 0x06, 0x01, 0x00, // struct.set $StrB $next
|
||||
// $varC := new $ArrC($varA)
|
||||
0x20, 0x00, // local.get $varA -- value
|
||||
0x20, 0x01, // local.get $varA -- value
|
||||
0x41, 0x01, // i32.const 1 -- length
|
||||
0xfb, 0x1b, 0x02, // array.new $ArrC
|
||||
0x21, 0x01, // local.set $varC
|
||||
0x20, 0x00, // local.get 0
|
||||
0x1a, // drop
|
||||
0x21, 0x02, // local.set $varC
|
||||
0x0b, // end
|
||||
|
||||
/////////////////////////// NAME SECTION //////////////////////////
|
||||
@ -94,10 +96,10 @@ const module_bytes = [
|
||||
0x01, // number of entries
|
||||
0x00, // for function 0
|
||||
0x02, // number of entries for function 0
|
||||
0x00, // local index
|
||||
0x01, // local index
|
||||
0x04, // length of "varA"
|
||||
0x76, 0x61, 0x72, 0x41, // "varA"
|
||||
0x01, // local index
|
||||
0x02, // local index
|
||||
0x04, // length of "varB"
|
||||
0x76, 0x61, 0x72, 0x42, // "varB"
|
||||
|
||||
@ -218,10 +220,11 @@ InspectorTest.runAsyncTestSuite([
|
||||
// Ignore javascript and full module wasm script, get scripts for functions.
|
||||
const [, {params: wasm_script}] =
|
||||
await Protocol.Debugger.onceScriptParsed(2);
|
||||
let offset = 100; // "local.set $varC" at the end.
|
||||
let offset = 103; // "drop" before "local.set $varC" at the end.
|
||||
await setBreakpoint(offset, wasm_script.scriptId, wasm_script.url);
|
||||
InspectorTest.log('Calling main()');
|
||||
await WasmInspectorTest.evalWithUrl('instance.exports.main()', 'runWasm');
|
||||
await WasmInspectorTest.evalWithUrl('instance.exports.main("hello world")',
|
||||
'runWasm');
|
||||
InspectorTest.log('exports.main returned!');
|
||||
}
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user