1 //===-- HistoryThread.h -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_HistoryThread_h_
11 #define liblldb_HistoryThread_h_
17 // Other libraries and framework includes
19 #include "lldb/Core/Broadcaster.h"
20 #include "lldb/Core/Event.h"
21 #include "lldb/Core/UserSettingsController.h"
22 #include "lldb/Target/ExecutionContextScope.h"
23 #include "lldb/Target/StackFrameList.h"
24 #include "lldb/Target/Thread.h"
25 #include "lldb/Utility/UserID.h"
26 #include "lldb/lldb-private.h"
28 namespace lldb_private {
30 //----------------------------------------------------------------------
31 /// @class HistoryThread HistoryThread.h "HistoryThread.h"
32 /// A thread object representing a backtrace from a previous point in the
35 /// This subclass of Thread is used to provide a backtrace from earlier in
36 /// process execution. It is given a backtrace list of pc addresses and
37 /// optionally a stop_id of when those pc addresses were collected, and it
38 /// will create stack frames for them.
39 //----------------------------------------------------------------------
41 class HistoryThread : public lldb_private::Thread {
43 HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
44 std::vector<lldb::addr_t> pcs, uint32_t stop_id,
45 bool stop_id_is_valid);
47 ~HistoryThread() override;
49 lldb::RegisterContextSP GetRegisterContext() override;
51 lldb::RegisterContextSP
52 CreateRegisterContextForFrame(StackFrame *frame) override;
54 void RefreshStateAfterStop() override {}
56 bool CalculateStopInfo() override { return false; }
58 void SetExtendedBacktraceToken(uint64_t token) override {
59 m_extended_unwind_token = token;
62 uint64_t GetExtendedBacktraceToken() override {
63 return m_extended_unwind_token;
66 const char *GetQueueName() override { return m_queue_name.c_str(); }
68 void SetQueueName(const char *name) override { m_queue_name = name; }
70 lldb::queue_id_t GetQueueID() override { return m_queue_id; }
72 void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
74 const char *GetThreadName() { return m_thread_name.c_str(); }
76 uint32_t GetExtendedBacktraceOriginatingIndexID() override;
78 void SetThreadName(const char *name) { m_thread_name = name; }
80 const char *GetName() override { return m_thread_name.c_str(); }
82 void SetName(const char *name) override { m_thread_name = name; }
85 virtual lldb::StackFrameListSP GetStackFrameList();
87 mutable std::mutex m_framelist_mutex;
88 lldb::StackFrameListSP m_framelist;
89 std::vector<lldb::addr_t> m_pcs;
91 bool m_stop_id_is_valid;
93 uint64_t m_extended_unwind_token;
94 std::string m_queue_name;
95 std::string m_thread_name;
96 lldb::tid_t m_originating_unique_thread_id;
97 lldb::queue_id_t m_queue_id;
100 } // namespace lldb_private
102 #endif // liblldb_HistoryThread_h_