-
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
Handle overlapping ranges #67
Comments
Hm. I did run across some invalid ranges like the 1..1 you mention in #49, which is why I'm trying to filter those out with the If there really is no other way, we could use an interval tree here as well, but I'd really like to avoid dropping unit ranges entirely. Is there any legitimate reason for multiple compilation units to describe the same address ranges? |
My memory of #49 is that we failed to return a result for some addresses. The line table had entries for the addresses, but the unit ranges were missing. I'll try to reproduce this again. I don't think there's any legitimate reason for multiple CUs to cover the same range. I've seen many invalid ranges starting at 0 though, which should be easy to filter out if needed. In theory, the unit ranges and the line ranges should be identical, so the only advantage of the unit ranges is they are faster to parse, but if they do match the address then we need to parse the line ranges anyway. Also, it's the line ranges that have the information we want, so they should always be more accurate. There's also |
AFAIK Unit ranges allow lazy parsing of units (don't look at the line number program until you need it), I think that may be a nice optimization. |
I'm seeing this on nightly build (https://circleci.com/gh/sfackler/rstack/23), but not a stable build of the same commit (https://circleci.com/gh/sfackler/rstack/22). Might be caused by rust-lang/rust#45511? |
Using a nightly older than nightly-2017-10-24 didn't fix the problem for rstack, so it's not rust-lang/rust#45511. |
For rstack, the issue is a couple of compilation units that use low_pc/high_pc to specify the range, but the low_pc is 0. Both units contain a single subprogram that also has a low_pc of 0. I suspect this is similar to the 1..1 ranges that occur elsewhere, but it gets handled wrongly because there's only one subprogram in the unit. For the other binaries I've tested on, there are subprograms that have debuginfo in multiple units, and this is a relatively common occurrence. These seem to all be C++ constructors/destructors, so I suspect this is the compiler generating multiple copies and combining them when linking. |
Investigating #49 again, I was mistaken about what was happening there. Here's the problem cases I have found.
So I think 3 changes are possible:
|
This is true for the first lookup of an address that isn't in that unit. But lookups of addresses in that unit will be slower both for the first and subsequent lookups since you need to do a binary search for both the unit ranges and the line sequences (unless you discard the unit ranges once you have parsed sequences). |
This assert triggers for some binaries.
May also need better validation of ranges in general. May also want to ignore ranges that begin at 0. Also see #49 for some changes that may be required.
The text was updated successfully, but these errors were encountered: