1 //===-- ThreadPostMortemTrace.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_TARGET_THREADPOSTMORTEMTRACE_H
10 #define LLDB_TARGET_THREADPOSTMORTEMTRACE_H
11 
12 #include "lldb/Target/Thread.h"
13 
14 namespace lldb_private {
15 
16 /// \class ThreadPostMortemTrace ThreadPostMortemTrace.h
17 ///
18 /// Thread implementation used for representing threads gotten from trace
19 /// session files, which are similar to threads from core files.
20 ///
21 class ThreadPostMortemTrace : public Thread {
22 public:
23   /// \param[in] process
24   ///     The process who owns this thread.
25   ///
26   /// \param[in] tid
27   ///     The tid of this thread.
28   ///
29   /// \param[in] trace_file
30   ///     The file that contains the list of instructions that were traced when
31   ///     this thread was being executed.
32   ThreadPostMortemTrace(Process &process, lldb::tid_t tid,
33                         const llvm::Optional<FileSpec> &trace_file)
34       : Thread(process, tid), m_trace_file(trace_file) {}
35 
36   void RefreshStateAfterStop() override;
37 
38   lldb::RegisterContextSP GetRegisterContext() override;
39 
40   lldb::RegisterContextSP
41   CreateRegisterContextForFrame(StackFrame *frame) override;
42 
43   /// \return
44   ///   The trace file of this thread.
45   const llvm::Optional<FileSpec> &GetTraceFile() const;
46 
47 protected:
48   bool CalculateStopInfo() override;
49 
50   lldb::RegisterContextSP m_thread_reg_ctx_sp;
51 
52 private:
53   llvm::Optional<FileSpec> m_trace_file;
54 };
55 
56 } // namespace lldb_private
57 
58 #endif // LLDB_TARGET_THREADPOSTMORTEMTRACE_H
59