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

add DWARF Wasm locations #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xtuc
Copy link
Contributor

@xtuc xtuc commented Dec 31, 2024

No description provided.

@@ -3707,6 +3710,11 @@ where
Size::new(size_in_bits),
);
}
// https://docs.rs/gimli/latest/gimli/read/enum.Operation.html#variant.StackValue
// Commonly used for Wasm to terminate the expression.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must admit I'm not familiar enough with DWARF and not sure about that.
My understanding is that Wasm emits something like this: DW_OP_WASM_location ..., DW_OP_stack_value. Where DW_OP_stack_value is used to terminate the expression. Does this make sense?

I'm curious why this seems to be specific to Wasm.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It appears to me that this is because DW_OP_WASM_location is only an address for the case for where wasm-op is wasm-local-indirect. For the other wasm-op values, the semantics are that it pushes the value of the local/global/operand onto the DWARF stack, so the result of the expression must be an implicit stack value rather than a location description. In my view this is a strange design, but I don't have much to do with Wasm so I don't know the reasons.

So rather than adding a case for Operation::StackValue here, what you need to do is change the gimli::Operation::Wasm* support to push a value onto the stack instead of setting location.

Also, it looks like gimli needs to be updated to add gimli::Operation::WasmLocalIndirect. I'm happy for that to be done later though if you don't need it yet.

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