LLDB mainline
IntelPTPerThreadProcessTrace.h
Go to the documentation of this file.
1//===-- IntelPTPerThreadProcessTrace.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 liblldb_IntelPTPerThreadProcessTrace_H_
10#define liblldb_IntelPTPerThreadProcessTrace_H_
11
12#include "IntelPTProcessTrace.h"
15#include <optional>
16
17namespace lldb_private {
18namespace process_linux {
19
20/// Manages a "process trace" instance by tracing each thread individually.
22public:
23 /// Start tracing the current process by tracing each of its tids
24 /// individually.
25 ///
26 /// \param[in] request
27 /// Intel PT configuration parameters.
28 ///
29 /// \param[in] current_tids
30 /// List of tids currently alive. In the future, whenever a new thread is
31 /// spawned, they should be traced by calling the \a TraceStart(tid) method.
32 ///
33 /// \return
34 /// An \a IntelPTMultiCoreTrace instance if tracing was successful, or
35 /// an \a llvm::Error otherwise.
36 static llvm::Expected<std::unique_ptr<IntelPTPerThreadProcessTrace>>
37 Start(const TraceIntelPTStartRequest &request,
38 llvm::ArrayRef<lldb::tid_t> current_tids);
39
40 bool TracesThread(lldb::tid_t tid) const override;
41
42 llvm::Error TraceStart(lldb::tid_t tid) override;
43
44 llvm::Error TraceStop(lldb::tid_t tid) override;
45
47
48 llvm::Expected<std::optional<std::vector<uint8_t>>>
49 TryGetBinaryData(const TraceGetBinaryDataRequest &request) override;
50
51private:
53 : m_tracing_params(request) {}
54
56 /// Params used to trace threads when the user started "process tracing".
58};
59
60} // namespace process_linux
61} // namespace lldb_private
62
63#endif // liblldb_IntelPTPerThreadProcessTrace_H_
Manages a "process trace" instance by tracing each thread individually.
llvm::Error TraceStart(lldb::tid_t tid) override
Start tracing the thread given by its tid.
TraceIntelPTGetStateResponse GetState() override
Construct a minimal jLLDBTraceGetState response for this process trace.
TraceIntelPTStartRequest m_tracing_params
Params used to trace threads when the user started "process tracing".
llvm::Expected< std::optional< std::vector< uint8_t > > > TryGetBinaryData(const TraceGetBinaryDataRequest &request) override
llvm::Error TraceStop(lldb::tid_t tid) override
Stop tracing the thread given by its tid.
static llvm::Expected< std::unique_ptr< IntelPTPerThreadProcessTrace > > Start(const TraceIntelPTStartRequest &request, llvm::ArrayRef< lldb::tid_t > current_tids)
Start tracing the current process by tracing each of its tids individually.
IntelPTPerThreadProcessTrace(const TraceIntelPTStartRequest &request)
Interface to be implemented by each 'process trace' strategy (per cpu, per thread,...
A class that represents a running process on the host machine.
uint64_t tid_t
Definition: lldb-types.h:84
jLLDBTraceGetBinaryData gdb-remote packet