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_VSCODE_BREAKPOINTBASE_H
10 #define LLDB_TOOLS_LLDB_VSCODE_BREAKPOINTBASE_H
11 
12 #include "JSONUtils.h"
13 #include "lldb/API/SBBreakpoint.h"
14 #include "llvm/Support/JSON.h"
15 #include <string>
16 
17 namespace lldb_vscode {
18 
19 struct BreakpointBase {
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   // If this attribute exists and is non-empty, the backend must not 'break'
27   // (stop) but log the message instead. Expressions within {} are
28   // interpolated.
29   std::string logMessage;
30   // The LLDB breakpoint associated wit this source breakpoint
31   lldb::SBBreakpoint bp;
32 
33   BreakpointBase() = default;
34   BreakpointBase(const llvm::json::Object &obj);
35 
36   void SetCondition();
37   void SetHitCondition();
38   void UpdateBreakpoint(const BreakpointBase &request_bp);
39   static const char *GetBreakpointLabel();
40 };
41 
42 } // namespace lldb_vscode
43 
44 #endif
45