Coverage Report

Created: 2022-07-16 07:03

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/tools/lldb-vscode/BreakpointBase.h
Line
Count
Source (jump to first uncovered line)
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
#include <vector>
17
18
namespace lldb_vscode {
19
20
struct BreakpointBase {
21
  // logMessage part can be either a raw text or an expression.
22
  struct LogMessagePart {
23
    LogMessagePart(llvm::StringRef text, bool is_expr)
24
0
        : text(text), is_expr(is_expr) {}
25
    llvm::StringRef text;
26
    bool is_expr;
27
  };
28
  // An optional expression for conditional breakpoints.
29
  std::string condition;
30
  // An optional expression that controls how many hits of the breakpoint are
31
  // ignored. The backend is expected to interpret the expression as needed
32
  std::string hitCondition;
33
  // If this attribute exists and is non-empty, the backend must not 'break'
34
  // (stop) but log the message instead. Expressions within {} are
35
  // interpolated.
36
  std::string logMessage;
37
  std::vector<LogMessagePart> logMessageParts;
38
  // The LLDB breakpoint associated wit this source breakpoint
39
  lldb::SBBreakpoint bp;
40
41
0
  BreakpointBase() = default;
42
  BreakpointBase(const llvm::json::Object &obj);
43
44
  void SetCondition();
45
  void SetHitCondition();
46
  void SetLogMessage();
47
  void UpdateBreakpoint(const BreakpointBase &request_bp);
48
  static const char *GetBreakpointLabel();
49
  static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process,
50
                                    lldb::SBThread &thread,
51
                                    lldb::SBBreakpointLocation &location);
52
};
53
54
} // namespace lldb_vscode
55
56
#endif