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

write: add LineConvert #745

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Aug 22, 2024

This allow reuse of the implementation of LineProgram::from as part of a more complex transformation.

Operation of LineProgram::from is mostly unchanged. The one difference is that it now uses the string form chosen by LineString::new instead of copying the form of the input.

This allow reuse of the implementation of `LineProgram::from` as part
of a more complex transformation.

Operation of `LineProgram::from` is mostly unchanged. The one difference
is that it now uses the string form chosen by `LineString::new`
instead of copying the form of the input.
@philipc
Copy link
Collaborator Author

philipc commented Aug 22, 2024

I've experimented with converting the transformations in Wasmtime and walrus to use this.

@philipc philipc requested a review from fitzgen August 22, 2024 05:56
@fitzgen
Copy link
Member

fitzgen commented Aug 22, 2024

Nice! Will take a look later today!

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Overall, LGTM. Thanks a ton for digging into this stuff!

I have to admit that it has been a while since I was deep in DWARF, so I'm not 100% up-to-date with all the details. My biggest piece of feedback is simply that of a downstream user: I think these APIs could benefit from a bit more documentation explaining what they are, why you'd use them, and how.

I also quickly scanned over the changes in Wasmtime and Walrus, and things also look good there, definitely an improvement!

src/read/dwarf.rs Show resolved Hide resolved
src/write/line.rs Outdated Show resolved Hide resolved
src/write/line.rs Show resolved Hide resolved
@philipc
Copy link
Collaborator Author

philipc commented Aug 23, 2024

Thanks for the review. I've expanded the doc and added some examples.

I'll let this stew for a bit. I probably need to add some more edge case testing, and I need to figure out if we should be supporting DW_LNE_set_address in the middle of a sequence.

We now automatically start sequences if needed.

This better matches how the underlying DWARF instructions operate,
and simplifies use of `LineConvert` since we no longer need to
check if a sequence has started.

This also means that `LineConvert::read_row` will work as expected
if there are multiple `DW_LNE_set_address` in a sequence.
`LineConvert::read_sequence` still does not support this.
LineConvert::new already retrieves the compilation name from the
program.
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