llvm/lldb/source/Target/Trace.cpp

//===-- Trace.cpp ---------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Target/Trace.h"

#include "llvm/Support/Format.h"

#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Stream.h"
#include <optional>

usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacellvm;

// Helper structs used to extract the type of a JSON trace bundle description
// object without having to parse the entire object.

struct JSONSimpleTraceBundleDescription {};

namespace llvm {
namespace json {

bool fromJSON(const Value &value, JSONSimpleTraceBundleDescription &bundle,
              Path path) {}

} // namespace json
} // namespace llvm

/// Helper functions for fetching data in maps and returning Optionals or
/// pointers instead of iterators for simplicity. It's worth mentioning that the
/// Optionals version can't return the inner data by reference because of
/// limitations in move constructors.
/// \{
template <typename K, typename V>
static std::optional<V> Lookup(DenseMap<K, V> &map, K k) {}

template <typename K, typename V>
static V *LookupAsPtr(DenseMap<K, V> &map, K k) {}

/// Similar to the methods above but it looks for an item in a map of maps.
template <typename K1, typename K2, typename V>
static std::optional<V> Lookup(DenseMap<K1, DenseMap<K2, V>> &map, K1 k1,
                               K2 k2) {}

/// Similar to the methods above but it looks for an item in a map of maps.
template <typename K1, typename K2, typename V>
static V *LookupAsPtr(DenseMap<K1, DenseMap<K2, V>> &map, K1 k1, K2 k2) {}
/// \}

static Error createInvalidPlugInError(StringRef plugin_name) {}

Expected<lldb::TraceSP>
Trace::LoadPostMortemTraceFromFile(Debugger &debugger,
                                   const FileSpec &trace_description_file) {}

Expected<lldb::TraceSP> Trace::FindPluginForPostMortemProcess(
    Debugger &debugger, const json::Value &trace_bundle_description,
    StringRef bundle_dir) {}

Expected<lldb::TraceSP> Trace::FindPluginForLiveProcess(llvm::StringRef name,
                                                        Process &process) {}

Expected<StringRef> Trace::FindPluginSchema(StringRef name) {}

Error Trace::Start(const llvm::json::Value &request) {}

Error Trace::Stop() {}

Error Trace::Stop(llvm::ArrayRef<lldb::tid_t> tids) {}

Expected<std::string> Trace::GetLiveProcessState() {}

std::optional<uint64_t>
Trace::GetLiveThreadBinaryDataSize(lldb::tid_t tid, llvm::StringRef kind) {}

std::optional<uint64_t> Trace::GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
                                                        llvm::StringRef kind) {}

std::optional<uint64_t>
Trace::GetLiveProcessBinaryDataSize(llvm::StringRef kind) {}

Expected<std::vector<uint8_t>>
Trace::GetLiveTraceBinaryData(const TraceGetBinaryDataRequest &request,
                              uint64_t expected_size) {}

Expected<std::vector<uint8_t>>
Trace::GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind) {}

Expected<std::vector<uint8_t>>
Trace::GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind) {}

Expected<std::vector<uint8_t>>
Trace::GetLiveProcessBinaryData(llvm::StringRef kind) {}

Trace::Storage &Trace::GetUpdatedStorage() {}

const char *Trace::RefreshLiveProcessState() {}

Trace::Trace(ArrayRef<ProcessSP> postmortem_processes,
             std::optional<std::vector<lldb::cpu_id_t>> postmortem_cpus) {}

Process *Trace::GetLiveProcess() {}

ArrayRef<Process *> Trace::GetPostMortemProcesses() {}

std::vector<Process *> Trace::GetAllProcesses() {}

uint32_t Trace::GetStopID() {}

llvm::Expected<FileSpec>
Trace::GetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind) {}

llvm::Expected<FileSpec> Trace::GetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
                                                         llvm::StringRef kind) {}

void Trace::SetPostMortemThreadDataFile(lldb::tid_t tid, llvm::StringRef kind,
                                        FileSpec file_spec) {}

void Trace::SetPostMortemCpuDataFile(lldb::cpu_id_t cpu_id,
                                     llvm::StringRef kind, FileSpec file_spec) {}

llvm::Error
Trace::OnLiveThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
                                  OnBinaryDataReadCallback callback) {}

llvm::Error Trace::OnLiveCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
                                           llvm::StringRef kind,
                                           OnBinaryDataReadCallback callback) {}

llvm::Error Trace::OnDataFileRead(FileSpec file,
                                  OnBinaryDataReadCallback callback) {}

llvm::Error
Trace::OnPostMortemThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
                                        OnBinaryDataReadCallback callback) {}

llvm::Error
Trace::OnPostMortemCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
                                     llvm::StringRef kind,
                                     OnBinaryDataReadCallback callback) {}

llvm::Error Trace::OnThreadBinaryDataRead(lldb::tid_t tid, llvm::StringRef kind,
                                          OnBinaryDataReadCallback callback) {}

llvm::Error
Trace::OnAllCpusBinaryDataRead(llvm::StringRef kind,
                               OnCpusBinaryDataReadCallback callback) {}

llvm::Error Trace::OnCpuBinaryDataRead(lldb::cpu_id_t cpu_id,
                                       llvm::StringRef kind,
                                       OnBinaryDataReadCallback callback) {}

ArrayRef<lldb::cpu_id_t> Trace::GetTracedCpus() {}

std::vector<Process *> Trace::GetTracedProcesses() {}