-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix issue https://github.com/gimli-rs/addr2line/issues/198 #199
Conversation
The `find_units_range` iterator can return multiple sub-ranges from the same unit. Make sure that the probe range is constrained to that specific subrange rather than the whole unit, or we'll return the same location info over and over.
The second commit doesn't seem correct to me. At the least, we now have a |
Ah, I'd assumed the ranges couldn't overlap. I think it will only need a bit of a tweak to the logic though, and I don't think |
Looks like #163 is the thing to understand. The tests there pass with this PR as-is, but I'm not sure how comprehensive they are. FWIW I don't think this kind of sorted array with lowest/highest tracking can possibly handle doing queries over arbitrary overlapping/nested ranges, so either the overlapping is constrained in a way where it can work, or there are cases where it's already failing. I don't really feel like I understand the root problem enough to be sure either way. In the past I've implemented interval skip lists to solve the general problem. Also if ranges can overlap, it means that returning multiple locations for a given address is inherent (assuming all the ranges are covered properly), but that's OK. I'm not sure if they'll return the same location or not though (is this how inlining is represented?). |
Yep. I can try to reproduce the original failure if I get time.
Why not? It might be inefficient (O(n)), but it should eventually find the results. However, it may give out of order results, even with the change in this PR.
It's not used for inlining. Duplicate locations can occur for weak functions (edit: the correct term might be common functions, it's for duplicate C++ template instantiations). I don't know what exactly caused #163, but I don't think it resulted in duplicate locations (the CUs ranges overlapped, but not the locations within them). |
OK, I think I'll split this aspect into a separate PR, since the fix for #198 is what's really important here. |
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!
Fixes #198 -
find_units_range
can repeatedly return different subranges of the same unit, so make sure the iteration is constrained to that range. Otherwise it re-iterates the entire range repeatedly.Minimal perf effect, mostly an improvement: