[Lldb-commits] [PATCH] D42563: [lldb] attempt to fix DIERef::GetUID
Tamas Berghammer via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 29 03:15:53 PST 2018
tberghammer added a comment.
Thanks for the explanation, sorry I haven't read your commit message carefully.
In case of non-split-dwarf a die_offset is sufficient to uniquely identify a DIE because it is an offset from the beginning of the debug_info section (we assume we have at most 1 debug_info section everywhere in LLDB) and we are already relying on this as we don't store the compile unit offset in the non-split dwarf case. Looking at the code setting the cu_offset to DW_INVALID_OFFSET will be more correct then what we are doing at the moment because DWARFDebugInfo::GetDIE will call DWARFDebugInfo::GetCompileUnit and that function will look for a compile unit based on the cu_offset if cu_offset != DW_INVALID_OFFSET what is currently the case so it will return an incorrect compile unit in the non-split-dwarf case. Setting cu_offset to DW_INVALID_OFFSET would solve the issue as it will look for a compile unit based on the DIE offset what is correct in the non-split dwarf case (I think this change of behavior is the one fixing your test case).
My only concern with setting the SymbolFileUID to DW_INVALID_OFFSET is how will it work in case of MachO (I have very little knowledge about that code path) but I really hope we don't implicitly depend on the offset being set to 0 instead of DW_INVALID_OFFSET what is meant to represent unused/invalid values so I expect it to work.
More information about the lldb-commits