xref: /freebsd-src/contrib/llvm-project/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h (revision 681ce946f33e75c590e97c53076e86dff1fe8f4a)
1 //===-- TraceCursorIntelPT.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 LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H
11 
12 #include "IntelPTDecoder.h"
13 #include "TraceIntelPTSessionFileParser.h"
14 
15 namespace lldb_private {
16 namespace trace_intel_pt {
17 
18 class TraceCursorIntelPT : public TraceCursor {
19 public:
20   TraceCursorIntelPT(lldb::ThreadSP thread_sp,
21                      DecodedThreadSP decoded_thread_sp);
22 
23   size_t Seek(int64_t offset, SeekType origin) override;
24 
25   virtual bool Next() override;
26 
27   llvm::Error GetError() override;
28 
29   lldb::addr_t GetLoadAddress() override;
30 
31   llvm::Optional<uint64_t> GetTimestampCounter() override;
32 
33   lldb::TraceInstructionControlFlowType
34   GetInstructionControlFlowType() override;
35 
36   bool IsError() override;
37 
38 private:
39   size_t GetInternalInstructionSize();
40 
41   /// Storage of the actual instructions
42   DecodedThreadSP m_decoded_thread_sp;
43   /// Internal instruction index currently pointing at.
44   size_t m_pos;
45 };
46 
47 } // namespace trace_intel_pt
48 } // namespace lldb_private
49 
50 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H
51