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

Support for DW_OP_WASM_location #500

Merged
merged 1 commit into from
Sep 10, 2023
Merged

Conversation

sevaa
Copy link
Contributor

@sevaa sevaa commented Sep 8, 2023

Another day, another crash report on my end about a vendor DWARF extension.

This one is documented at least: https://yurydelendik.github.io/webassembly-dwarf/ section 2.2

On a second look, WASM has its own executable binary format that DWEX doesn't support. I'm not sure how did DWARF opcode 0xED make it into an ELF/PE/MachO binary. Barring the potential case of a corrupted/misparsed expression blob, in theory it could be some other vendor extension with opcode 0xED.

@eliben
Copy link
Owner

eliben commented Sep 9, 2023

Hmm, I'm also not sure how this gets into pyelftools at all, since WASM binaries aren't ELF. How are you even testing this?

@sevaa
Copy link
Contributor Author

sevaa commented Sep 9, 2023

I have no way to test this. What I have is a crash report, telling me that DWEX threw an exception on a user's machine: KeyError in parse_expr() on dwarf_expr.py:151 with key 237 (0xED). That line goes:

arg_parser = self._dispatch_table[op]

The whole expression blob goes [237, 2, 1, 159]. That's pretty much all I have. There are some contrived scenarios how this could be bogus - something was interpreted as a location that shouldn't be. But the most likely scenario is that this is indeed a two op expression, opcode 0xED with a two byte argument block followed by DW_OP_stack_value. The argument structure of 0xED is consistent with the linked docs. Modulo the first op, this is a rather vanilla DWARF expression.

FYI, pyelftools can be and is used to parse DWARF in non-ELF binaries. DWEX does that. However, DWEX doesn't support WASM binaries (hehe, maybe it should), and the crash report was specifically from DWEX, not from pyelftools in come other context.

DWEX doesn't support WASM binaries

EDIT: it does now.

@eliben
Copy link
Owner

eliben commented Sep 10, 2023

OK, thanks for the additional background

@eliben eliben merged commit c404826 into eliben:master Sep 10, 2023
3 checks passed
@sevaa sevaa deleted the feat_wasmoploc branch September 14, 2023 14:09
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.

2 participants