]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/HistoryThread.h
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / HistoryThread.h
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 //----------------------------------------------------------------------
26 /// @class HistoryThread HistoryThread.h "HistoryThread.h"
27 /// @brief A thread object representing a backtrace from a previous point in the process execution
28 ///
29 /// This subclass of Thread is used to provide a backtrace from earlier in
30 /// process execution.  It is given a backtrace list of pc addresses and 
31 /// optionally a stop_id of when those pc addresses were collected, and it will
32 /// create stack frames for them.
33 //----------------------------------------------------------------------
34
35 class HistoryThread : public lldb_private::Thread
36 {
37 public:
38     HistoryThread (lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs, uint32_t stop_id, bool stop_id_is_valid);
39
40     virtual ~HistoryThread ();
41
42     virtual lldb::RegisterContextSP
43     GetRegisterContext ();
44
45     virtual lldb::RegisterContextSP
46     CreateRegisterContextForFrame (StackFrame *frame);
47
48     virtual void
49     RefreshStateAfterStop() { }
50
51     bool
52     CalculateStopInfo () { return false; }
53
54     void 
55     SetExtendedBacktraceToken (uint64_t token)
56     {
57         m_extended_unwind_token = token;
58     }
59
60     uint64_t
61     GetExtendedBacktraceToken ()
62     {
63         return m_extended_unwind_token;
64     }
65
66     const char *
67     GetQueueName ()
68     {
69         return m_queue_name.c_str();
70     }
71
72     void
73     SetQueueName (const char *name)
74     {
75         m_queue_name = name;
76     }
77
78     lldb::queue_id_t
79     GetQueueID ()
80     {
81         return m_queue_id;
82     }
83
84     void
85     SetQueueID (lldb::queue_id_t queue)
86     {
87         m_queue_id = queue;
88     }
89
90     const char *
91     GetThreadName ()
92     {
93         return m_thread_name.c_str();
94     }
95
96     uint32_t
97     GetExtendedBacktraceOriginatingIndexID ();
98
99     void
100     SetThreadName (const char *name)
101     {
102         m_thread_name = name;
103     }
104     
105     virtual const char *
106     GetName ()
107     {
108         return m_thread_name.c_str();
109     }
110     
111     virtual void
112     SetName(const char *name)
113     {
114         m_thread_name = name;
115     }
116
117 protected:
118     virtual lldb::StackFrameListSP
119     GetStackFrameList ();
120
121     mutable Mutex               m_framelist_mutex;
122     lldb::StackFrameListSP      m_framelist;
123     std::vector<lldb::addr_t>   m_pcs;
124     uint32_t                    m_stop_id;
125     bool                        m_stop_id_is_valid;
126
127     uint64_t                    m_extended_unwind_token;
128     std::string                 m_queue_name;
129     std::string                 m_thread_name;
130     lldb::tid_t                 m_originating_unique_thread_id;
131     lldb::queue_id_t            m_queue_id;
132 };
133
134 } // namespace lldb_private
135
136 #endif  // liblldb_HistoryThread_h_