-
Notifications
You must be signed in to change notification settings - Fork 109
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
Correctly handle address sizes for DW_CFA_set_loc #355
Correctly handle address sizes for DW_CFA_set_loc #355
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks!
I think your intuition was on the money regarding address sizes. From CI:
https://travis-ci.org/gimli-rs/gimli/jobs/478405308#L975 etc |
Oh also -- this doesn't resolve the segments part of #102 so either that bug should be fixed in this PR too, or we shouldn't have the "fixes" thing in the PR comment so that issue is left open. |
Going to change the sizes. The segment part I did not understand. I looked at what llvm does and I did not see any obvious difference other than the size aspect of the argument. |
Did some changes to the tests but this needs a thorough review before merging. One of the tests already intentionally tries to test for a 64bit addressed dwarf32 but the second part of the test seems to assume native endianness if I'm not mistaken. |
This comment has been minimized.
This comment has been minimized.
This fixes the failing test: diff --git a/src/read/cfi.rs b/src/read/cfi.rs
index 5601986..9828081 100644
--- a/src/read/cfi.rs
+++ b/src/read/cfi.rs
@@ -4093,7 +4093,7 @@ mod tests {
offset: 0,
length: 0,
format: Format::Dwarf32,
- address_size: 8,
+ address_size: cie1.address_size,
cie: cie1.clone(),
initial_segment: 0,
initial_address: 0xfeed_beef,
@@ -4106,7 +4106,7 @@ mod tests {
offset: 0,
length: 0,
format: Format::Dwarf32,
- address_size: 8,
+ address_size: cie2.address_size,
cie: cie2.clone(),
initial_segment: 0,
initial_address: 0xfeed_face, The expected FDEs that we parse need to have address sizes that match their corresponding CIEs (which got updated in your second commit, but the FDEs did not). Fold this into the PR and we should be good to merge! |
@fitzgen since the address size is already on the cie anyways i will change it so tha ti always use that data. |
CI had passed, and then the most recent commit broke it again:
|
I think the pass was spurious but i need to verify. I will fix this but i want to understand all test cases first to make sure they are correct :) |
The segments support is low priority, and I'm not surprised LLVM doesn't support it. There's already some places in gimli where we return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with this one!
The current code does not correctly handle the the
DW_CFA_set_loc
instruction. It assumes the argument is uleb128 encoded but it's actually a fixed size integer depending on the address size. Mishandling this can cause the cfi iteration to consume garbage after an integer has been incorrectly read.I was not sure however about how the current tests assume pointer sizes so for now I hardcoded this to be 8. This might have to become
sizeof::<usize>()
.This fixes #102