[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
Tamas Berghammer via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 26 05:11:53 PST 2018
tberghammer added a comment.
Sorry, I misunderstood your test-case in my first comment so what I wrote there doesn't make sense. When you are trying to debug binaries (executable or shared library) where half of it is compiled with split-dwarf while the other half is compiled with non-split-dwarf you are generally stepping into completely untested territory and that is a situation I haven't really thought about when designing this future.
The main issue is that split-dwarf and normal-dwarf uses a different invariant for the DIE UID where the non-split-dwarf case leaves the upper 32bit as 0 (and don't use it for anything) while the split-dwarf case uses it to find the correct dwo symbol file. I would prefer to see the fix somewhere inside SymbolFileDWARF or SymbolFileDWARFDwo instead and definitely don't want to see something ELF specific as nothing really ties SymbolFileDWARF with the ELF format.
Do you know who is using the partially incorrect value returned from here? The interesting part is that when we don't have split-dwarf then having 0 as the upper 32bit is fine but here obviously that is ambiguous because it can mean that we are not using split-dwarf or we are using split dwarf and we are referencing the compile unit at offset 0.
One possible idea what can provide a nice fix is to change SymbolFileDWARF::GetID() to return (DW_INVALID_OFFSET << 32) and then treat that value as a special case indicating that the compile unit offset is invalid and we should look for the DIE based on the die_offset part of the ID only. Changing that value might be more intrusive change but I don't expect too many thing to fail over and I think that would provide a cleaner invariant for fixing all sort of random issues coming up when mixing split-dwarf and non-split-dwarf in the same file (I expect quite a few bugs in this area).
Just changing SymbolFileDWARF::SymbolFileDWARF to call UserID(0xffffffff00000000ull) instead of UserID(0) fixes your test but will need more thoughts and tests to make sure it doesn't break other things (have to be tested at least on Linux and on OSX as they have different debug info formats)
Repository:
rL LLVM
https://reviews.llvm.org/D42563
More information about the lldb-commits
mailing list