1//===-- IntelPTProcessTrace.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_IntelPTProcessTrace_H_
10#define liblldb_IntelPTProcessTrace_H_
11
12#include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"
13#include <memory>
14#include <optional>
15
16namespace lldb_private {
17namespace process_linux {
18
19/// Interface to be implemented by each 'process trace' strategy (per cpu, per
20/// thread, etc).
21class IntelPTProcessTrace {
22public:
23 virtual ~IntelPTProcessTrace() = default;
24
25 virtual void ProcessDidStop() {}
26
27 virtual void ProcessWillResume() {}
28
29 /// Construct a minimal jLLDBTraceGetState response for this process trace.
30 virtual TraceIntelPTGetStateResponse GetState() = 0;
31
32 virtual bool TracesThread(lldb::tid_t tid) const = 0;
33
34 /// \copydoc IntelPTThreadTraceCollection::TraceStart()
35 virtual llvm::Error TraceStart(lldb::tid_t tid) = 0;
36
37 /// \copydoc IntelPTThreadTraceCollection::TraceStop()
38 virtual llvm::Error TraceStop(lldb::tid_t tid) = 0;
39
40 /// \return
41 /// \b std::nullopt if this instance doesn't support the requested data, an
42 /// \a llvm::Error if this isntance supports it but fails at fetching it,
43 /// and \b Error::success() otherwise.
44 virtual llvm::Expected<std::optional<std::vector<uint8_t>>>
45 TryGetBinaryData(const TraceGetBinaryDataRequest &request) = 0;
46};
47
48using IntelPTProcessTraceUP = std::unique_ptr<IntelPTProcessTrace>;
49
50} // namespace process_linux
51} // namespace lldb_private
52
53#endif // liblldb_IntelPTProcessTrace_H_
54

source code of lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h