[Lldb-commits] [lldb] r191102 - Fix lldb regressions due to r190812 in the case where debug info is present.

Ashok Thirumurthi ashok.thirumurthi at intel.com
Fri Sep 20 12:05:10 PDT 2013


Author: athirumu
Date: Fri Sep 20 14:05:10 2013
New Revision: 191102

URL: http://llvm.org/viewvc/llvm-project?rev=191102&view=rev
Log:
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.

Modified:
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=191102&r1=191101&r2=191102&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Fri Sep 20 14:05:10 2013
@@ -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;
 

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=191102&r1=191101&r2=191102&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Sep 20 14:05:10 2013
@@ -498,13 +498,13 @@ Module::ResolveSymbolContextForAddress (
         // 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;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=191102&r1=191101&r2=191102&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Sep 20 14:05:10 2013
@@ -370,7 +370,8 @@ RegisterContextLLDB::InitializeNonZeroth
     }
 
     // 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;
     }

Modified: lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=191102&r1=191101&r2=191102&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py (original)
+++ lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py Fri Sep 20 14:05:10 2013
@@ -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()
 





More information about the lldb-commits mailing list