forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBreakpointBase.h
59 lines (47 loc) · 2.24 KB
/
BreakpointBase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//===-- BreakpointBase.h ----------------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
#define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
#include "DAPForward.h"
#include "llvm/ADT/StringRef.h"
#include <string>
namespace lldb_dap {
class BreakpointBase {
public:
explicit BreakpointBase(DAP &d) : m_dap(d) {}
BreakpointBase(DAP &d, const llvm::json::Object &obj);
virtual ~BreakpointBase() = default;
virtual void SetCondition() = 0;
virtual void SetHitCondition() = 0;
virtual void CreateJsonObject(llvm::json::Object &object) = 0;
void UpdateBreakpoint(const BreakpointBase &request_bp);
/// Breakpoints in LLDB can have names added to them which are kind of like
/// labels or categories. All breakpoints that are set through DAP get sent
/// through the various DAP set*Breakpoint packets, and these breakpoints will
/// be labeled with this name so if breakpoint update events come in for
/// breakpoints that the client doesn't know about, like if a breakpoint is
/// set manually using the debugger console, we won't report any updates on
/// them and confused the client. This label gets added by all of the
/// breakpoint classes after they set breakpoints to mark a breakpoint as a
/// DAP breakpoint. We can later check a lldb::SBBreakpoint object that comes
/// in via LLDB breakpoint changed events and check the breakpoint by calling
/// "bool lldb::SBBreakpoint::MatchesName(const char *)" to check if a
/// breakpoint in one of the DAP breakpoints that we should report changes
/// for.
static constexpr const char *kDAPBreakpointLabel = "dap";
protected:
/// Associated DAP session.
DAP &m_dap;
/// An optional expression for conditional breakpoints.
std::string m_condition;
/// An optional expression that controls how many hits of the breakpoint are
/// ignored. The backend is expected to interpret the expression as needed
std::string m_hit_condition;
};
} // namespace lldb_dap
#endif