Fix lldb regressions due to r190812 in the case where debug info is present.

Specifically, allows the unwinder to handle the case where sc.function
gets resolved with a pc that is one past the address range of the function
(consistent with a tail call).  However, there is no matching symbol.

Adds eSymbolContextTailCall to provide callers with control over the scope
of symbol resolution and to allow ResolveSymbolContextForAddress to handle
tail calls since this routine is common to unwind and disassembly.

llvm-svn: 191102
This commit is contained in:
Ashok Thirumurthi 2013-09-20 19:05:10 +00:00
parent b742879c35
commit 2568f45939
4 changed files with 7 additions and 10 deletions

View File

@ -263,6 +263,7 @@ namespace lldb {
eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results
eSymbolContextTailCall = (1u << 7), ///< Set when a function symbol with a tail call is requested from a query, or was located in query results
eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u) ///< Indicates to try and lookup everything up during a query.
} SymbolContextItem;

View File

@ -498,13 +498,13 @@ Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve
// with FDE row indices in eh_frame sections, but requires extra logic here to permit
// symbol lookup for disassembly and unwind.
if (resolve_scope & eSymbolContextSymbol && !(resolved_flags & eSymbolContextSymbol) &&
resolve_scope & eSymbolContextFunction && !(resolved_flags & eSymbolContextFunction) &&
resolve_scope & eSymbolContextTailCall &&
so_addr.IsSectionOffset())
{
Address previous_addr = so_addr;
previous_addr.Slide(-1);
const uint32_t flags = sym_vendor->ResolveSymbolContext (previous_addr, resolve_scope, sc);
const uint32_t flags = ResolveSymbolContextForAddress(previous_addr, resolve_scope & ~eSymbolContextTailCall, sc);
if (flags & eSymbolContextSymbol)
{
AddressRange addr_range;

View File

@ -370,7 +370,8 @@ RegisterContextLLDB::InitializeNonZerothFrame()
}
// We require that eSymbolContextSymbol be successfully filled in or this context is of no use to us.
if ((pc_module_sp->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol | eSymbolContextTailCall;
if ((pc_module_sp->ResolveSymbolContextForAddress (m_current_pc, resolve_scope, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
{
m_sym_ctx_valid = true;
}

View File

@ -17,7 +17,6 @@ class AssertingInferiorTestCase(TestBase):
def test_inferior_asserting_dwarf(self):
"""Test that lldb reliably catches the inferior asserting (command)."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDwarf()
self.inferior_asserting()
@ -30,21 +29,20 @@ class AssertingInferiorTestCase(TestBase):
@expectedFailureFreeBSD('llvm.org/pr17184')
def test_inferior_asserting_register_dwarf(self):
"""Test that lldb reliably reads registers from the inferior after asserting (command)."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDwarf()
self.inferior_asserting_registers()
@skipIfGcc # Avoid xpasses as the verion of libc used on the gcc buildbot has the required function symbols.
@expectedFailureFreeBSD # ResolveSymbolContextForAddress can fail using ELF with stripped function symbols.
@expectedFailureLinux # ResolveSymbolContextForAddress can fail using ELF with stripped function symbols.
def test_inferior_asserting_disassemble(self):
"""Test that lldb reliably disassembles frames after asserting (command)."""
self.skipTest("llvm.org/pr17276 -- ResolveSymbolContextForAddress can fail using ELF with stripped function symbols.")
self.buildDefault()
self.inferior_asserting_disassemble()
@python_api_test
def test_inferior_asserting_python(self):
"""Test that lldb reliably catches the inferior asserting (Python API)."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDefault()
self.inferior_asserting_python()
@ -56,20 +54,17 @@ class AssertingInferiorTestCase(TestBase):
def test_inferior_asserting_expr(self):
"""Test that the lldb expression interpreter can read from the inferior after asserting (command)."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDwarf()
self.inferior_asserting_expr()
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_inferior_asserting_step(self):
"""Test that lldb functions correctly after stepping through a call to assert()."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDsym()
self.inferior_asserting_step()
def test_inferior_asserting_step(self):
"""Test that lldb functions correctly after stepping through a call to assert()."""
self.skipTest("llvm.org/pr17276 -- backtrace is truncated")
self.buildDwarf()
self.inferior_asserting_step()