[Lldb-commits] [PATCH] D18975: Fix unwind failures when PC points beyond the end of a function
Ulrich Weigand via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 15 14:42:56 PDT 2016
uweigand added reviewers: clayborg, tberghammer.
uweigand updated this revision to Diff 53951.
uweigand added a comment.
Add fix for a related problem that still caused unwind failures on SystemZ.
The ResolveSymbolContextForAddress sometimes returns a "symbol" with empty
name. This turns out to be an ELF section symbol. Now, usually those get type
eSymbolTypeInvalid. However, there is code in ObjectFileELF::ParseSymbols
that tries to change the type of invalid symbols to eSymbolTypeCode or
eSymbolTypeData if the symbol lies within the code or data section.
Unfortunately, this check also hits the symbol for the code section
itself, which is then marked as eSymbolTypeCode. While the size of
the section symbol is 0 according to the ELF file, LLDB considers
this size invalid and attempts to figure out the "correct" size.
Depending on how this goes, we may end up with a symbol that overlays
part of the code section, even outside areas covered by real function
Therefore, if we call ResolveSymbolContextForAddress with PC pointing
beyond the end of a function, we may get this bogus section symbol.
This again means InitializeNonZerothFrame thinks we have a valid PC,
but then we don't find any unwind info for it.
The fix for this problem seems to me to simply always leave ELF section
symbols as type eSymbolTypeInvalid.
@@ -470,11 +470,13 @@
- bool resolve_tail_call_address = true; // m_current_pc can be one past the address range of the function...
- // This will handle the case where the saved pc does not point to
- // a function/symbol because it is beyond the bounds of the correct
- // function and there's no symbol there. ResolveSymbolContextForAddress
- // will fail to find a symbol, back up the pc by 1 and re-search.
+ bool resolve_tail_call_address = false; // m_current_pc can be one past the address range of the function...
+ // If the saved pc does not point to a function/symbol because it is
+ // beyond the bounds of the correct function and there's no symbol there,
+ // we do *not* want ResolveSymbolContextForAddress to back up the pc by 1,
+ // because then we might not find the correct unwind information later.
+ // Instead, let ResolveSymbolContextForAddress fail, and handle the case
+ // via decr_pc_and_recompute_addr_range below.
const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
uint32_t resolved_scope = pc_module_sp->ResolveSymbolContextForAddress (m_current_pc,
@@ -2148,7 +2148,7 @@
- if (symbol_type == eSymbolTypeInvalid)
+ if (symbol_type == eSymbolTypeInvalid && symbol.getType() != STT_SECTION)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2389 bytes
Desc: not available
More information about the lldb-commits