Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
39648 views
1
//===-- TraceIntelPTJSONStructs.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_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H
10
#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H
11
12
#include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"
13
#include "lldb/lldb-types.h"
14
#include "llvm/Support/JSON.h"
15
#include <intel-pt.h>
16
#include <optional>
17
#include <vector>
18
19
namespace lldb_private {
20
namespace trace_intel_pt {
21
22
struct JSONModule {
23
std::string system_path;
24
std::optional<std::string> file;
25
JSONUINT64 load_address;
26
std::optional<std::string> uuid;
27
};
28
29
struct JSONThread {
30
uint64_t tid;
31
std::optional<std::string> ipt_trace;
32
};
33
34
struct JSONProcess {
35
uint64_t pid;
36
std::optional<std::string> triple;
37
std::vector<JSONThread> threads;
38
std::vector<JSONModule> modules;
39
};
40
41
struct JSONCpu {
42
lldb::cpu_id_t id;
43
std::string ipt_trace;
44
std::string context_switch_trace;
45
};
46
47
struct JSONKernel {
48
std::optional<JSONUINT64> load_address;
49
std::string file;
50
};
51
52
struct JSONTraceBundleDescription {
53
std::string type;
54
pt_cpu cpu_info;
55
std::optional<std::vector<JSONProcess>> processes;
56
std::optional<std::vector<JSONCpu>> cpus;
57
std::optional<LinuxPerfZeroTscConversion> tsc_perf_zero_conversion;
58
std::optional<JSONKernel> kernel;
59
60
std::optional<std::vector<lldb::cpu_id_t>> GetCpuIds();
61
};
62
63
llvm::json::Value toJSON(const JSONModule &module);
64
65
llvm::json::Value toJSON(const JSONThread &thread);
66
67
llvm::json::Value toJSON(const JSONProcess &process);
68
69
llvm::json::Value toJSON(const JSONCpu &cpu);
70
71
llvm::json::Value toJSON(const pt_cpu &cpu_info);
72
73
llvm::json::Value toJSON(const JSONKernel &kernel);
74
75
llvm::json::Value toJSON(const JSONTraceBundleDescription &bundle_description);
76
77
bool fromJSON(const llvm::json::Value &value, JSONModule &module,
78
llvm::json::Path path);
79
80
bool fromJSON(const llvm::json::Value &value, JSONThread &thread,
81
llvm::json::Path path);
82
83
bool fromJSON(const llvm::json::Value &value, JSONProcess &process,
84
llvm::json::Path path);
85
86
bool fromJSON(const llvm::json::Value &value, JSONCpu &cpu,
87
llvm::json::Path path);
88
89
bool fromJSON(const llvm::json::Value &value, pt_cpu &cpu_info,
90
llvm::json::Path path);
91
92
bool fromJSON(const llvm::json::Value &value, JSONModule &kernel,
93
llvm::json::Path path);
94
95
bool fromJSON(const llvm::json::Value &value,
96
JSONTraceBundleDescription &bundle_description,
97
llvm::json::Path path);
98
} // namespace trace_intel_pt
99
} // namespace lldb_private
100
101
#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTJSONSTRUCTS_H
102
103