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 #include "lldb/Core/UserSettingsController.h"
16 #include "lldb/Target/ExecutionContextScope.h"
17 #include "lldb/Target/StackFrameList.h"
18 #include "lldb/Target/Thread.h"
19 #include "lldb/Utility/Broadcaster.h"
20 #include "lldb/Utility/Event.h"
21 #include "lldb/Utility/UserID.h"
22 #include "lldb/lldb-private.h"
24 namespace lldb_private {
26 //----------------------------------------------------------------------
27 /// @class HistoryThread HistoryThread.h "HistoryThread.h"
28 /// A thread object representing a backtrace from a previous point in the
31 /// This subclass of Thread is used to provide a backtrace from earlier in
32 /// process execution. It is given a backtrace list of pc addresses and
33 /// optionally a stop_id of when those pc addresses were collected, and it
34 /// will create stack frames for them.
35 //----------------------------------------------------------------------
37 class HistoryThread : public lldb_private::Thread {
39 HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
40 std::vector<lldb::addr_t> pcs, uint32_t stop_id,
41 bool stop_id_is_valid);
43 ~HistoryThread() override;
45 lldb::RegisterContextSP GetRegisterContext() override;
47 lldb::RegisterContextSP
48 CreateRegisterContextForFrame(StackFrame *frame) override;
50 void RefreshStateAfterStop() override {}
52 bool CalculateStopInfo() override { return false; }
54 void SetExtendedBacktraceToken(uint64_t token) override {
55 m_extended_unwind_token = token;
58 uint64_t GetExtendedBacktraceToken() override {
59 return m_extended_unwind_token;
62 const char *GetQueueName() override { return m_queue_name.c_str(); }
64 void SetQueueName(const char *name) override { m_queue_name = name; }
66 lldb::queue_id_t GetQueueID() override { return m_queue_id; }
68 void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
70 const char *GetThreadName() { return m_thread_name.c_str(); }
72 uint32_t GetExtendedBacktraceOriginatingIndexID() override;
74 void SetThreadName(const char *name) { m_thread_name = name; }
76 const char *GetName() override { return m_thread_name.c_str(); }
78 void SetName(const char *name) override { m_thread_name = name; }
81 virtual lldb::StackFrameListSP GetStackFrameList();
83 mutable std::mutex m_framelist_mutex;
84 lldb::StackFrameListSP m_framelist;
85 std::vector<lldb::addr_t> m_pcs;
87 bool m_stop_id_is_valid;
89 uint64_t m_extended_unwind_token;
90 std::string m_queue_name;
91 std::string m_thread_name;
92 lldb::tid_t m_originating_unique_thread_id;
93 lldb::queue_id_t m_queue_id;
96 } // namespace lldb_private
98 #endif // liblldb_HistoryThread_h_