LLDB  mainline
TraceGDBRemotePackets.h
Go to the documentation of this file.
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 /// \{
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.
29  /// The description for the technology.
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 /// \{
42  /// Tracing technology name, e.g. intel-pt, arm-coresight.
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 /// \{
63  TraceStopRequest() = default;
64 
65  TraceStopRequest(llvm::StringRef type, const std::vector<lldb::tid_t> &tids);
66 
67  TraceStopRequest(llvm::StringRef type) : type(type){};
68 
69  bool IsProcessTracing() const;
70 
71  /// Tracing technology name, e.g. intel-pt, arm-coresight.
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 /// \{
87  /// Tracing technology name, e.g. intel-pt, arm-coresight.
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 
97  /// Identifier of data to fetch with jLLDBTraceGetBinaryData.
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 
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 
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 /// \{
133  /// Tracing technology name, e.g. intel-pt, arm-coresight.
135  /// Identifier for the data.
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,
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
lldb_private::toJSON
llvm::json::Value toJSON(const TraceSupportedResponse &packet)
Definition: TraceGDBRemotePackets.cpp:24
lldb_private::TraceStopRequest::IsProcessTracing
bool IsProcessTracing() const
Definition: TraceGDBRemotePackets.cpp:54
lldb_private::TraceGetBinaryDataRequest::kind
std::string kind
Identifier for the data.
Definition: TraceGDBRemotePackets.h:136
lldb_private::TraceGetBinaryDataRequest::size
int64_t size
Number of bytes to read.
Definition: TraceGDBRemotePackets.h:142
lldb_private::TraceGetBinaryDataRequest
jLLDBTraceGetBinaryData gdb-remote packet
Definition: TraceGDBRemotePackets.h:132
lldb_private::TraceGetStateResponse
Definition: TraceGDBRemotePackets.h:119
lldb_private::TraceStartRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:43
lldb_private::TraceSupportedResponse::description
std::string description
The description for the technology.
Definition: TraceGDBRemotePackets.h:30
lldb_private::TraceSupportedResponse
jLLDBTraceSupported gdb-remote packet
Definition: TraceGDBRemotePackets.h:22
lldb-defines.h
lldb_private::TraceThreadState::tid
int64_t tid
Definition: TraceGDBRemotePackets.h:109
lldb_private::TraceSupportedResponse::name
std::string name
The name of the technology, e.g.
Definition: TraceGDBRemotePackets.h:28
lldb_private::TraceGetStateResponse::processBinaryData
std::vector< TraceBinaryData > processBinaryData
Definition: TraceGDBRemotePackets.h:121
lldb_private::TraceGetStateRequest
}
Definition: TraceGDBRemotePackets.h:86
lldb_private::TraceGetBinaryDataRequest::tid
llvm::Optional< int64_t > tid
Optional tid if the data is related to a thread.
Definition: TraceGDBRemotePackets.h:138
lldb_private::TraceStartRequest::IsProcessTracing
bool IsProcessTracing() const
jLLDBTraceStart
Definition: TraceGDBRemotePackets.cpp:32
lldb_private::TraceBinaryData::size
int64_t size
Size in bytes for this data.
Definition: TraceGDBRemotePackets.h:100
lldb_private::TraceBinaryData::kind
std::string kind
Identifier of data to fetch with jLLDBTraceGetBinaryData.
Definition: TraceGDBRemotePackets.h:98
lldb_private::TraceGetStateResponse::tracedThreads
std::vector< TraceThreadState > tracedThreads
Definition: TraceGDBRemotePackets.h:120
lldb-enumerations.h
lldb_private::TraceGetBinaryDataRequest::offset
int64_t offset
Offset in bytes from where to start reading the data.
Definition: TraceGDBRemotePackets.h:140
lldb_private::TraceStopRequest::TraceStopRequest
TraceStopRequest()=default
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
lldb_private::TraceStopRequest::TraceStopRequest
TraceStopRequest(llvm::StringRef type)
Definition: TraceGDBRemotePackets.h:67
lldb_private::fromJSON
bool fromJSON(const llvm::json::Value &value, TraceSupportedResponse &info, llvm::json::Path path)
lldb_private::TraceStopRequest
jLLDBTraceStop gdb-remote packet
Definition: TraceGDBRemotePackets.h:62
lldb_private::TraceStartRequest
jLLDBTraceStart gdb-remote packet
Definition: TraceGDBRemotePackets.h:41
lldb_private::TraceThreadState::binaryData
std::vector< TraceBinaryData > binaryData
List of binary data objects for this thread.
Definition: TraceGDBRemotePackets.h:111
lldb_private::TraceGetStateRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:88
lldb_private::TraceStopRequest::tids
llvm::Optional< std::vector< int64_t > > tids
If llvm::None, then this stops tracing the whole process.
Definition: TraceGDBRemotePackets.h:75
lldb_private::TraceGetBinaryDataRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:134
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TraceBinaryData
Definition: TraceGDBRemotePackets.h:96
lldb_private::TraceStartRequest::tids
llvm::Optional< std::vector< int64_t > > tids
If llvm::None, then this starts tracing the whole process.
Definition: TraceGDBRemotePackets.h:47
lldb_private::TraceStopRequest::type
std::string type
Tracing technology name, e.g. intel-pt, arm-coresight.
Definition: TraceGDBRemotePackets.h:72
lldb_private::TraceThreadState
Definition: TraceGDBRemotePackets.h:108