* fix: eval webpack config breakpoints not setting
V8 does not resolve URL-set breakpoints when the script in question only
has that URL via a sourceURL mapping.
I also noticed an issue with per-script entrypoint breakpoints where
another file with the same name, or part of the same name, could
incorrectly remove the entrypoint breakpoint early. It's fine to just
leave the breakpoint around -- can be slightly slower, but better than
missing the breakpoint entirely.
Fixes https://github.com/microsoft/vscode/issues/194988
* fix: don't use entry bps in breakpoint reason calculation
* fix test
Uses Acorn to parse compiled files and create a tree of scopes. Then,
only apply renames in scopes when appropriate. This is far better than
what we were doing before when we were just looking for nearby renames.
This is not very fast for large bundled files. I initially worked on
building a fork of https://github.com/guybedford/es-module-lexer that
would scan for blocks. This worked in many cases, but failed for cases
when there's no BlockStatement. For example, `for (const foo of bar) foo()`
would not detect a 'scope' around `foo()`. This is not great, especially
with minified code where such patterns are common.
Instead, we'll parse large bundles (>512KB) in a one-off worker_thread.
We also some work in our build process to vendor acorn and acorn-loose
to avoid duplicating it in the worker thread code.
Enables stepping around and setting breakpoints in native code.
Variables represenation is still a todo, and this needs some polish.
It refactors the `Source.sourceMap` into a more generic location
provider, which may be backed by the new IWasmSymbols interface. This
then talks to the DWARF debugger. The SourceContainer's `_sourceMaps`
are also now just folded into the `Source.sourceMap`; that information
was duplicate and the only benefit was deduplication if two sources had
the same sourcemap, but this is really rare.
This also made all location mapping asynchronous, so there were a
few refactors around there, too.
It also refactors how I implemented WAT (text format decompilation) last
iteration. That previously "pretended" the source of the WASM was WAT,
but this caused issues because the location transformation we did on the
scripts is done before location mapping. So instead, the WAT is an extra
fake 'file' in the symbols and we resolve any unknown locations into the
WAT file.
One that that _doesn't_ work yet is entrypoint breakpoints for wasm,
which means that breakpoints set before the debug session starts may be
missed. I have a thread out to the Chromium folks to see if there's
a solution to this.
For #1789
* feat: show class names of methods in call stack view
Uses the same logic as variable preview generation.
Closes#1770
* better formatting for static, fix test
* feat: support basic webassembly debugging
Supports viewing, stepping through, and setting breakpoints in
webassembly (decompiled as WAT) in the editor. Includes a
basic tmLanguage for WAT.
![](https://memes.peet.io/img/23-08-b7617299-9f8d-41c9-8fe0-ada8a3c57966.png)
Unfortunately we eagerly have to decompile WASM in order to get line
mappings to show e.g. in breakpoints. Location mapping is currently
mostly synchronous and I didn't want to make everything async
for webassembly. However, we don't keep the WAT source in memory,
instead request it again if it's needed. I opted to do this to reduce
memory usage for user applications that just happen to contain WASM
where they aren't always interested in debugging it.
For #1789Fixes#1715 on the way
* retain wasm-set breakpoints between reloads
* If .map file exists no need to parse it
* add line space
* code comment
* update to use previously read children
* fix root not getting touched when retrieved
* avoid extra stat in createMetadataForFile
* fixup tests
---------
Co-authored-by: Sunil Surana <susurana@microsoft.com>
Co-authored-by: Connor Peet <connor@peet.io>
* feat: use the browser networks stack as fallback when direct load fails
Chrome recently(ish) added a `Network.loadNetworkResource` request which
allows us to ask the browser to load a resource, and get the response.
Instead of our previous hacky method of asking and then applying cookies
manually, which only worked for some scenarios, use this method as a
fallback if manually requesting the resource fails.
Do some rearranging since previously the SourceMapFactory was global
which prevented it from using session-specific data.
Fixes#1766Fixes#425 (3 years later!)
* optimize
* update test status code
Previously when supporting EXT we added per-line splitting and emitting,
but we actually should just reemit things immediately unless we see
an EXT.
Fixes https://github.com/microsoft/vscode/issues/181785