brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 62e9c21 Raw
74 lines · cpp
1//===-- SBWatchpointOptions.cpp -------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/API/SBWatchpointOptions.h"10#include "lldb/Breakpoint/Watchpoint.h"11#include "lldb/Utility/Instrumentation.h"12 13#include "Utils.h"14 15using namespace lldb;16using namespace lldb_private;17 18class WatchpointOptionsImpl {19public:20  bool m_read = false;21  bool m_write = false;22  bool m_modify = false;23};24 25 26SBWatchpointOptions::SBWatchpointOptions()27    : m_opaque_up(new WatchpointOptionsImpl()) {28  LLDB_INSTRUMENT_VA(this);29}30 31SBWatchpointOptions::SBWatchpointOptions(const SBWatchpointOptions &rhs) {32  LLDB_INSTRUMENT_VA(this, rhs);33 34  m_opaque_up = clone(rhs.m_opaque_up);35}36 37const SBWatchpointOptions &38SBWatchpointOptions::operator=(const SBWatchpointOptions &rhs) {39  LLDB_INSTRUMENT_VA(this, rhs);40 41  if (this != &rhs)42    m_opaque_up = clone(rhs.m_opaque_up);43  return *this;44}45 46SBWatchpointOptions::~SBWatchpointOptions() = default;47 48void SBWatchpointOptions::SetWatchpointTypeRead(bool read) {49  m_opaque_up->m_read = read;50}51bool SBWatchpointOptions::GetWatchpointTypeRead() const {52  return m_opaque_up->m_read;53}54 55void SBWatchpointOptions::SetWatchpointTypeWrite(56    WatchpointWriteType write_type) {57  if (write_type == eWatchpointWriteTypeOnModify) {58    m_opaque_up->m_write = false;59    m_opaque_up->m_modify = true;60  } else if (write_type == eWatchpointWriteTypeAlways) {61    m_opaque_up->m_write = true;62    m_opaque_up->m_modify = false;63  } else64    m_opaque_up->m_write = m_opaque_up->m_modify = false;65}66 67WatchpointWriteType SBWatchpointOptions::GetWatchpointTypeWrite() const {68  if (m_opaque_up->m_modify)69    return eWatchpointWriteTypeOnModify;70  if (m_opaque_up->m_write)71    return eWatchpointWriteTypeAlways;72  return eWatchpointWriteTypeDisabled;73}74