-
Notifications
You must be signed in to change notification settings - Fork 13.4k
debug_names incorrect parent due to collision between CU and TU #93886
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
Comments
@llvm/issue-subscribers-debuginfo Author: David Blaikie (dwblaikie)
from https://github.com//pull/91808#issuecomment-2138480664
So the second and third "B" entries match up with the appropriate "A" entries, but the first jumps over to refer to a different DIE in the CU that has the same offset. This is because the UniqueID on a unit is only unique within that type of unit (it's unique across CUs and, separately, unique across TUs) - so the "DieOffsetAndUnitID" is not a globally unique identifier for an entry - it'd need the type of unit in there too to completely uniquify it. Adding this patch is enough to expose the issue more directly:
The two different units (one CU, one TU) with the same unit ID end up colliding in the
Only inserts the copy once, oh... and /this/ code:
Silently skips emitting the label even though it matches more than one entry unintentionally, because it can match more than one entry /intentionally/ (if there's multiple entries for exactly the same entity, but known by different names (like the mangled name and unmangled name)). So, yeah. Hmm, I guess at least the type unit number probably isn't gapless - there are cases where we create a type unit and then potentially throw it away (see the TypeUnitsUnderConstruction stuff) - but we don't reuse the type unit number. So, maybe it's possible to use a single numbering for CUs and TUs, gaps and all? The only thing I was worried about was that some code might be using the numbering to index into an array of units at some point, but if that's not the case - great! Probably more intuitive that they be totally unique numbers. |
I can take a look later this week unless @felipepiovezan already plans to do it. |
I would appreciate the help :) I have some stuff that I need to look at before going on PTO, so it would be tricky to look into this in a reasonable timeframe |
OK, will take a look Friday or Monday. Also busy with internal stuff. |
This fixes llvm#93886. The UnitID is not unique between CUs and TUs. This led to DW_IDX_parent to point ot an entry for a DIE in CU if it had the same relative offset as TU die. Added a IsTU to the hash for parent chain.
This fixes #93886. The UnitID is not unique between CUs and TUs. This led to DW_IDX_parent to point ot an entry for a DIE in a CU if it had the same relative offset as a TU die. Added a IsTU to the hash for parent chain.
This fixes llvm#93886. The UnitID is not unique between CUs and TUs. This led to DW_IDX_parent to point ot an entry for a DIE in CU if it had the same relative offset as TU die. Added a IsTU to the hash for parent chain.
This fixes llvm#93886. The UnitID is not unique between CUs and TUs. This led to DW_IDX_parent to point ot an entry for a DIE in CU if it had the same relative offset as TU die. Added a IsTU to the hash for parent chain.
This fixes #93886. The UnitID is not unique between CUs and TUs. This led to DW_IDX_parent to point ot an entry for a DIE in CU if it had the same relative offset as TU die. Added a IsTU to the hash for parent chain.
from #91808 (comment)
So the second and third "B" entries match up with the appropriate "A" entries, but the first jumps over to refer to a different DIE in the CU that has the same offset.
This is because the UniqueID on a unit is only unique within that type of unit (it's unique across CUs and, separately, unique across TUs) - so the "DieOffsetAndUnitID" is not a globally unique identifier for an entry - it'd need the type of unit in there too to completely uniquify it.
Adding this patch is enough to expose the issue more directly:
The two different units (one CU, one TU) with the same unit ID end up colliding in the
IndexedOffsets
set - and only one ends up in there, and so then the loop here:Only inserts the copy once, oh... and /this/ code:
Silently skips emitting the label even though it matches more than one entry unintentionally, because it can match more than one entry /intentionally/ (if there's multiple entries for exactly the same entity, but known by different names (like the mangled name and unmangled name)).
So, yeah.
Hmm, I guess at least the type unit number probably isn't gapless - there are cases where we create a type unit and then potentially throw it away (see the TypeUnitsUnderConstruction stuff) - but we don't reuse the type unit number.
So, maybe it's possible to use a single numbering for CUs and TUs, gaps and all?
The only thing I was worried about was that some code might be using the numbering to index into an array of units at some point, but if that's not the case - great! Probably more intuitive that they be totally unique numbers.
The text was updated successfully, but these errors were encountered: