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_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Host/Mutex.h"
19 #include "lldb/Core/Broadcaster.h"
20 #include "lldb/Core/Event.h"
21 #include "lldb/Core/UserID.h"
22 #include "lldb/Core/UserSettingsController.h"
23 #include "lldb/Target/ExecutionContextScope.h"
24 #include "lldb/Target/StackFrameList.h"
25 #include "lldb/Target/Thread.h"
27 namespace lldb_private {
29 //----------------------------------------------------------------------
30 /// @class HistoryThread HistoryThread.h "HistoryThread.h"
31 /// @brief A thread object representing a backtrace from a previous point in the process execution
33 /// This subclass of Thread is used to provide a backtrace from earlier in
34 /// process execution. It is given a backtrace list of pc addresses and
35 /// optionally a stop_id of when those pc addresses were collected, and it will
36 /// create stack frames for them.
37 //----------------------------------------------------------------------
39 class HistoryThread : public lldb_private::Thread
42 HistoryThread (lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs, uint32_t stop_id, bool stop_id_is_valid);
44 ~HistoryThread() override;
46 lldb::RegisterContextSP
47 GetRegisterContext() override;
49 lldb::RegisterContextSP
50 CreateRegisterContextForFrame(StackFrame *frame) override;
53 RefreshStateAfterStop() override { }
56 CalculateStopInfo() override
62 SetExtendedBacktraceToken(uint64_t token) override
64 m_extended_unwind_token = token;
68 GetExtendedBacktraceToken() override
70 return m_extended_unwind_token;
74 GetQueueName() override
76 return m_queue_name.c_str();
80 SetQueueName(const char *name) override
92 SetQueueID(lldb::queue_id_t queue) override
100 return m_thread_name.c_str();
104 GetExtendedBacktraceOriginatingIndexID() override;
107 SetThreadName (const char *name)
109 m_thread_name = name;
115 return m_thread_name.c_str();
119 SetName(const char *name) override
121 m_thread_name = name;
125 virtual lldb::StackFrameListSP
126 GetStackFrameList ();
128 mutable Mutex m_framelist_mutex;
129 lldb::StackFrameListSP m_framelist;
130 std::vector<lldb::addr_t> m_pcs;
132 bool m_stop_id_is_valid;
134 uint64_t m_extended_unwind_token;
135 std::string m_queue_name;
136 std::string m_thread_name;
137 lldb::tid_t m_originating_unique_thread_id;
138 lldb::queue_id_t m_queue_id;
141 } // namespace lldb_private
143 #endif // liblldb_HistoryThread_h_