Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial DWARF debugger integration #1804

Merged
merged 8 commits into from
Sep 20, 2023
Merged

feat: initial DWARF debugger integration #1804

merged 8 commits into from
Sep 20, 2023

Conversation

connor4312
Copy link
Member

@connor4312 connor4312 commented Sep 15, 2023

This is part 1 in a stacked PR. All other PRs will get merged into here, and then into main, after they're review individually (to avoid a massive 3k line PR review)

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

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
@connor4312
Copy link
Member Author

Looks like compilation will be unhappy until I publish the @vscode/dwarf-debugging module, which I will do soon, but not yet. Still, I would appreciate a review--I'm planning to make a PR stack and then collapse them once everything's good.

@connor4312 connor4312 mentioned this pull request Sep 19, 2023
4 tasks
roblourens
roblourens previously approved these changes Sep 20, 2023
Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Nice!

mjbvz
mjbvz previously approved these changes Sep 20, 2023
* implement inlined method handling and improve stepping

* update tests
feat: prompt to install extension on wasm step
feat: make wasm inline breakpoints work
feat: make wasm variable store work
@connor4312 connor4312 merged commit 76ec0a3 into main Sep 20, 2023
5 of 10 checks passed
@connor4312 connor4312 deleted the connor4312/wasm-1 branch September 20, 2023 02:19
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.

4 participants