Add SetCurrentInlinedDepth API.

In GetFramesUpTo, don't adjust the number of frames for the inlined depth if the number of frames in UINT32_MAX.

llvm-svn: 163432
This commit is contained in:
Jim Ingham
2012-09-07 23:35:54 +00:00
parent cfa4e9bdf3
commit 6cd41da75d
2 changed files with 30 additions and 5 deletions

View File

@@ -13,6 +13,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Symbol/Block.h"
@@ -77,13 +78,16 @@ StackFrameList::CalculateCurrentInlinedDepth()
uint32_t
StackFrameList::GetCurrentInlinedDepth ()
{
if (m_show_inlined_frames)
if (m_show_inlined_frames && m_current_inlined_pc != LLDB_INVALID_ADDRESS)
{
lldb::addr_t cur_pc = m_thread.GetRegisterContext()->GetPC();
if (cur_pc != m_current_inlined_pc)
{
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
m_current_inlined_depth = UINT32_MAX;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
log->Printf ("GetCurrentInlinedDepth: invalidating current inlined depth.\n");
}
return m_current_inlined_depth;
}
@@ -103,6 +107,9 @@ StackFrameList::ResetCurrentInlinedDepth ()
{
m_current_inlined_depth = UINT32_MAX;
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
log->Printf ("ResetCurrentInlinedDepth: Invalidating current inlined depth.\n");
}
else
{
@@ -169,6 +176,9 @@ StackFrameList::ResetCurrentInlinedDepth ()
}
m_current_inlined_pc = curr_pc;
m_current_inlined_depth = num_inlined_functions + 1;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log && log->GetVerbose())
log->Printf ("ResetCurrentInlinedDepth: setting inlined depth: %d 0x%llx.\n", m_current_inlined_depth, curr_pc);
}
break;
@@ -199,6 +209,16 @@ StackFrameList::DecrementCurrentInlinedDepth ()
return false;
}
void
StackFrameList::SetCurrentInlinedDepth (uint32_t new_depth)
{
m_current_inlined_depth = new_depth;
if (new_depth == UINT32_MAX)
m_current_inlined_pc = LLDB_INVALID_ADDRESS;
else
m_current_inlined_pc = m_thread.GetRegisterContext()->GetPC();
}
void
StackFrameList::GetFramesUpTo(uint32_t end_idx)
{
@@ -215,10 +235,11 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
#endif
// If we are hiding some frames from the outside world, we need to add those onto the total count of
// frames to fetch. However, we don't need ot do that if end_idx is 0 since in that case we always
// get the first concrete frame and all the inlined frames below it...
// get the first concrete frame and all the inlined frames below it... And of course, if end_idx is
// UINT32_MAX that means get all, so just do that...
uint32_t inlined_depth = 0;
if (end_idx > 0)
if (end_idx > 0 && end_idx != UINT32_MAX)
{
inlined_depth = GetCurrentInlinedDepth();
if (inlined_depth != UINT32_MAX)
@@ -322,8 +343,9 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
StackFrameList *prev_frames = m_prev_frames_sp.get();
StackFrameList *curr_frames = this;
curr_frames->m_current_inlined_depth = prev_frames->m_current_inlined_depth;
curr_frames->m_current_inlined_pc = prev_frames->m_current_inlined_pc;
//curr_frames->m_current_inlined_depth = prev_frames->m_current_inlined_depth;
//curr_frames->m_current_inlined_pc = prev_frames->m_current_inlined_pc;
//printf ("GetFramesUpTo: Copying current inlined depth: %d 0x%llx.\n", curr_frames->m_current_inlined_depth, curr_frames->m_current_inlined_pc);
#if defined (DEBUG_STACK_FRAMES)
s.PutCString("\nprev_frames:\n");