LLDB  mainline
ThreadDecoder.h
Go to the documentation of this file.
1 //===-- ThreadDecoder.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_THREAD_DECODER_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_THREAD_DECODER_H
11 
12 #include "intel-pt.h"
13 
14 #include "DecodedThread.h"
15 #include "forward-declarations.h"
16 #include "lldb/Target/Process.h"
17 #include "lldb/Utility/FileSpec.h"
18 
19 namespace lldb_private {
20 namespace trace_intel_pt {
21 
22 /// Class that handles the decoding of a thread and caches the result.
24 public:
25  /// \param[in] thread_sp
26  /// The thread whose intel pt trace buffer will be decoded.
27  ///
28  /// \param[in] trace
29  /// The main Trace object who owns this decoder and its data.
30  ThreadDecoder(const lldb::ThreadSP &thread_sp, TraceIntelPT &trace);
31 
32  /// Decode the thread and store the result internally, to avoid
33  /// recomputations.
34  ///
35  /// \return
36  /// A \a DecodedThread instance.
37  llvm::Expected<DecodedThreadSP> Decode();
38 
39  ThreadDecoder(const ThreadDecoder &other) = delete;
40  ThreadDecoder &operator=(const ThreadDecoder &other) = delete;
41 
42 private:
43  llvm::Expected<DecodedThreadSP> DoDecode();
44 
45  lldb::ThreadSP m_thread_sp;
47  llvm::Optional<DecodedThreadSP> m_decoded_thread;
48 };
49 
50 } // namespace trace_intel_pt
51 } // namespace lldb_private
52 
53 #endif // LLDB_SOURCE_PLUGINS_TRACE_THREAD_DECODER_H
lldb_private::trace_intel_pt::ThreadDecoder::DoDecode
llvm::Expected< DecodedThreadSP > DoDecode()
Definition: ThreadDecoder.cpp:37
lldb_private::trace_intel_pt::ThreadDecoder::m_decoded_thread
llvm::Optional< DecodedThreadSP > m_decoded_thread
Definition: ThreadDecoder.h:47
lldb_private::trace_intel_pt::TraceIntelPT
Definition: TraceIntelPT.h:24
lldb_private::trace_intel_pt::ThreadDecoder::m_thread_sp
lldb::ThreadSP m_thread_sp
Definition: ThreadDecoder.h:45
Process.h
DecodedThread.h
forward-declarations.h
lldb_private::trace_intel_pt::ThreadDecoder::Decode
llvm::Expected< DecodedThreadSP > Decode()
Decode the thread and store the result internally, to avoid recomputations.
Definition: ThreadDecoder.cpp:26
lldb_private::trace_intel_pt::ThreadDecoder::ThreadDecoder
ThreadDecoder(const lldb::ThreadSP &thread_sp, TraceIntelPT &trace)
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::trace_intel_pt::ThreadDecoder
Class that handles the decoding of a thread and caches the result.
Definition: ThreadDecoder.h:23
FileSpec.h
lldb_private::trace_intel_pt::ThreadDecoder::operator=
ThreadDecoder & operator=(const ThreadDecoder &other)=delete
lldb_private::trace_intel_pt::ThreadDecoder::m_trace
TraceIntelPT & m_trace
Definition: ThreadDecoder.h:46