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 /// See \a TraceSessionFileParser for more information regarding trace session
22 /// files.
23 class ThreadPostMortemTrace : public Thread {
24 public:
25   /// \param[in] process
26   ///     The process who owns this thread.
27   ///
28   /// \param[in] tid
29   ///     The tid of this thread.
30   ///
31   /// \param[in] trace_file
32   ///     The file that contains the list of instructions that were traced when
33   ///     this thread was being executed.
34   ThreadPostMortemTrace(Process &process, lldb::tid_t tid,
35                         const FileSpec &trace_file)
36       : Thread(process, tid), m_trace_file(trace_file) {}
37 
38   void RefreshStateAfterStop() override;
39 
40   lldb::RegisterContextSP GetRegisterContext() override;
41 
42   lldb::RegisterContextSP
43   CreateRegisterContextForFrame(StackFrame *frame) override;
44 
45   /// \return
46   ///   The trace file of this thread.
47   const FileSpec &GetTraceFile() const;
48 
49 protected:
50   bool CalculateStopInfo() override;
51 
52   lldb::RegisterContextSP m_thread_reg_ctx_sp;
53 
54 private:
55   FileSpec m_trace_file;
56 };
57 
58 } // namespace lldb_private
59 
60 #endif // LLDB_TARGET_THREADPOSTMORTEMTRACE_H
61