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

read: add Evaluation::value_result #676

Merged
merged 1 commit into from
Nov 24, 2023
Merged

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Aug 14, 2023

DWARF expressions can be used to either compute a value or a location description, depending on context.

Currently a value computation will result in a location description that contains one Piece whose location is set to Location::Address, and this address is the computed value.

Evaluation::value_result makes it easier to obtain this value, supports results that are typed values, and checks there were no operations that only valid for location descriptions.

Closes #675

@philipc
Copy link
Collaborator Author

philipc commented Aug 14, 2023

@khuey You've probably used the DWARF expression support the most. Do you think this change would be useful?

@khuey
Copy link
Contributor

khuey commented Aug 19, 2023

I'm not really convinced this is worth the complexity. What does this solve besides the user's issue in #675? Is the typed value stuff separable from this?

Another issue that the spec does not always match what happens in practice. DW_AT_vtable_elem_location, for example, is treated as a value (at least as of clang 16), not a location, despite what the spec claims. There might be others (especially among the weird Fortran attributes).

@philipc
Copy link
Collaborator Author

philipc commented Aug 19, 2023

I'll defer to your judgement. If this hasn't been a problem for you then there's no point changing it.

What does this solve besides the user's issue in #675?

It encodes some more knowledge in gimli, without requiring every user to duplicate that knowledge.

Is the typed value stuff separable from this?

We could probably add the pub fn value_result(&self) -> Value without needing to add ExpressionKind.

Another issue that the spec does not always match what happens in practice.

We would change it to do whatever happens in practice then.

DWARF expressions can be used to either compute a value or a location
description, depending on context.

Currently a value computation will result in a location description that
contains one `Piece` whose `location` is set to `Location::Address`,
and this address is the computed value.

`Evaluation::value_result` makes it easier to obtain this value,
supports results that are typed values, and checks there were no
operations that only valid for location descriptions.
@philipc philipc changed the title read/op: add ExpressionKind read: add Evaluation::value_result Nov 23, 2023
@philipc philipc marked this pull request as ready for review November 23, 2023 03:24
@philipc
Copy link
Collaborator Author

philipc commented Nov 23, 2023

Is the typed value stuff separable from this?

This is trivial, so I've changed the PR to just do that.

@philipc philipc merged commit e6adc47 into gimli-rs:master Nov 24, 2023
20 checks passed
@philipc philipc deleted the issue-675 branch November 24, 2023 04:45
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.

DW_AT_frame_base wrong calculation
2 participants