1 //===-- HistoryThread.h -----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_HistoryThread_h_
11 #define liblldb_HistoryThread_h_
12 
13 #include "lldb/lldb-private.h"
14 #include "lldb/Host/Mutex.h"
15 #include "lldb/Core/Broadcaster.h"
16 #include "lldb/Core/Event.h"
17 #include "lldb/Core/UserID.h"
18 #include "lldb/Core/UserSettingsController.h"
19 #include "lldb/Target/ExecutionContextScope.h"
20 #include "lldb/Target/StackFrameList.h"
21 #include "lldb/Target/Thread.h"
22 
23 namespace lldb_private {
24 
25 class HistoryThread : public lldb_private::Thread
26 {
27 public:
28     HistoryThread (lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs, uint32_t stop_id, bool stop_id_is_valid);
29 
30     virtual ~HistoryThread ();
31 
32     virtual lldb::RegisterContextSP
33     GetRegisterContext ();
34 
35     virtual lldb::RegisterContextSP
36     CreateRegisterContextForFrame (StackFrame *frame);
37 
38     virtual void
39     RefreshStateAfterStop() { }
40 
41     bool
42     CalculateStopInfo () { return false; }
43 
44     void
45     SetExtendedBacktraceToken (uint64_t token)
46     {
47         m_extended_unwind_token = token;
48     }
49 
50     uint64_t
51     GetExtendedBacktraceToken ()
52     {
53         return m_extended_unwind_token;
54     }
55 
56     const char *
57     GetQueueName ()
58     {
59         return m_queue_name.c_str();
60     }
61 
62     void
63     SetQueueName (const char *name)
64     {
65         m_queue_name = name;
66     }
67 
68     lldb::queue_id_t
69     GetQueueID ()
70     {
71         return m_queue_id;
72     }
73 
74     void
75     SetQueueID (lldb::queue_id_t queue)
76     {
77         m_queue_id = queue;
78     }
79 
80     const char *
81     GetThreadName ()
82     {
83         return m_thread_name.c_str();
84     }
85 
86     uint32_t
87     GetExtendedBacktraceOriginatingIndexID ();
88 
89     void
90     SetThreadName (const char *name)
91     {
92         m_thread_name = name;
93     }
94 
95 protected:
96     virtual lldb::StackFrameListSP
97     GetStackFrameList ();
98 
99     mutable Mutex               m_framelist_mutex;
100     lldb::StackFrameListSP      m_framelist;
101     std::vector<lldb::addr_t>   m_pcs;
102     uint32_t                    m_stop_id;
103     bool                        m_stop_id_is_valid;
104 
105     uint64_t                    m_extended_unwind_token;
106     std::string                 m_queue_name;
107     std::string                 m_thread_name;
108     lldb::tid_t                 m_originating_unique_thread_id;
109     lldb::queue_id_t            m_queue_id;
110 };
111 
112 } // namespace lldb_private
113 
114 #endif  // liblldb_HistoryThread_h_
115