18e6b31c3SAlex Langford //===-- ThreadPostMortemTrace.h ---------------------------------*- C++ -*-===// 28e6b31c3SAlex Langford // 38e6b31c3SAlex Langford // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 48e6b31c3SAlex Langford // See https://llvm.org/LICENSE.txt for license information. 58e6b31c3SAlex Langford // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 68e6b31c3SAlex Langford // 78e6b31c3SAlex Langford //===----------------------------------------------------------------------===// 88e6b31c3SAlex Langford 98e6b31c3SAlex Langford #ifndef LLDB_TARGET_THREADPOSTMORTEMTRACE_H 108e6b31c3SAlex Langford #define LLDB_TARGET_THREADPOSTMORTEMTRACE_H 118e6b31c3SAlex Langford 128e6b31c3SAlex Langford #include "lldb/Target/Thread.h" 13f190ce62SKazu Hirata #include <optional> 148e6b31c3SAlex Langford 158e6b31c3SAlex Langford namespace lldb_private { 168e6b31c3SAlex Langford 178e6b31c3SAlex Langford /// \class ThreadPostMortemTrace ThreadPostMortemTrace.h 188e6b31c3SAlex Langford /// 198e6b31c3SAlex Langford /// Thread implementation used for representing threads gotten from trace 208e6b31c3SAlex Langford /// session files, which are similar to threads from core files. 218e6b31c3SAlex Langford /// 228e6b31c3SAlex Langford class ThreadPostMortemTrace : public Thread { 238e6b31c3SAlex Langford public: 248e6b31c3SAlex Langford /// \param[in] process 258e6b31c3SAlex Langford /// The process who owns this thread. 268e6b31c3SAlex Langford /// 278e6b31c3SAlex Langford /// \param[in] tid 288e6b31c3SAlex Langford /// The tid of this thread. 298e6b31c3SAlex Langford /// 308e6b31c3SAlex Langford /// \param[in] trace_file 318e6b31c3SAlex Langford /// The file that contains the list of instructions that were traced when 328e6b31c3SAlex Langford /// this thread was being executed. ThreadPostMortemTrace(Process & process,lldb::tid_t tid,const std::optional<FileSpec> & trace_file)338e6b31c3SAlex Langford ThreadPostMortemTrace(Process &process, lldb::tid_t tid, 34*2fe83274SKazu Hirata const std::optional<FileSpec> &trace_file) 358e6b31c3SAlex Langford : Thread(process, tid), m_trace_file(trace_file) {} 368e6b31c3SAlex Langford 378e6b31c3SAlex Langford void RefreshStateAfterStop() override; 388e6b31c3SAlex Langford 398e6b31c3SAlex Langford lldb::RegisterContextSP GetRegisterContext() override; 408e6b31c3SAlex Langford 418e6b31c3SAlex Langford lldb::RegisterContextSP 428e6b31c3SAlex Langford CreateRegisterContextForFrame(StackFrame *frame) override; 438e6b31c3SAlex Langford 448e6b31c3SAlex Langford /// \return 458e6b31c3SAlex Langford /// The trace file of this thread. 46*2fe83274SKazu Hirata const std::optional<FileSpec> &GetTraceFile() const; 478e6b31c3SAlex Langford 488e6b31c3SAlex Langford protected: 498e6b31c3SAlex Langford bool CalculateStopInfo() override; 508e6b31c3SAlex Langford 518e6b31c3SAlex Langford lldb::RegisterContextSP m_thread_reg_ctx_sp; 528e6b31c3SAlex Langford 538e6b31c3SAlex Langford private: 54*2fe83274SKazu Hirata std::optional<FileSpec> m_trace_file; 558e6b31c3SAlex Langford }; 568e6b31c3SAlex Langford 578e6b31c3SAlex Langford } // namespace lldb_private 588e6b31c3SAlex Langford 598e6b31c3SAlex Langford #endif // LLDB_TARGET_THREADPOSTMORTEMTRACE_H 60