[Lldb-commits] [lldb] 5a5a94e - [lldb] Delete dead StackFrameList::Merge
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 12 05:49:40 PDT 2021
Author: Raphael Isemann
Date: 2021-04-12T14:49:20+02:00
New Revision: 5a5a94ed34b07079046ac81e7e97d980ce2c834f
URL: https://github.com/llvm/llvm-project/commit/5a5a94ed34b07079046ac81e7e97d980ce2c834f
DIFF: https://github.com/llvm/llvm-project/commit/5a5a94ed34b07079046ac81e7e97d980ce2c834f.diff
LOG: [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
Added:
Modified:
lldb/include/lldb/Target/StackFrameList.h
lldb/source/Target/StackFrameList.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h
index 1b0b986d7059d..c98995cad36fd 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -89,9 +89,6 @@ class StackFrameList {
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);
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 95ebfb58a7ec0..ed40356bef604 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -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;
More information about the lldb-commits
mailing list