14using namespace process_linux;
24 return createStringError(inconvertibleErrorCode(),
25 "Thread %" PRIu64
" not currently traced", tid);
28 return Error::success();
34 return createStringError(inconvertibleErrorCode(),
35 "Thread %" PRIu64
" already traced", tid);
37 Expected<IntelPTSingleBufferTrace> trace =
40 return trace.takeError();
44 return Error::success();
55 callback(it.first, it.second);
58Expected<IntelPTSingleBufferTrace &>
62 return createStringError(inconvertibleErrorCode(),
63 "Thread %" PRIu64
" not currently traced", tid);
76llvm::Expected<std::optional<std::vector<uint8_t>>>
87 if (Expected<IntelPTSingleBufferTrace &> trace =
89 return trace->GetIptTrace();
91 return trace.takeError();
This class wraps a single perf event collecting intel pt data in a single buffer.
static llvm::Expected< IntelPTSingleBufferTrace > Start(const TraceIntelPTStartRequest &request, std::optional< lldb::tid_t > tid, std::optional< lldb::cpu_id_t > cpu_id=std::nullopt, bool disabled=false, std::optional< int > cgroup_fd=std::nullopt)
Start tracing using a single Intel PT trace buffer.
size_t GetTotalBufferSize() const
llvm::DenseMap< lldb::tid_t, IntelPTSingleBufferTrace > m_thread_traces
llvm::Error TraceStop(lldb::tid_t tid)
Stop tracing the thread given by its tid.
size_t GetTracedThreadsCount() const
llvm::Error TraceStart(lldb::tid_t tid, const TraceIntelPTStartRequest &request)
Start tracing the thread given by its tid.
size_t m_total_buffer_size
Total actual thread buffer size in bytes.
void Clear()
Dispose of all traces.
llvm::Expected< IntelPTSingleBufferTrace & > GetTracedThread(lldb::tid_t tid)
bool TracesThread(lldb::tid_t tid) const
llvm::Expected< std::optional< std::vector< uint8_t > > > TryGetBinaryData(const TraceGetBinaryDataRequest &request)
void ForEachThread(std::function< void(lldb::tid_t tid, IntelPTSingleBufferTrace &thread_trace)> callback)
Execute the provided callback on each thread that is being traced.
A class that represents a running process on the host machine.
static const char * kIptTrace
jLLDBTraceGetBinaryData gdb-remote packet
std::optional< lldb::tid_t > tid
Optional tid if the data is related to a thread.
std::string kind
Identifier for the data.
jLLDBTraceStart gdb-remote packet