Skip to content

Commit 5a5a94e

Browse files
committed
[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
1 parent 34c697c commit 5a5a94e

2 files changed

Lines changed: 0 additions & 102 deletions

File tree

‎lldb/include/lldb/Target/StackFrameList.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ class StackFrameList {
8989

9090
bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp);
9191

92-
static void Merge(std::unique_ptr<StackFrameList> &curr_up,
93-
lldb::StackFrameListSP &prev_sp);
94-
9592
void GetFramesUpTo(uint32_t end_idx);
9693

9794
void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind &unwinder);

‎lldb/source/Target/StackFrameList.cpp‎

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -823,105 +823,6 @@ void StackFrameList::Clear() {
823823
m_concrete_frames_fetched = 0;
824824
}
825825

826-
void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_up,
827-
lldb::StackFrameListSP &prev_sp) {
828-
std::unique_lock<std::recursive_mutex> current_lock, previous_lock;
829-
if (curr_up)
830-
current_lock = std::unique_lock<std::recursive_mutex>(curr_up->m_mutex);
831-
if (prev_sp)
832-
previous_lock = std::unique_lock<std::recursive_mutex>(prev_sp->m_mutex);
833-
834-
#if defined(DEBUG_STACK_FRAMES)
835-
StreamFile s(stdout, false);
836-
s.PutCString("\n\nStackFrameList::Merge():\nPrev:\n");
837-
if (prev_sp)
838-
prev_sp->Dump(&s);
839-
else
840-
s.PutCString("NULL");
841-
s.PutCString("\nCurr:\n");
842-
if (curr_up)
843-
curr_up->Dump(&s);
844-
else
845-
s.PutCString("NULL");
846-
s.EOL();
847-
#endif
848-
849-
if (!curr_up || curr_up->GetNumFrames(false) == 0) {
850-
#if defined(DEBUG_STACK_FRAMES)
851-
s.PutCString("No current frames, leave previous frames alone...\n");
852-
#endif
853-
curr_up.release();
854-
return;
855-
}
856-
857-
if (!prev_sp || prev_sp->GetNumFrames(false) == 0) {
858-
#if defined(DEBUG_STACK_FRAMES)
859-
s.PutCString("No previous frames, so use current frames...\n");
860-
#endif
861-
// We either don't have any previous frames, or since we have more than one
862-
// current frames it means we have all the frames and can safely replace
863-
// our previous frames.
864-
prev_sp.reset(curr_up.release());
865-
return;
866-
}
867-
868-
const uint32_t num_curr_frames = curr_up->GetNumFrames(false);
869-
870-
if (num_curr_frames > 1) {
871-
#if defined(DEBUG_STACK_FRAMES)
872-
s.PutCString(
873-
"We have more than one current frame, so use current frames...\n");
874-
#endif
875-
// We have more than one current frames it means we have all the frames and
876-
// can safely replace our previous frames.
877-
prev_sp.reset(curr_up.release());
878-
879-
#if defined(DEBUG_STACK_FRAMES)
880-
s.PutCString("\nMerged:\n");
881-
prev_sp->Dump(&s);
882-
#endif
883-
return;
884-
}
885-
886-
StackFrameSP prev_frame_zero_sp(prev_sp->GetFrameAtIndex(0));
887-
StackFrameSP curr_frame_zero_sp(curr_up->GetFrameAtIndex(0));
888-
StackID curr_stack_id(curr_frame_zero_sp->GetStackID());
889-
StackID prev_stack_id(prev_frame_zero_sp->GetStackID());
890-
891-
#if defined(DEBUG_STACK_FRAMES)
892-
const uint32_t num_prev_frames = prev_sp->GetNumFrames(false);
893-
s.Printf("\n%u previous frames with one current frame\n", num_prev_frames);
894-
#endif
895-
896-
// We have only a single current frame
897-
// Our previous stack frames only had a single frame as well...
898-
if (curr_stack_id == prev_stack_id) {
899-
#if defined(DEBUG_STACK_FRAMES)
900-
s.Printf("\nPrevious frame #0 is same as current frame #0, merge the "
901-
"cached data\n");
902-
#endif
903-
904-
curr_frame_zero_sp->UpdateCurrentFrameFromPreviousFrame(
905-
*prev_frame_zero_sp);
906-
// prev_frame_zero_sp->UpdatePreviousFrameFromCurrentFrame
907-
// (*curr_frame_zero_sp);
908-
// prev_sp->SetFrameAtIndex (0, prev_frame_zero_sp);
909-
} else if (curr_stack_id < prev_stack_id) {
910-
#if defined(DEBUG_STACK_FRAMES)
911-
s.Printf("\nCurrent frame #0 has a stack ID that is less than the previous "
912-
"frame #0, insert current frame zero in front of previous\n");
913-
#endif
914-
prev_sp->m_frames.insert(prev_sp->m_frames.begin(), curr_frame_zero_sp);
915-
}
916-
917-
curr_up.release();
918-
919-
#if defined(DEBUG_STACK_FRAMES)
920-
s.PutCString("\nMerged:\n");
921-
prev_sp->Dump(&s);
922-
#endif
923-
}
924-
925826
lldb::StackFrameSP
926827
StackFrameList::GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr) {
927828
const_iterator pos;

0 commit comments

Comments
 (0)