[Lldb-commits] [lldb] r196201 - Build up UnwindPlan::PlanValidAtAddress to recognize some general

Jason Molenda jmolenda at apple.com
Mon Dec 2 20:46:27 PST 2013


Author: jmolenda
Date: Mon Dec  2 22:46:27 2013
New Revision: 196201

URL: http://llvm.org/viewvc/llvm-project?rev=196201&view=rev
Log:
Build up UnwindPlan::PlanValidAtAddress to recognize some general
indications that the UnwindPlan is invalid -- for instance, a
complete lack of rows, or a row that fails to define a register to
base the CFA off of.
<rdar://problem/15246247> 

Modified:
    lldb/trunk/source/Symbol/UnwindPlan.cpp

Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=196201&r1=196200&r2=196201&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindPlan.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindPlan.cpp Mon Dec  2 22:46:27 2013
@@ -10,6 +10,7 @@
 #include "lldb/Symbol/UnwindPlan.h"
 
 #include "lldb/Core/ConstString.h"
+#include "lldb/Core/Log.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Thread.h"
@@ -373,6 +374,25 @@ UnwindPlan::SetPlanValidAddressRange (co
 bool
 UnwindPlan::PlanValidAtAddress (Address addr)
 {
+    // If this UnwindPlan has no rows, it is an invalid UnwindPlan.
+    if (GetRowCount() == 0)
+    {
+        Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+        if (log)
+            log->Printf ("Testing if UnwindPlan is valid at pc 0x%" PRIx64 ": No unwind rows - is invalid.");
+        return false;
+    }
+
+    // If the 0th Row of unwind instructions is missing, or if it doesn't provide
+    // a register to use to find the Canonical Frame Address, this is not a valid UnwindPlan.
+    if (GetRowAtIndex(0).get() == NULL || GetRowAtIndex(0)->GetCFARegister() == LLDB_INVALID_REGNUM)
+    {
+        Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+        if (log)
+            log->Printf ("Testing if UnwindPlan is valid at pc 0x%" PRIx64 ": No CFA register - is invalid.");
+        return false;
+    }
+
     if (!m_plan_valid_address_range.GetBaseAddress().IsValid() || m_plan_valid_address_range.GetByteSize() == 0)
         return true;
 





More information about the lldb-commits mailing list