[Lldb-commits] [lldb] r306634 - Fix two places in RegisterContextLLDB::InitializeNonZerothFrame where

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 28 20:02:24 PDT 2017


Author: jmolenda
Date: Wed Jun 28 20:02:24 2017
New Revision: 306634

URL: http://llvm.org/viewvc/llvm-project?rev=306634&view=rev
Log:
Fix two places in RegisterContextLLDB::InitializeNonZerothFrame where
I'm not running the saved pc through FixCodeAddress as soon as I should.

<rdar://problem/30686307> 

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

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=306634&r1=306633&r2=306634&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Jun 28 20:02:24 2017
@@ -297,6 +297,14 @@ void RegisterContextLLDB::InitializeNonZ
     return;
   }
 
+  ExecutionContext exe_ctx(m_thread.shared_from_this());
+  Process *process = exe_ctx.GetProcessPtr();
+  // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
+  // this will strip bit zero in case we read a PC from memory or from the LR.
+  ABI *abi = process->GetABI().get();
+  if (abi)
+    pc = abi->FixCodeAddress(pc);
+
   if (log) {
     UnwindLogMsg("pc = 0x%" PRIx64, pc);
     addr_t reg_val;
@@ -321,14 +329,6 @@ void RegisterContextLLDB::InitializeNonZ
     }
   }
 
-  ExecutionContext exe_ctx(m_thread.shared_from_this());
-  Process *process = exe_ctx.GetProcessPtr();
-  // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
-  // this will strip bit zero in case we read a PC from memory or from the LR.
-  ABI *abi = process->GetABI().get();
-  if (abi)
-    pc = abi->FixCodeAddress(pc);
-
   const bool allow_section_end = true;
   m_current_pc.SetLoadAddress(pc, &process->GetTarget(), allow_section_end);
 
@@ -2054,11 +2054,6 @@ bool RegisterContextLLDB::ReadPC(addr_t
     // unwind past that frame to help
     // find the bug.
 
-    if (m_all_registers_available == false && above_trap_handler == false &&
-        (pc == 0 || pc == 1)) {
-      return false;
-    }
-    
     ProcessSP process_sp (m_thread.GetProcess());
     if (process_sp)
     {
@@ -2066,6 +2061,12 @@ bool RegisterContextLLDB::ReadPC(addr_t
         if (abi)
             pc = abi->FixCodeAddress(pc);
     }
+
+    if (m_all_registers_available == false && above_trap_handler == false &&
+        (pc == 0 || pc == 1)) {
+      return false;
+    }
+
     return true;
   } else {
     return false;




More information about the lldb-commits mailing list