Commit e5ef9eb5 authored by Ingvar Stepanyan's avatar Ingvar Stepanyan Committed by Commit Bot

[wasm] Align raw Wasm URLs with disassembled ones

If script is not disassembled, still use the same script URL format for
consistency.

In particular, use an absolute `wasm://wasm/` prefix, like disassembled fake
scripts do, instead of just a script name which appears to be a
relative URL to devtools.

Change-Id: Ib7632f9f3587ca4961eb4f0b884482b3a1a6e1f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1833685Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Ingvar Stepanyan <rreverser@google.com>
Cr-Commit-Position: refs/heads/master@{#64086}
parent eea2006b
......@@ -2693,12 +2693,21 @@ Handle<Script> CreateWasmScript(Isolate* isolate,
const int kBufferSize = 32;
char buffer[kBufferSize];
Handle<String> url_prefix =
isolate->factory()->InternalizeString(StaticCharVector("wasm://wasm/"));
int name_chars = SNPrintF(ArrayVector(buffer), "wasm-%08x", hash);
DCHECK(name_chars >= 0 && name_chars < kBufferSize);
MaybeHandle<String> name_str = isolate->factory()->NewStringFromOneByte(
VectorOf(reinterpret_cast<uint8_t*>(buffer), name_chars),
AllocationType::kOld);
script->set_name(*name_str.ToHandleChecked());
Handle<String> name_str =
isolate->factory()
->NewStringFromOneByte(
VectorOf(reinterpret_cast<uint8_t*>(buffer), name_chars),
AllocationType::kOld)
.ToHandleChecked();
script->set_name(*name_str);
MaybeHandle<String> url_str =
isolate->factory()->NewConsString(url_prefix, name_str);
script->set_source_url(*url_str.ToHandleChecked());
if (source_map_url.size() != 0) {
MaybeHandle<String> src_map_str = isolate->factory()->NewStringFromUtf8(
......
......@@ -4,7 +4,7 @@ Session #1: Script #0 parsed. URL: wasm://wasm/wasm-77a937ae/wasm-77a937ae-0
Session #1: Script #1 parsed. URL: wasm://wasm/wasm-77a937ae/wasm-77a937ae-1
Session #2: Script #0 parsed. URL: wasm://wasm/wasm-77a937ae/wasm-77a937ae-0
Session #2: Script #1 parsed. URL: wasm://wasm/wasm-77a937ae/wasm-77a937ae-1
Session #3: Script #0 parsed. URL: wasm-77a937ae
Session #3: Script #0 parsed. URL: wasm://wasm/wasm-77a937ae
Session #1: Source for wasm://wasm/wasm-77a937ae/wasm-77a937ae-0:
func $nopFunction
nop
......@@ -31,7 +31,7 @@ func $main
end
end
Session #3: Source for wasm-77a937ae:
Session #3: Source for wasm://wasm/wasm-77a937ae:
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 0c 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 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: []
Exports: [main: function]
Tests stepping through wasm scripts with source maps
Installing code an global variable and instantiate.
Got wasm script: wasm-9b4bf87e
Got wasm script: wasm://wasm/wasm-9b4bf87e
Script sourceMapURL: abc
Requesting source for wasm-9b4bf87e...
Requesting source for wasm://wasm/wasm-9b4bf87e...
Source retrieved without error: true
Setting breakpoint on offset 54 (on the setlocal before the call), url wasm-9b4bf87e
Setting breakpoint on offset 54 (on the setlocal before the call), url wasm://wasm/wasm-9b4bf87e
{
columnNumber : 54
lineNumber : 0
scriptId : <scriptId>
}
Paused at wasm-9b4bf87e:0:54
Paused at wasm://wasm/wasm-9b4bf87e:0:54
at wasm_B (0:54):
- scope (global):
-- skipped
......@@ -21,7 +21,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:56
Paused at wasm://wasm/wasm-9b4bf87e:0:56
at wasm_B (0:56):
- scope (global):
-- skipped
......@@ -32,7 +32,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:38
Paused at wasm://wasm/wasm-9b4bf87e:0:38
at wasm_A (0:38):
- scope (global):
-- skipped
......@@ -48,7 +48,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Paused at wasm-9b4bf87e:0:39
Paused at wasm://wasm/wasm-9b4bf87e:0:39
at wasm_A (0:39):
- scope (global):
-- skipped
......@@ -64,7 +64,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Paused at wasm-9b4bf87e:0:58
Paused at wasm://wasm/wasm-9b4bf87e:0:58
at wasm_B (0:58):
- scope (global):
-- skipped
......@@ -75,7 +75,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Paused at wasm-9b4bf87e:0:54
Paused at wasm://wasm/wasm-9b4bf87e:0:54
at wasm_B (0:54):
- scope (global):
-- skipped
......@@ -86,7 +86,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Paused at wasm-9b4bf87e:0:56
Paused at wasm://wasm/wasm-9b4bf87e:0:56
at wasm_B (0:56):
- scope (global):
-- skipped
......@@ -97,7 +97,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Paused at wasm-9b4bf87e:0:58
Paused at wasm://wasm/wasm-9b4bf87e:0:58
at wasm_B (0:58):
- scope (global):
-- skipped
......@@ -108,7 +108,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.resume called
Paused at wasm-9b4bf87e:0:54
Paused at wasm://wasm/wasm-9b4bf87e:0:54
at wasm_B (0:54):
- scope (global):
-- skipped
......@@ -119,7 +119,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:56
Paused at wasm://wasm/wasm-9b4bf87e:0:56
at wasm_B (0:56):
- scope (global):
-- skipped
......@@ -130,7 +130,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:38
Paused at wasm://wasm/wasm-9b4bf87e:0:38
at wasm_A (0:38):
- scope (global):
-- skipped
......@@ -146,7 +146,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Paused at wasm-9b4bf87e:0:58
Paused at wasm://wasm/wasm-9b4bf87e:0:58
at wasm_B (0:58):
- scope (global):
-- skipped
......@@ -157,7 +157,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:43
Paused at wasm://wasm/wasm-9b4bf87e:0:43
at wasm_B (0:43):
- scope (global):
-- skipped
......@@ -168,7 +168,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:45
Paused at wasm://wasm/wasm-9b4bf87e:0:45
at wasm_B (0:45):
- scope (global):
-- skipped
......@@ -179,7 +179,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:47
Paused at wasm://wasm/wasm-9b4bf87e:0:47
at wasm_B (0:47):
- scope (global):
-- skipped
......@@ -190,7 +190,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:49
Paused at wasm://wasm/wasm-9b4bf87e:0:49
at wasm_B (0:49):
- scope (global):
-- skipped
......@@ -201,7 +201,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:51
Paused at wasm://wasm/wasm-9b4bf87e:0:51
at wasm_B (0:51):
- scope (global):
-- skipped
......@@ -212,7 +212,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:53
Paused at wasm://wasm/wasm-9b4bf87e:0:53
at wasm_B (0:53):
- scope (global):
-- skipped
......@@ -223,7 +223,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:54
Paused at wasm://wasm/wasm-9b4bf87e:0:54
at wasm_B (0:54):
- scope (global):
-- skipped
......@@ -234,7 +234,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:56
Paused at wasm://wasm/wasm-9b4bf87e:0:56
at wasm_B (0:56):
- scope (global):
-- skipped
......@@ -245,7 +245,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:38
Paused at wasm://wasm/wasm-9b4bf87e:0:38
at wasm_A (0:38):
- scope (global):
-- skipped
......@@ -261,7 +261,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:39
Paused at wasm://wasm/wasm-9b4bf87e:0:39
at wasm_A (0:39):
- scope (global):
-- skipped
......@@ -277,7 +277,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:40
Paused at wasm://wasm/wasm-9b4bf87e:0:40
at wasm_A (0:40):
- scope (global):
-- skipped
......@@ -293,7 +293,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Paused at wasm-9b4bf87e:0:58
Paused at wasm://wasm/wasm-9b4bf87e:0:58
at wasm_B (0:58):
- scope (global):
-- skipped
......
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