brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 802ec71 Raw
56 lines · c
1//===-- ExceptionBreakpoint.h -----------------------------------*- C++ -*-===//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#ifndef LLDB_TOOLS_LLDB_DAP_EXCEPTIONBREAKPOINT_H10#define LLDB_TOOLS_LLDB_DAP_EXCEPTIONBREAKPOINT_H11 12#include "DAPForward.h"13#include "Protocol/ProtocolTypes.h"14#include "lldb/API/SBBreakpoint.h"15#include "lldb/lldb-enumerations.h"16#include "llvm/ADT/StringRef.h"17#include <string>18#include <utility>19 20namespace lldb_dap {21 22enum ExceptionKind : unsigned {23  eExceptionKindCatch,24  eExceptionKindThrow,25};26 27class ExceptionBreakpoint {28public:29  ExceptionBreakpoint(DAP &d, std::string f, std::string l,30                      lldb::LanguageType lang, ExceptionKind kind)31      : m_dap(d), m_filter(std::move(f)), m_label(std::move(l)),32        m_language(lang), m_kind(kind), m_bp() {}33 34  protocol::Breakpoint SetBreakpoint() { return SetBreakpoint(""); };35  protocol::Breakpoint SetBreakpoint(llvm::StringRef condition);36  void ClearBreakpoint();37 38  lldb::break_id_t GetID() const { return m_bp.GetID(); }39  llvm::StringRef GetFilter() const { return m_filter; }40  llvm::StringRef GetLabel() const { return m_label; }41 42  static constexpr bool kDefaultValue = false;43 44protected:45  DAP &m_dap;46  std::string m_filter;47  std::string m_label;48  lldb::LanguageType m_language;49  ExceptionKind m_kind;50  lldb::SBBreakpoint m_bp;51};52 53} // namespace lldb_dap54 55#endif56