Skip to content

feat: support basic webassembly debugging - #1791

Merged
Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/basic-wasm-debugging
Aug 27, 2023
Merged

Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/basic-wasm-debugging

Conversation

@connor4312

Copy link
Copy Markdown
Member

Supports viewing, stepping through, and setting breakpoints in
webassembly (decompiled as WAT) in the editor. Includes a
basic tmLanguage for WAT.

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 #1789
Fixes #1715 on the way

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 #1789
Fixes #1715 on the way
// If we see we want to set breakpoints in file by source reference ID but
// it doesn't exist, they were probably from a previous section. The
// references for scripts just auto-increment per session and are entirely
// ephemeral. Remove the reference so that we fall back to a path if possible.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer the case, and caused problems. Since a few years ago, we set the source referenced based on a hash of the URL and other information to try to make them stable between reloads, so we should leverage that information.

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wat... 😁

I just wonder whether the wat grammar should be in this extension or in the builtin javascript extension, or its own builtin extension

@connor4312

Copy link
Copy Markdown
Member Author

I think having it be built-in is sensible. I'll move it over on Monday.

@connor4312
Connor Peet (connor4312) deleted the connor4312/basic-wasm-debugging branch August 27, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug/Question] Breakpoint auto-relocate to other file in V1.78.0

3 participants