summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-01-17 21:03:33 +0000
committerGreg Clayton <gclayton@apple.com>2011-01-17 21:03:33 +0000
commitfc75303acb7570f4cc21eaafb60763886a5c20c7 (patch)
tree924111e55fbe0908d153faf8b16f3a821fc72075 /lldb/source
parentb2a844bfe12af5a52493f85f09ce4e7c260047f6 (diff)
downloadbcm5719-llvm-fc75303acb7570f4cc21eaafb60763886a5c20c7.tar.gz
bcm5719-llvm-fc75303acb7570f4cc21eaafb60763886a5c20c7.zip
Avoid infinite loops in stack backtraces and renamed:
bool RegisterContextLLDB::GetPC (addr_t& pc); to: bool RegisterContextLLDB::ReadPC (addr_t& pc); To avoid confusion with the GetPC() function that is part of the lldb_private::RegisterContext: uint64_t RegisterContext::GetPC (uint64_t fail_value); Bad things could happen if the two got intermixed and the wrong one got called. Fixed inifinite loop detection by watching for two frames where the RegisterContextLLDB::CursorSP contains the same start_pc and cfa. llvm-svn: 123673
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp4
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h2
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp13
3 files changed, 14 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index b76b093f88f..096ab1a9759 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -1246,7 +1246,7 @@ RegisterContextLLDB::GetStartPC (addr_t& start_pc)
return false;
if (!m_start_pc.IsValid())
{
- return GetPC (start_pc);
+ return ReadPC (start_pc);
}
start_pc = m_start_pc.GetLoadAddress (&m_thread.GetProcess().GetTarget());
return true;
@@ -1255,7 +1255,7 @@ RegisterContextLLDB::GetStartPC (addr_t& start_pc)
// Retrieve the current pc value for THIS frame, as saved by the NEXT frame.
bool
-RegisterContextLLDB::GetPC (addr_t& pc)
+RegisterContextLLDB::ReadPC (addr_t& pc)
{
if (!IsValid())
return false;
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
index 037836ba7bb..ba0e0522059 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
@@ -72,7 +72,7 @@ public:
GetStartPC (lldb::addr_t& start_pc);
bool
- GetPC (lldb::addr_t& start_pc);
+ ReadPC (lldb::addr_t& start_pc);
private:
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 30c867e26c6..533c21c6e24 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -76,7 +76,7 @@ UnwindLLDB::AddFirstFrame ()
if (!first_register_ctx_ap->GetCFA (first_cursor_sp->cfa))
return false;
- if (!first_register_ctx_ap->GetPC (first_cursor_sp->start_pc))
+ if (!first_register_ctx_ap->ReadPC (first_cursor_sp->start_pc))
return false;
// Everything checks out, so release the auto pointer value and let the
@@ -132,7 +132,7 @@ UnwindLLDB::AddOneMoreFrame ()
}
return false;
}
- if (!register_ctx_ap->GetPC (cursor_sp->start_pc))
+ if (!register_ctx_ap->ReadPC (cursor_sp->start_pc))
{
if (log)
{
@@ -141,6 +141,15 @@ UnwindLLDB::AddOneMoreFrame ()
}
return false;
}
+ if (!m_frames.empty())
+ {
+ if ((m_frames.back()->start_pc == cursor_sp->start_pc) &&
+ (m_frames.back()->cfa == cursor_sp->cfa))
+ {
+ // Infinite loop where the current cursor is the same as the previous one...
+ return false;
+ }
+ }
RegisterContextSP register_ctx_sp(register_ctx_ap.release());
cursor_sp->reg_ctx = register_ctx_sp;
m_frames.push_back (cursor_sp);
OpenPOWER on IntegriCloud