brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · d5fa955 Raw
98 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.6//7//===----------------------------------------------------------------------===//8 9#include "lldb/API/SBFrameList.h"10#include "lldb/API/SBFrame.h"11#include "lldb/API/SBStream.h"12#include "lldb/API/SBThread.h"13#include "lldb/Target/StackFrameList.h"14#include "lldb/Target/Thread.h"15#include "lldb/Utility/Instrumentation.h"16 17using namespace lldb;18using namespace lldb_private;19 20SBFrameList::SBFrameList() : m_opaque_sp() { LLDB_INSTRUMENT_VA(this); }21 22SBFrameList::SBFrameList(const SBFrameList &rhs)23    : m_opaque_sp(rhs.m_opaque_sp) {24  LLDB_INSTRUMENT_VA(this, rhs);25}26 27SBFrameList::~SBFrameList() = default;28 29const SBFrameList &SBFrameList::operator=(const SBFrameList &rhs) {30  LLDB_INSTRUMENT_VA(this, rhs);31 32  if (this != &rhs)33    m_opaque_sp = rhs.m_opaque_sp;34  return *this;35}36 37SBFrameList::SBFrameList(const lldb::StackFrameListSP &frame_list_sp)38    : m_opaque_sp(frame_list_sp) {}39 40void SBFrameList::SetFrameList(const lldb::StackFrameListSP &frame_list_sp) {41  m_opaque_sp = frame_list_sp;42}43 44SBFrameList::operator bool() const {45  LLDB_INSTRUMENT_VA(this);46 47  return m_opaque_sp.get() != nullptr;48}49 50bool SBFrameList::IsValid() const {51  LLDB_INSTRUMENT_VA(this);52  return this->operator bool();53}54 55uint32_t SBFrameList::GetSize() const {56  LLDB_INSTRUMENT_VA(this);57 58  if (m_opaque_sp)59    return m_opaque_sp->GetNumFrames();60  return 0;61}62 63SBFrame SBFrameList::GetFrameAtIndex(uint32_t idx) const {64  LLDB_INSTRUMENT_VA(this, idx);65 66  SBFrame sb_frame;67  if (m_opaque_sp)68    sb_frame.SetFrameSP(m_opaque_sp->GetFrameAtIndex(idx));69  return sb_frame;70}71 72SBThread SBFrameList::GetThread() const {73  LLDB_INSTRUMENT_VA(this);74 75  SBThread sb_thread;76  if (m_opaque_sp)77    sb_thread.SetThread(m_opaque_sp->GetThread().shared_from_this());78  return sb_thread;79}80 81void SBFrameList::Clear() {82  LLDB_INSTRUMENT_VA(this);83 84  if (m_opaque_sp)85    m_opaque_sp->Clear();86}87 88bool SBFrameList::GetDescription(SBStream &description) const {89  LLDB_INSTRUMENT_VA(this, description);90 91  if (!m_opaque_sp)92    return false;93 94  Stream &strm = description.ref();95  m_opaque_sp->Dump(&strm);96  return true;97}98