Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Utility/TraceGDBRemotePackets.h
Line
Count
Source (jump to first uncovered line)
1
//===-- TraceGDBRemotePackets.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_UTILITY_TRACEGDBREMOTEPACKETS_H
10
#define LLDB_UTILITY_TRACEGDBREMOTEPACKETS_H
11
12
#include "llvm/Support/JSON.h"
13
14
#include "lldb/lldb-defines.h"
15
#include "lldb/lldb-enumerations.h"
16
17
/// See docs/lldb-gdb-remote.txt for more information.
18
namespace lldb_private {
19
20
/// jLLDBTraceSupported gdb-remote packet
21
/// \{
22
struct TraceSupportedResponse {
23
  /// The name of the technology, e.g. intel-pt or arm-coresight.
24
  ///
25
  /// In order for a Trace plug-in (see \a lldb_private::Trace.h) to support the
26
  /// trace technology given by this struct, it should match its name with this
27
  /// field.
28
  std::string name;
29
  /// The description for the technology.
30
  std::string description;
31
};
32
33
bool fromJSON(const llvm::json::Value &value, TraceSupportedResponse &info,
34
              llvm::json::Path path);
35
36
llvm::json::Value toJSON(const TraceSupportedResponse &packet);
37
/// \}
38
39
/// jLLDBTraceStart gdb-remote packet
40
/// \{
41
struct TraceStartRequest {
42
  /// Tracing technology name, e.g. intel-pt, arm-coresight.
43
  std::string type;
44
45
  /// If \a llvm::None, then this starts tracing the whole process. Otherwise,
46
  /// only tracing for the specified threads is enabled.
47
  llvm::Optional<std::vector<int64_t>> tids;
48
49
  /// \return
50
  ///     \b true if \a tids is \a None, i.e. whole process tracing.
51
  bool IsProcessTracing() const;
52
};
53
54
bool fromJSON(const llvm::json::Value &value, TraceStartRequest &packet,
55
              llvm::json::Path path);
56
57
llvm::json::Value toJSON(const TraceStartRequest &packet);
58
/// \}
59
60
/// jLLDBTraceStop gdb-remote packet
61
/// \{
62
struct TraceStopRequest {
63
0
  TraceStopRequest() = default;
64
65
  TraceStopRequest(llvm::StringRef type, const std::vector<lldb::tid_t> &tids);
66
67
0
  TraceStopRequest(llvm::StringRef type) : type(type){};
68
69
  bool IsProcessTracing() const;
70
71
  /// Tracing technology name, e.g. intel-pt, arm-coresight.
72
  std::string type;
73
  /// If \a llvm::None, then this stops tracing the whole process. Otherwise,
74
  /// only tracing for the specified threads is stopped.
75
  llvm::Optional<std::vector<int64_t>> tids;
76
};
77
78
bool fromJSON(const llvm::json::Value &value, TraceStopRequest &packet,
79
              llvm::json::Path path);
80
81
llvm::json::Value toJSON(const TraceStopRequest &packet);
82
///}
83
84
/// jLLDBTraceGetState gdb-remote packet
85
/// \{
86
struct TraceGetStateRequest {
87
  /// Tracing technology name, e.g. intel-pt, arm-coresight.
88
  std::string type;
89
};
90
91
bool fromJSON(const llvm::json::Value &value, TraceGetStateRequest &packet,
92
              llvm::json::Path path);
93
94
llvm::json::Value toJSON(const TraceGetStateRequest &packet);
95
96
struct TraceBinaryData {
97
  /// Identifier of data to fetch with jLLDBTraceGetBinaryData.
98
  std::string kind;
99
  /// Size in bytes for this data.
100
  int64_t size;
101
};
102
103
bool fromJSON(const llvm::json::Value &value, TraceBinaryData &packet,
104
              llvm::json::Path path);
105
106
llvm::json::Value toJSON(const TraceBinaryData &packet);
107
108
struct TraceThreadState {
109
  int64_t tid;
110
  /// List of binary data objects for this thread.
111
  std::vector<TraceBinaryData> binaryData;
112
};
113
114
bool fromJSON(const llvm::json::Value &value, TraceThreadState &packet,
115
              llvm::json::Path path);
116
117
llvm::json::Value toJSON(const TraceThreadState &packet);
118
119
struct TraceGetStateResponse {
120
  std::vector<TraceThreadState> tracedThreads;
121
  std::vector<TraceBinaryData> processBinaryData;
122
};
123
124
bool fromJSON(const llvm::json::Value &value, TraceGetStateResponse &packet,
125
              llvm::json::Path path);
126
127
llvm::json::Value toJSON(const TraceGetStateResponse &packet);
128
/// \}
129
130
/// jLLDBTraceGetBinaryData gdb-remote packet
131
/// \{
132
struct TraceGetBinaryDataRequest {
133
  /// Tracing technology name, e.g. intel-pt, arm-coresight.
134
  std::string type;
135
  /// Identifier for the data.
136
  std::string kind;
137
  /// Optional tid if the data is related to a thread.
138
  llvm::Optional<int64_t> tid;
139
  /// Offset in bytes from where to start reading the data.
140
  int64_t offset;
141
  /// Number of bytes to read.
142
  int64_t size;
143
};
144
145
bool fromJSON(const llvm::json::Value &value,
146
              lldb_private::TraceGetBinaryDataRequest &packet,
147
              llvm::json::Path path);
148
149
llvm::json::Value toJSON(const lldb_private::TraceGetBinaryDataRequest &packet);
150
/// \}
151
152
} // namespace lldb_private
153
154
#endif // LLDB_UTILITY_TRACEGDBREMOTEPACKETS_H