Commit 1e250a75 authored by Aseem Garg's avatar Aseem Garg Committed by Commit Bot

[wasm] fix source maps for relative path

For wasm modules with non-absolute sourceMappingURL, the source needs
to be empty so that devtools can look for the source map at the origin
of the module.

R=clemensh@chromium.org,adamk@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I74c40addc1a7cb1be0442e9f2b272590c0b81f60
Reviewed-on: https://chromium-review.googlesource.com/1250402
Commit-Queue: Aseem Garg <aseemgarg@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56326}
parent 8ead5698
...@@ -3091,12 +3091,6 @@ Handle<Script> CreateWasmScript(Isolate* isolate, ...@@ -3091,12 +3091,6 @@ Handle<Script> CreateWasmScript(Isolate* isolate,
const int kBufferSize = 32; const int kBufferSize = 32;
char buffer[kBufferSize]; char buffer[kBufferSize];
int url_chars = SNPrintF(ArrayVector(buffer), "wasm://wasm/%08x", hash);
DCHECK(url_chars >= 0 && url_chars < kBufferSize);
MaybeHandle<String> url_str = isolate->factory()->NewStringFromOneByte(
Vector<const uint8_t>(reinterpret_cast<uint8_t*>(buffer), url_chars),
TENURED);
script->set_source_url(*url_str.ToHandleChecked());
int name_chars = SNPrintF(ArrayVector(buffer), "wasm-%08x", hash); int name_chars = SNPrintF(ArrayVector(buffer), "wasm-%08x", hash);
DCHECK(name_chars >= 0 && name_chars < kBufferSize); DCHECK(name_chars >= 0 && name_chars < kBufferSize);
......
Tests stepping through wasm scripts with source maps Tests stepping through wasm scripts with source maps
Installing code an global variable and instantiate. Installing code an global variable and instantiate.
Got wasm script: wasm://wasm/9b4bf87e Got wasm script: wasm-9b4bf87e
Script sourceMapURL: abc Script sourceMapURL: abc
Requesting source for wasm://wasm/9b4bf87e... Requesting source for wasm-9b4bf87e...
Source retrieved without error: true Source retrieved without error: true
Setting breakpoint on offset 54 (on the setlocal before the call), url wasm://wasm/9b4bf87e Setting breakpoint on offset 54 (on the setlocal before the call), url wasm-9b4bf87e
{ {
columnNumber : 54 columnNumber : 54
lineNumber : 0 lineNumber : 0
scriptId : <scriptId> scriptId : <scriptId>
} }
Paused at wasm://wasm/9b4bf87e:0:54 Paused at wasm-9b4bf87e:0:54
at wasm_B (0:54): at wasm_B (0:54):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -21,7 +21,7 @@ at (anonymous) (0:17): ...@@ -21,7 +21,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:56 Paused at wasm-9b4bf87e:0:56
at wasm_B (0:56): at wasm_B (0:56):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -32,7 +32,7 @@ at (anonymous) (0:17): ...@@ -32,7 +32,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:38 Paused at wasm-9b4bf87e:0:38
at wasm_A (0:38): at wasm_A (0:38):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -48,7 +48,7 @@ at (anonymous) (0:17): ...@@ -48,7 +48,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOver called Debugger.stepOver called
Paused at wasm://wasm/9b4bf87e:0:39 Paused at wasm-9b4bf87e:0:39
at wasm_A (0:39): at wasm_A (0:39):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -64,7 +64,7 @@ at (anonymous) (0:17): ...@@ -64,7 +64,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOut called Debugger.stepOut called
Paused at wasm://wasm/9b4bf87e:0:58 Paused at wasm-9b4bf87e:0:58
at wasm_B (0:58): at wasm_B (0:58):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -75,7 +75,7 @@ at (anonymous) (0:17): ...@@ -75,7 +75,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOut called Debugger.stepOut called
Paused at wasm://wasm/9b4bf87e:0:54 Paused at wasm-9b4bf87e:0:54
at wasm_B (0:54): at wasm_B (0:54):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -86,7 +86,7 @@ at (anonymous) (0:17): ...@@ -86,7 +86,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOver called Debugger.stepOver called
Paused at wasm://wasm/9b4bf87e:0:56 Paused at wasm-9b4bf87e:0:56
at wasm_B (0:56): at wasm_B (0:56):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -97,7 +97,7 @@ at (anonymous) (0:17): ...@@ -97,7 +97,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOver called Debugger.stepOver called
Paused at wasm://wasm/9b4bf87e:0:58 Paused at wasm-9b4bf87e:0:58
at wasm_B (0:58): at wasm_B (0:58):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -108,7 +108,7 @@ at (anonymous) (0:17): ...@@ -108,7 +108,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.resume called Debugger.resume called
Paused at wasm://wasm/9b4bf87e:0:54 Paused at wasm-9b4bf87e:0:54
at wasm_B (0:54): at wasm_B (0:54):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -119,7 +119,7 @@ at (anonymous) (0:17): ...@@ -119,7 +119,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:56 Paused at wasm-9b4bf87e:0:56
at wasm_B (0:56): at wasm_B (0:56):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -130,7 +130,7 @@ at (anonymous) (0:17): ...@@ -130,7 +130,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:38 Paused at wasm-9b4bf87e:0:38
at wasm_A (0:38): at wasm_A (0:38):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -146,7 +146,7 @@ at (anonymous) (0:17): ...@@ -146,7 +146,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepOut called Debugger.stepOut called
Paused at wasm://wasm/9b4bf87e:0:58 Paused at wasm-9b4bf87e:0:58
at wasm_B (0:58): at wasm_B (0:58):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -157,7 +157,7 @@ at (anonymous) (0:17): ...@@ -157,7 +157,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:43 Paused at wasm-9b4bf87e:0:43
at wasm_B (0:43): at wasm_B (0:43):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -168,7 +168,7 @@ at (anonymous) (0:17): ...@@ -168,7 +168,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:45 Paused at wasm-9b4bf87e:0:45
at wasm_B (0:45): at wasm_B (0:45):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -179,7 +179,7 @@ at (anonymous) (0:17): ...@@ -179,7 +179,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:47 Paused at wasm-9b4bf87e:0:47
at wasm_B (0:47): at wasm_B (0:47):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -190,7 +190,7 @@ at (anonymous) (0:17): ...@@ -190,7 +190,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:49 Paused at wasm-9b4bf87e:0:49
at wasm_B (0:49): at wasm_B (0:49):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -201,7 +201,7 @@ at (anonymous) (0:17): ...@@ -201,7 +201,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:51 Paused at wasm-9b4bf87e:0:51
at wasm_B (0:51): at wasm_B (0:51):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -212,7 +212,7 @@ at (anonymous) (0:17): ...@@ -212,7 +212,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:53 Paused at wasm-9b4bf87e:0:53
at wasm_B (0:53): at wasm_B (0:53):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -223,7 +223,7 @@ at (anonymous) (0:17): ...@@ -223,7 +223,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:54 Paused at wasm-9b4bf87e:0:54
at wasm_B (0:54): at wasm_B (0:54):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -234,7 +234,7 @@ at (anonymous) (0:17): ...@@ -234,7 +234,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:56 Paused at wasm-9b4bf87e:0:56
at wasm_B (0:56): at wasm_B (0:56):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -245,7 +245,7 @@ at (anonymous) (0:17): ...@@ -245,7 +245,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:38 Paused at wasm-9b4bf87e:0:38
at wasm_A (0:38): at wasm_A (0:38):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -261,7 +261,7 @@ at (anonymous) (0:17): ...@@ -261,7 +261,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:39 Paused at wasm-9b4bf87e:0:39
at wasm_A (0:39): at wasm_A (0:39):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -277,7 +277,7 @@ at (anonymous) (0:17): ...@@ -277,7 +277,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:40 Paused at wasm-9b4bf87e:0:40
at wasm_A (0:40): at wasm_A (0:40):
- scope (global): - scope (global):
-- skipped -- skipped
...@@ -293,7 +293,7 @@ at (anonymous) (0:17): ...@@ -293,7 +293,7 @@ at (anonymous) (0:17):
- scope (global): - scope (global):
-- skipped -- skipped
Debugger.stepInto called Debugger.stepInto called
Paused at wasm://wasm/9b4bf87e:0:58 Paused at wasm-9b4bf87e:0:58
at wasm_B (0:58): at wasm_B (0:58):
- scope (global): - scope (global):
-- skipped -- 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