1 //===-- IntelPTPerThreadProcessTrace.h ------------------------ -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_IntelPTPerThreadProcessTrace_H_
10 #define liblldb_IntelPTPerThreadProcessTrace_H_
12 #include "IntelPTProcessTrace.h"
13 #include "IntelPTSingleBufferTrace.h"
14 #include "IntelPTThreadTraceCollection.h"
17 namespace lldb_private
{
18 namespace process_linux
{
20 /// Manages a "process trace" instance by tracing each thread individually.
21 class IntelPTPerThreadProcessTrace
: public IntelPTProcessTrace
{
23 /// Start tracing the current process by tracing each of its tids
26 /// \param[in] request
27 /// Intel PT configuration parameters.
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.
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
);
40 bool TracesThread(lldb::tid_t tid
) const override
;
42 llvm::Error
TraceStart(lldb::tid_t tid
) override
;
44 llvm::Error
TraceStop(lldb::tid_t tid
) override
;
46 TraceIntelPTGetStateResponse
GetState() override
;
48 llvm::Expected
<std::optional
<std::vector
<uint8_t>>>
49 TryGetBinaryData(const TraceGetBinaryDataRequest
&request
) override
;
52 IntelPTPerThreadProcessTrace(const TraceIntelPTStartRequest
&request
)
53 : m_tracing_params(request
) {}
55 IntelPTThreadTraceCollection m_thread_traces
;
56 /// Params used to trace threads when the user started "process tracing".
57 TraceIntelPTStartRequest m_tracing_params
;
60 } // namespace process_linux
61 } // namespace lldb_private
63 #endif // liblldb_IntelPTPerThreadProcessTrace_H_