forked from OSchip/llvm-project
[lldb] Delete dead StackFrameList::Merge
That code is unused since it's check-in in 2010 (and I believe it would leak memory when called as it releases the passed unique_ptr), so let's delete it. Reviewed By: vsk Differential Revision: https://reviews.llvm.org/D100212
This commit is contained in:
parent
34c697c85e
commit
5a5a94ed34
|
@ -89,9 +89,6 @@ protected:
|
|||
|
||||
bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
|
||||
|
||||
static void Merge(std::unique_ptr<StackFrameList> &curr_up,
|
||||
lldb::StackFrameListSP &prev_sp);
|
||||
|
||||
void GetFramesUpTo(uint32_t end_idx);
|
||||
|
||||
void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind &unwinder);
|
||||
|
|
|
@ -823,105 +823,6 @@ void StackFrameList::Clear() {
|
|||
m_concrete_frames_fetched = 0;
|
||||
}
|
||||
|
||||
void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_up,
|
||||
lldb::StackFrameListSP &prev_sp) {
|
||||
std::unique_lock<std::recursive_mutex> current_lock, previous_lock;
|
||||
if (curr_up)
|
||||
current_lock = std::unique_lock<std::recursive_mutex>(curr_up->m_mutex);
|
||||
if (prev_sp)
|
||||
previous_lock = std::unique_lock<std::recursive_mutex>(prev_sp->m_mutex);
|
||||
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
StreamFile s(stdout, false);
|
||||
s.PutCString("\n\nStackFrameList::Merge():\nPrev:\n");
|
||||
if (prev_sp)
|
||||
prev_sp->Dump(&s);
|
||||
else
|
||||
s.PutCString("NULL");
|
||||
s.PutCString("\nCurr:\n");
|
||||
if (curr_up)
|
||||
curr_up->Dump(&s);
|
||||
else
|
||||
s.PutCString("NULL");
|
||||
s.EOL();
|
||||
#endif
|
||||
|
||||
if (!curr_up || curr_up->GetNumFrames(false) == 0) {
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.PutCString("No current frames, leave previous frames alone...\n");
|
||||
#endif
|
||||
curr_up.release();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prev_sp || prev_sp->GetNumFrames(false) == 0) {
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.PutCString("No previous frames, so use current frames...\n");
|
||||
#endif
|
||||
// We either don't have any previous frames, or since we have more than one
|
||||
// current frames it means we have all the frames and can safely replace
|
||||
// our previous frames.
|
||||
prev_sp.reset(curr_up.release());
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t num_curr_frames = curr_up->GetNumFrames(false);
|
||||
|
||||
if (num_curr_frames > 1) {
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.PutCString(
|
||||
"We have more than one current frame, so use current frames...\n");
|
||||
#endif
|
||||
// We have more than one current frames it means we have all the frames and
|
||||
// can safely replace our previous frames.
|
||||
prev_sp.reset(curr_up.release());
|
||||
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.PutCString("\nMerged:\n");
|
||||
prev_sp->Dump(&s);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
StackFrameSP prev_frame_zero_sp(prev_sp->GetFrameAtIndex(0));
|
||||
StackFrameSP curr_frame_zero_sp(curr_up->GetFrameAtIndex(0));
|
||||
StackID curr_stack_id(curr_frame_zero_sp->GetStackID());
|
||||
StackID prev_stack_id(prev_frame_zero_sp->GetStackID());
|
||||
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
const uint32_t num_prev_frames = prev_sp->GetNumFrames(false);
|
||||
s.Printf("\n%u previous frames with one current frame\n", num_prev_frames);
|
||||
#endif
|
||||
|
||||
// We have only a single current frame
|
||||
// Our previous stack frames only had a single frame as well...
|
||||
if (curr_stack_id == prev_stack_id) {
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.Printf("\nPrevious frame #0 is same as current frame #0, merge the "
|
||||
"cached data\n");
|
||||
#endif
|
||||
|
||||
curr_frame_zero_sp->UpdateCurrentFrameFromPreviousFrame(
|
||||
*prev_frame_zero_sp);
|
||||
// prev_frame_zero_sp->UpdatePreviousFrameFromCurrentFrame
|
||||
// (*curr_frame_zero_sp);
|
||||
// prev_sp->SetFrameAtIndex (0, prev_frame_zero_sp);
|
||||
} else if (curr_stack_id < prev_stack_id) {
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.Printf("\nCurrent frame #0 has a stack ID that is less than the previous "
|
||||
"frame #0, insert current frame zero in front of previous\n");
|
||||
#endif
|
||||
prev_sp->m_frames.insert(prev_sp->m_frames.begin(), curr_frame_zero_sp);
|
||||
}
|
||||
|
||||
curr_up.release();
|
||||
|
||||
#if defined(DEBUG_STACK_FRAMES)
|
||||
s.PutCString("\nMerged:\n");
|
||||
prev_sp->Dump(&s);
|
||||
#endif
|
||||
}
|
||||
|
||||
lldb::StackFrameSP
|
||||
StackFrameList::GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr) {
|
||||
const_iterator pos;
|
||||
|
|
Loading…
Reference in New Issue