mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 13:35:38 +08:00
Add a new base class, Frame. It is a pure virtual function which
defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "lldb/Symbol/Symbol.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/Target/Frame.h"
|
||||
#include "lldb/Target/StackFrame.h"
|
||||
#include "lldb/Target/StopInfo.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
@@ -284,7 +285,7 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
||||
}
|
||||
}
|
||||
|
||||
StackFrameSP unwind_frame_sp;
|
||||
FrameSP unwind_frame_sp;
|
||||
do
|
||||
{
|
||||
uint32_t idx = m_concrete_frames_fetched++;
|
||||
@@ -324,7 +325,7 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
||||
else
|
||||
{
|
||||
unwind_frame_sp = m_frames.front();
|
||||
cfa = unwind_frame_sp->m_id.GetCallFrameAddress();
|
||||
cfa = unwind_frame_sp->GetStackID().GetCallFrameAddress();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -358,7 +359,7 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
||||
|
||||
while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, next_frame_sc, next_frame_address))
|
||||
{
|
||||
StackFrameSP frame_sp(new StackFrame (m_thread.shared_from_this(),
|
||||
FrameSP frame_sp(new StackFrame (m_thread.shared_from_this(),
|
||||
m_frames.size(),
|
||||
idx,
|
||||
unwind_frame_sp->GetRegisterContextSP (),
|
||||
@@ -398,8 +399,8 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
||||
{
|
||||
const size_t curr_frame_idx = curr_frame_num-1;
|
||||
const size_t prev_frame_idx = prev_frame_num-1;
|
||||
StackFrameSP curr_frame_sp (curr_frames->m_frames[curr_frame_idx]);
|
||||
StackFrameSP prev_frame_sp (prev_frames->m_frames[prev_frame_idx]);
|
||||
FrameSP curr_frame_sp (curr_frames->m_frames[curr_frame_idx]);
|
||||
FrameSP prev_frame_sp (prev_frames->m_frames[prev_frame_idx]);
|
||||
|
||||
#if defined (DEBUG_STACK_FRAMES)
|
||||
s.Printf("\n\nCurr frame #%u ", curr_frame_idx);
|
||||
@@ -414,8 +415,8 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
||||
s.PutCString("NULL");
|
||||
#endif
|
||||
|
||||
StackFrame *curr_frame = curr_frame_sp.get();
|
||||
StackFrame *prev_frame = prev_frame_sp.get();
|
||||
Frame *curr_frame = curr_frame_sp.get();
|
||||
Frame *prev_frame = prev_frame_sp.get();
|
||||
|
||||
if (curr_frame == NULL || prev_frame == NULL)
|
||||
break;
|
||||
@@ -484,7 +485,7 @@ StackFrameList::Dump (Stream *s)
|
||||
const_iterator pos, begin = m_frames.begin(), end = m_frames.end();
|
||||
for (pos = begin; pos != end; ++pos)
|
||||
{
|
||||
StackFrame *frame = (*pos).get();
|
||||
Frame *frame = (*pos).get();
|
||||
s->Printf("%p: ", frame);
|
||||
if (frame)
|
||||
{
|
||||
@@ -498,10 +499,10 @@ StackFrameList::Dump (Stream *s)
|
||||
s->EOL();
|
||||
}
|
||||
|
||||
StackFrameSP
|
||||
FrameSP
|
||||
StackFrameList::GetFrameAtIndex (uint32_t idx)
|
||||
{
|
||||
StackFrameSP frame_sp;
|
||||
FrameSP frame_sp;
|
||||
Mutex::Locker locker (m_mutex);
|
||||
uint32_t original_idx = idx;
|
||||
|
||||
@@ -575,7 +576,7 @@ StackFrameList::GetFrameAtIndex (uint32_t idx)
|
||||
return frame_sp;
|
||||
}
|
||||
|
||||
StackFrameSP
|
||||
FrameSP
|
||||
StackFrameList::GetFrameWithConcreteFrameIndex (uint32_t unwind_idx)
|
||||
{
|
||||
// First try assuming the unwind index is the same as the frame index. The
|
||||
@@ -585,7 +586,7 @@ StackFrameList::GetFrameWithConcreteFrameIndex (uint32_t unwind_idx)
|
||||
// frames after we make all the inlined frames. Most of the time the unwind
|
||||
// frame index (or the concrete frame index) is the same as the frame index.
|
||||
uint32_t frame_idx = unwind_idx;
|
||||
StackFrameSP frame_sp (GetFrameAtIndex (frame_idx));
|
||||
FrameSP frame_sp (GetFrameAtIndex (frame_idx));
|
||||
while (frame_sp)
|
||||
{
|
||||
if (frame_sp->GetFrameIndex() == unwind_idx)
|
||||
@@ -596,15 +597,15 @@ StackFrameList::GetFrameWithConcreteFrameIndex (uint32_t unwind_idx)
|
||||
}
|
||||
|
||||
static bool
|
||||
CompareStackID (const StackFrameSP &stack_sp, const StackID &stack_id)
|
||||
CompareStackID (const FrameSP &stack_sp, const StackID &stack_id)
|
||||
{
|
||||
return stack_sp->GetStackID() < stack_id;
|
||||
}
|
||||
|
||||
StackFrameSP
|
||||
FrameSP
|
||||
StackFrameList::GetFrameWithStackID (const StackID &stack_id)
|
||||
{
|
||||
StackFrameSP frame_sp;
|
||||
FrameSP frame_sp;
|
||||
|
||||
if (stack_id.IsValid())
|
||||
{
|
||||
@@ -635,7 +636,7 @@ StackFrameList::GetFrameWithStackID (const StackID &stack_id)
|
||||
}
|
||||
|
||||
bool
|
||||
StackFrameList::SetFrameAtIndex (uint32_t idx, StackFrameSP &frame_sp)
|
||||
StackFrameList::SetFrameAtIndex (uint32_t idx, FrameSP &frame_sp)
|
||||
{
|
||||
if (idx >= m_frames.size())
|
||||
m_frames.resize(idx + 1);
|
||||
@@ -657,7 +658,7 @@ StackFrameList::GetSelectedFrameIndex () const
|
||||
|
||||
|
||||
uint32_t
|
||||
StackFrameList::SetSelectedFrame (lldb_private::StackFrame *frame)
|
||||
StackFrameList::SetSelectedFrame (lldb_private::Frame *frame)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
const_iterator pos;
|
||||
@@ -684,7 +685,7 @@ bool
|
||||
StackFrameList::SetSelectedFrameByIndex (uint32_t idx)
|
||||
{
|
||||
Mutex::Locker locker (m_mutex);
|
||||
StackFrameSP frame_sp (GetFrameAtIndex (idx));
|
||||
FrameSP frame_sp (GetFrameAtIndex (idx));
|
||||
if (frame_sp)
|
||||
{
|
||||
SetSelectedFrame(frame_sp.get());
|
||||
@@ -699,7 +700,7 @@ StackFrameList::SetDefaultFileAndLineToSelectedFrame()
|
||||
{
|
||||
if (m_thread.GetID() == m_thread.GetProcess()->GetThreadList().GetSelectedThread()->GetID())
|
||||
{
|
||||
StackFrameSP frame_sp (GetFrameAtIndex (GetSelectedFrameIndex()));
|
||||
FrameSP frame_sp (GetFrameAtIndex (GetSelectedFrameIndex()));
|
||||
if (frame_sp)
|
||||
{
|
||||
SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextLineEntry);
|
||||
@@ -799,8 +800,8 @@ StackFrameList::Merge (std::unique_ptr<StackFrameList>& curr_ap, lldb::StackFram
|
||||
return;
|
||||
}
|
||||
|
||||
StackFrameSP prev_frame_zero_sp(prev_sp->GetFrameAtIndex (0));
|
||||
StackFrameSP curr_frame_zero_sp(curr_ap->GetFrameAtIndex (0));
|
||||
FrameSP prev_frame_zero_sp(prev_sp->GetFrameAtIndex (0));
|
||||
FrameSP curr_frame_zero_sp(curr_ap->GetFrameAtIndex (0));
|
||||
StackID curr_stack_id (curr_frame_zero_sp->GetStackID());
|
||||
StackID prev_stack_id (prev_frame_zero_sp->GetStackID());
|
||||
|
||||
@@ -839,13 +840,13 @@ StackFrameList::Merge (std::unique_ptr<StackFrameList>& curr_ap, lldb::StackFram
|
||||
|
||||
}
|
||||
|
||||
lldb::StackFrameSP
|
||||
StackFrameList::GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr)
|
||||
lldb::FrameSP
|
||||
StackFrameList::GetFrameSPForFramePtr (Frame *stack_frame_ptr)
|
||||
{
|
||||
const_iterator pos;
|
||||
const_iterator begin = m_frames.begin();
|
||||
const_iterator end = m_frames.end();
|
||||
lldb::StackFrameSP ret_sp;
|
||||
lldb::FrameSP ret_sp;
|
||||
|
||||
for (pos = begin; pos != end; ++pos)
|
||||
{
|
||||
@@ -871,7 +872,7 @@ StackFrameList::GetStatus (Stream& strm,
|
||||
if (num_frames == 0)
|
||||
return 0;
|
||||
|
||||
StackFrameSP frame_sp;
|
||||
FrameSP frame_sp;
|
||||
uint32_t frame_idx = 0;
|
||||
uint32_t last_frame;
|
||||
|
||||
@@ -881,7 +882,7 @@ StackFrameList::GetStatus (Stream& strm,
|
||||
else
|
||||
last_frame = first_frame + num_frames;
|
||||
|
||||
StackFrameSP selected_frame_sp = m_thread.GetSelectedFrame();
|
||||
FrameSP selected_frame_sp = m_thread.GetSelectedFrame();
|
||||
const char *unselected_marker = NULL;
|
||||
std::string buffer;
|
||||
if (selected_frame_marker)
|
||||
|
||||
Reference in New Issue
Block a user