aboutsummaryrefslogtreecommitdiffstats
path: root/source/Target/StackFrameList.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
commit5f29bb8a675e8f96452b632e7129113f7dec850e (patch)
tree3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /source/Target/StackFrameList.cpp
parent88c643b6fec27eec436c8d138fee6346e92337d6 (diff)
downloadsrc-5f29bb8a675e8f96452b632e7129113f7dec850e.tar.gz
src-5f29bb8a675e8f96452b632e7129113f7dec850e.zip
Vendor import of stripped lldb trunk r366426 (just before the release_90
Notes
Notes: svn path=/vendor/lldb/dist/; revision=351290
Diffstat (limited to 'source/Target/StackFrameList.cpp')
-rw-r--r--source/Target/StackFrameList.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp
index fc9fcec6c076..5492dda46402 100644
--- a/source/Target/StackFrameList.cpp
+++ b/source/Target/StackFrameList.cpp
@@ -1,9 +1,8 @@
//===-- StackFrameList.cpp --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -25,14 +24,14 @@
#include "lldb/Utility/Log.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include <memory>
+
//#define DEBUG_STACK_FRAMES 1
using namespace lldb;
using namespace lldb_private;
-//----------------------------------------------------------------------
// StackFrameList constructor
-//----------------------------------------------------------------------
StackFrameList::StackFrameList(Thread &thread,
const lldb::StackFrameListSP &prev_frames_sp,
bool show_inline_frames)
@@ -466,9 +465,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) {
pc = reg_ctx_sp->GetPC();
}
- unwind_frame_sp.reset(new StackFrame(m_thread.shared_from_this(),
- m_frames.size(), idx, reg_ctx_sp,
- cfa, pc, nullptr));
+ unwind_frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), m_frames.size(), idx, reg_ctx_sp,
+ cfa, pc, nullptr);
m_frames.push_back(unwind_frame_sp);
}
} else {
@@ -484,9 +483,9 @@ void StackFrameList::GetFramesUpTo(uint32_t end_idx) {
break;
}
const bool cfa_is_valid = true;
- unwind_frame_sp.reset(
- new StackFrame(m_thread.shared_from_this(), m_frames.size(), idx, cfa,
- cfa_is_valid, pc, StackFrame::Kind::Regular, nullptr));
+ unwind_frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), m_frames.size(), idx, cfa, cfa_is_valid,
+ pc, StackFrame::Kind::Regular, nullptr);
// Create synthetic tail call frames between the previous frame and the
// newly-found frame. The new frame's index may change after this call,
@@ -664,9 +663,9 @@ StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) {
addr_t pc, cfa;
if (unwinder->GetFrameInfoAtIndex(idx, cfa, pc)) {
const bool cfa_is_valid = true;
- frame_sp.reset(new StackFrame(m_thread.shared_from_this(), idx, idx,
- cfa, cfa_is_valid, pc,
- StackFrame::Kind::Regular, nullptr));
+ frame_sp = std::make_shared<StackFrame>(
+ m_thread.shared_from_this(), idx, idx, cfa, cfa_is_valid, pc,
+ StackFrame::Kind::Regular, nullptr);
Function *function =
frame_sp->GetSymbolContext(eSymbolContextFunction).function;
@@ -818,11 +817,11 @@ void StackFrameList::Clear() {
m_concrete_frames_fetched = 0;
}
-void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
+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_ap)
- current_lock = std::unique_lock<std::recursive_mutex>(curr_ap->m_mutex);
+ 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);
@@ -834,18 +833,18 @@ void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
else
s.PutCString("NULL");
s.PutCString("\nCurr:\n");
- if (curr_ap)
- curr_ap->Dump(&s);
+ if (curr_up)
+ curr_up->Dump(&s);
else
s.PutCString("NULL");
s.EOL();
#endif
- if (!curr_ap || curr_ap->GetNumFrames(false) == 0) {
+ 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_ap.release();
+ curr_up.release();
return;
}
@@ -856,11 +855,11 @@ void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
// 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_ap.release());
+ prev_sp.reset(curr_up.release());
return;
}
- const uint32_t num_curr_frames = curr_ap->GetNumFrames(false);
+ const uint32_t num_curr_frames = curr_up->GetNumFrames(false);
if (num_curr_frames > 1) {
#if defined(DEBUG_STACK_FRAMES)
@@ -869,7 +868,7 @@ void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
#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_ap.release());
+ prev_sp.reset(curr_up.release());
#if defined(DEBUG_STACK_FRAMES)
s.PutCString("\nMerged:\n");
@@ -879,7 +878,7 @@ void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
}
StackFrameSP prev_frame_zero_sp(prev_sp->GetFrameAtIndex(0));
- StackFrameSP curr_frame_zero_sp(curr_ap->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());
@@ -909,7 +908,7 @@ void StackFrameList::Merge(std::unique_ptr<StackFrameList> &curr_ap,
prev_sp->m_frames.insert(prev_sp->m_frames.begin(), curr_frame_zero_sp);
}
- curr_ap.release();
+ curr_up.release();
#if defined(DEBUG_STACK_FRAMES)
s.PutCString("\nMerged:\n");