[lld][WebAssembly] Perform data relocations during start function
[llvm-project.git] / lldb / source / Utility / TraceIntelPTGDBRemotePackets.cpp
blobdbb93d8d1c5c6d56c4c636965f4bc63302cd9e2a
1 //===-- TraceIntelPTGDBRemotePackets.cpp ------------------------*- 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 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"
11 using namespace llvm;
12 using namespace llvm::json;
14 namespace lldb_private {
16 bool fromJSON(const json::Value &value, TraceIntelPTStartRequest &packet,
17 Path path) {
18 ObjectMapper o(value, path);
19 if (!o || !fromJSON(value, (TraceStartRequest &)packet, path) ||
20 !o.map("enableTsc", packet.enableTsc) ||
21 !o.map("psbPeriod", packet.psbPeriod) ||
22 !o.map("threadBufferSize", packet.threadBufferSize) ||
23 !o.map("processBufferSizeLimit", packet.processBufferSizeLimit))
24 return false;
25 if (packet.tids && packet.processBufferSizeLimit) {
26 path.report("processBufferSizeLimit must be provided");
27 return false;
29 if (!packet.tids && !packet.processBufferSizeLimit) {
30 path.report("processBufferSizeLimit must not be provided");
31 return false;
33 return true;
36 json::Value toJSON(const TraceIntelPTStartRequest &packet) {
37 json::Value base = toJSON((const TraceStartRequest &)packet);
38 base.getAsObject()->try_emplace("threadBufferSize", packet.threadBufferSize);
39 base.getAsObject()->try_emplace("processBufferSizeLimit",
40 packet.processBufferSizeLimit);
41 base.getAsObject()->try_emplace("psbPeriod", packet.psbPeriod);
42 base.getAsObject()->try_emplace("enableTsc", packet.enableTsc);
43 return base;
46 } // namespace lldb_private