xref: /llvm-project/lldb/tools/lldb-vscode/BreakpointBase.h (revision b99d4112585302cbd01f9b851a04adc6e4fb5218)
1 //===-- BreakpointBase.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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
10 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
11 
12 #include "DAPForward.h"
13 #include <string>
14 
15 namespace lldb_dap {
16 
17 struct BreakpointBase {
18   // Associated DAP session.
19   DAP &dap;
20 
21   // An optional expression for conditional breakpoints.
22   std::string condition;
23   // An optional expression that controls how many hits of the breakpoint are
24   // ignored. The backend is expected to interpret the expression as needed
25   std::string hitCondition;
26 
27   explicit BreakpointBase(DAP &d) : dap(d) {}
28   BreakpointBase(DAP &d, const llvm::json::Object &obj);
29   virtual ~BreakpointBase() = default;
30 
31   virtual void SetCondition() = 0;
32   virtual void SetHitCondition() = 0;
33   virtual void CreateJsonObject(llvm::json::Object &object) = 0;
34 
35   void UpdateBreakpoint(const BreakpointBase &request_bp);
36 
37   static const char *GetBreakpointLabel();
38 };
39 
40 } // namespace lldb_dap
41 
42 #endif
43