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
15
16#include <cstdint>
17#include <memory>
18#include <optional>
19#include <vector>
20
21namespace lldb_private {
22namespace process_linux {
23
24/// Manages a "process trace" instance by tracing each thread individually.
26public:
27 /// Start tracing the current process by tracing each of its tids
28 /// individually.
29 ///
30 /// \param[in] request
31 /// Intel PT configuration parameters.
32 ///
33 /// \param[in] current_tids
34 /// List of tids currently alive. In the future, whenever a new thread is
35 /// spawned, they should be traced by calling the \a TraceStart(tid) method.
36 ///
37 /// \return
38 /// An \a IntelPTMultiCoreTrace instance if tracing was successful, or
39 /// an \a llvm::Error otherwise.
40 static llvm::Expected<std::unique_ptr<IntelPTPerThreadProcessTrace>>
41 Start(const TraceIntelPTStartRequest &request,
42 llvm::ArrayRef<lldb::tid_t> current_tids);
43
44 bool TracesThread(lldb::tid_t tid) const override;
45
46 llvm::Error TraceStart(lldb::tid_t tid) override;
47
48 llvm::Error TraceStop(lldb::tid_t tid) override;
49
51
52 llvm::Expected<std::optional<std::vector<uint8_t>>>
53 TryGetBinaryData(const TraceGetBinaryDataRequest &request) override;
54
55private:
58
60 /// Params used to trace threads when the user started "process tracing".
62};
63
64} // namespace process_linux
65} // namespace lldb_private
66
67#endif // liblldb_IntelPTPerThreadProcessTrace_H_
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:85
jLLDBTraceGetBinaryData gdb-remote packet