• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- ThreadTrace.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_THREADTRACE_H
10 #define LLDB_TARGET_THREADTRACE_H
11 
12 #include "lldb/Target/Thread.h"
13 
14 namespace lldb_private {
15 
16 /// \class ThreadTrace ThreadTrace.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 ThreadTrace : 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.
ThreadTrace(Process & process,lldb::tid_t tid,const FileSpec & trace_file)34   ThreadTrace(Process &process, lldb::tid_t tid, const FileSpec &trace_file)
35       : Thread(process, tid), m_trace_file(trace_file) {}
36 
37   void RefreshStateAfterStop() override;
38 
39   lldb::RegisterContextSP GetRegisterContext() override;
40 
41   lldb::RegisterContextSP
42   CreateRegisterContextForFrame(StackFrame *frame) override;
43 
44   /// \return
45   ///   The trace file of this thread.
46   const FileSpec &GetTraceFile() const;
47 
48 protected:
49   bool CalculateStopInfo() override;
50 
51   lldb::RegisterContextSP m_thread_reg_ctx_sp;
52 
53 private:
54   FileSpec m_trace_file;
55 };
56 
57 typedef std::shared_ptr<ThreadTrace> ThreadTraceSP;
58 
59 } // namespace lldb_private
60 
61 #endif // LLDB_TARGET_THREADTRACE_H
62