summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-12-20 01:05:11 +0000
committerJason Molenda <jmolenda@apple.com>2013-12-20 01:05:11 +0000
commit3d21975a44e5a35f934831a712ba5733de19ad80 (patch)
tree7b5e9267ed80c96d6b97c7bc8ef4ce8c3346ef66 /lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
parent7110f332eb2598675059179f9b484e4128ba4e08 (diff)
downloadbcm5719-llvm-3d21975a44e5a35f934831a712ba5733de19ad80.tar.gz
bcm5719-llvm-3d21975a44e5a35f934831a712ba5733de19ad80.zip
Partially revert a patch from Ashok Thirumurthi in r191430.
The original code was not completely correct, but a form of this check is necessary to avoid an infinite recursion on some unwind cases where a function unwinds to itself with the same CFA. Ashok thought the recursion would be caught in RegisterContextLLDB but this one isn't - we still need it here. <rdar://problem/15664282> llvm-svn: 197761
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp')
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 552ae501bd2..203d4c1f658 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -95,7 +95,13 @@ UnwindLLDB::AddFirstFrame ()
first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
m_frames.push_back (first_cursor_sp);
return true;
+
unwind_done:
+ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+ if (log)
+ {
+ log->Printf ("th%d Unwind of this thread is complete.", m_thread.GetIndexID());
+ }
m_unwind_complete = true;
return false;
}
@@ -138,7 +144,12 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi)
}
if (reg_ctx_sp.get() == NULL)
+ {
+ if (log)
+ log->Printf ("%*sFrame %d did not get a RegisterContext, stopping.",
+ cur_idx < 100 ? cur_idx : 100, "", cur_idx);
goto unwind_done;
+ }
if (!reg_ctx_sp->IsValid())
{
@@ -185,12 +196,26 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi)
}
goto unwind_done;
}
+ if (!m_frames.empty())
+ {
+ // Infinite loop where the current cursor is the same as the previous one...
+ if (m_frames.back()->start_pc == cursor_sp->start_pc && m_frames.back()->cfa == cursor_sp->cfa)
+ {
+ if (log)
+ log->Printf ("th%d pc of this frame is the same as the previous frame and CFAs for both frames are identical -- stopping unwind", m_thread.GetIndexID());
+ goto unwind_done;
+ }
+ }
cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
m_frames.push_back (cursor_sp);
return true;
unwind_done:
+ if (log)
+ {
+ log->Printf ("th%d Unwind of this thread is complete.", m_thread.GetIndexID());
+ }
m_unwind_complete = true;
return false;
}
OpenPOWER on IntegriCloud