aboutsummaryrefslogtreecommitdiff
path: root/source/Symbol/UnwindPlan.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Symbol/UnwindPlan.cpp')
-rw-r--r--source/Symbol/UnwindPlan.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/source/Symbol/UnwindPlan.cpp b/source/Symbol/UnwindPlan.cpp
index 80c22c08ee4f..18f0cb7b9dbd 100644
--- a/source/Symbol/UnwindPlan.cpp
+++ b/source/Symbol/UnwindPlan.cpp
@@ -338,7 +338,7 @@ UnwindPlan::AppendRow (const UnwindPlan::RowSP &row_sp)
}
void
-UnwindPlan::InsertRow (const UnwindPlan::RowSP &row_sp)
+UnwindPlan::InsertRow (const UnwindPlan::RowSP &row_sp, bool replace_existing)
{
collection::iterator it = m_row_list.begin();
while (it != m_row_list.end()) {
@@ -349,6 +349,8 @@ UnwindPlan::InsertRow (const UnwindPlan::RowSP &row_sp)
}
if (it == m_row_list.end() || (*it)->GetOffset() != row_sp->GetOffset())
m_row_list.insert(it, row_sp);
+ else if (replace_existing)
+ *it = row_sp;
}
UnwindPlan::RowSP
@@ -383,16 +385,27 @@ UnwindPlan::IsValidRowIndex (uint32_t idx) const
const UnwindPlan::RowSP
UnwindPlan::GetRowAtIndex (uint32_t idx) const
{
- // You must call IsValidRowIndex(idx) first before calling this!!!
- assert (idx < m_row_list.size());
- return m_row_list[idx];
+ if (idx < m_row_list.size())
+ return m_row_list[idx];
+ else
+ {
+ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+ if (log)
+ log->Printf ("error: UnwindPlan::GetRowAtIndex(idx = %u) invalid index (number rows is %u)", idx, (uint32_t)m_row_list.size());
+ return UnwindPlan::RowSP();
+ }
}
const UnwindPlan::RowSP
UnwindPlan::GetLastRow () const
{
- // You must call GetRowCount() first to make sure there is at least one row
- assert (!m_row_list.empty());
+ if (m_row_list.empty())
+ {
+ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+ if (log)
+ log->Printf ("UnwindPlan::GetLastRow() when rows are empty");
+ return UnwindPlan::RowSP();
+ }
return m_row_list.back();
}