Author: jmolenda
Date: Tue Oct 14 22:11:37 2014
New Revision: 219772
URL: http://llvm.org/viewvc/llvm-project?rev=219772&view=rev
Log:
Be more consistent about null checks for the Process and ABI
in GetFullUnwindPlanForFrame() - the code was mostly checking
that we had an active Process and ABI but not always.
clang static analyzer fixit.
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=219772&r1=219771&r2=219772&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Tue Oct
14 22:11:37 2014
@@ -734,13 +734,17 @@ RegisterContextLLDB::GetFullUnwindPlanFo
uint32_t permissions;
addr_t current_pc_addr = m_current_pc.GetLoadAddress
(exe_ctx.GetTargetPtr());
if (current_pc_addr == 0
- || (process->GetLoadAddressPermissions (current_pc_addr,
permissions)
+ || (process &&
+ process->GetLoadAddressPermissions (current_pc_addr,
permissions)
&& (permissions & ePermissionsExecutable) == 0))
{
- unwind_plan_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
- abi->CreateFunctionEntryUnwindPlan(*unwind_plan_sp);
- m_frame_type = eNormalFrame;
- return unwind_plan_sp;
+ if (abi)
+ {
+ unwind_plan_sp.reset (new UnwindPlan
(lldb::eRegisterKindGeneric));
+ abi->CreateFunctionEntryUnwindPlan(*unwind_plan_sp);
+ m_frame_type = eNormalFrame;
+ return unwind_plan_sp;
+ }
}
}
@@ -811,7 +815,7 @@ RegisterContextLLDB::GetFullUnwindPlanFo
}
// Typically the NonCallSite UnwindPlan is the unwind created by
inspecting the assembly language instructions
- if (behaves_like_zeroth_frame)
+ if (behaves_like_zeroth_frame && process)
{
unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite
(process->GetTarget(), m_thread, m_current_offset_backed_up_one);
if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress
(m_current_pc))
@@ -841,7 +845,10 @@ RegisterContextLLDB::GetFullUnwindPlanFo
// We'd prefer to use an UnwindPlan intended for call sites when we're at
a call site but if we've
// struck out on that, fall back to using the non-call-site assembly
inspection UnwindPlan if possible.
- unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite
(process->GetTarget(), m_thread, m_current_offset_backed_up_one);
+ if (process)
+ {
+ unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite
(process->GetTarget(), m_thread, m_current_offset_backed_up_one);
+ }
if (unwind_plan_sp && unwind_plan_sp->GetSourcedFromCompiler() ==
eLazyBoolNo)
{
// We probably have an UnwindPlan created by inspecting assembly
instructions, and we probably
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits