[Lldb-commits] [lldb] r183282 - Change UnwindLLDB::SearchForSavedLocationForRegister so that it will allow for

Jason Molenda jmolenda at apple.com
Tue Jun 4 17:12:50 PDT 2013


Author: jmolenda
Date: Tue Jun  4 19:12:50 2013
New Revision: 183282

URL: http://llvm.org/viewvc/llvm-project?rev=183282&view=rev
Log:
Change UnwindLLDB::SearchForSavedLocationForRegister so that it will allow for
the link register save location being in the link register - in which case we
should iterate down the stack, not recursively try to find the lr in the current
frame over and over.

<rdar://problem/13932954>

Modified:
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h

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=183282&r1=183281&r2=183282&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Tue Jun  4 19:12:50 2013
@@ -1305,21 +1305,20 @@ RegisterContextLLDB::ReadGPRValue (int r
         return false;
     }
 
-    bool pc_or_return_address = false;
+    bool pc_register = false;
     uint32_t generic_regnum;
-    if (register_kind == eRegisterKindGeneric
-        && (regnum == LLDB_REGNUM_GENERIC_PC || regnum == LLDB_REGNUM_GENERIC_RA))
+    if (register_kind == eRegisterKindGeneric && regnum == LLDB_REGNUM_GENERIC_PC)
     {
-        pc_or_return_address = true;
+        pc_register = true;
     }
     else if (m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindGeneric, generic_regnum)
-             && (generic_regnum == LLDB_REGNUM_GENERIC_PC || generic_regnum == LLDB_REGNUM_GENERIC_RA))
+             && generic_regnum == LLDB_REGNUM_GENERIC_PC)
     {
-        pc_or_return_address = true;
+        pc_register = true;
     }
 
     lldb_private::UnwindLLDB::RegisterLocation regloc;
-    if (!m_parent_unwind.SearchForSavedLocationForRegister (lldb_regnum, regloc, m_frame_number - 1, pc_or_return_address))
+    if (!m_parent_unwind.SearchForSavedLocationForRegister (lldb_regnum, regloc, m_frame_number - 1, pc_register))
     {
         return false;
     }

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=183282&r1=183281&r2=183282&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Tue Jun  4 19:12:50 2013
@@ -278,7 +278,7 @@ UnwindLLDB::GetRegisterContextForFrameNu
 }
 
 bool
-UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_or_return_address_reg)
+UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_reg)
 {
     int64_t frame_num = starting_frame_num;
     if (frame_num >= m_frames.size())
@@ -286,7 +286,7 @@ UnwindLLDB::SearchForSavedLocationForReg
 
     // Never interrogate more than one level while looking for the saved pc value.  If the value
     // isn't saved by frame_num, none of the frames lower on the stack will have a useful value.
-    if (pc_or_return_address_reg)
+    if (pc_reg)
     {
         UnwindLLDB::RegisterSearchResult result;
         result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc);

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=183282&r1=183281&r2=183282&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Tue Jun  4 19:12:50 2013
@@ -87,7 +87,7 @@ protected:
     // Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that
     // has a saved location for this reg.
     bool
-    SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_or_return_address_reg);
+    SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_register);
 
 
 private:





More information about the lldb-commits mailing list