blob: f9a431d8340b9a2e809cecc4eb5fb31ebff3a365 [file] [log] [blame]
Jason Molenda02706c32013-11-08 04:59:54 +00001//===-- 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
23namespace lldb_private {
24
Jason Molenda2fd83352014-02-05 05:44:54 +000025//----------------------------------------------------------------------
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
Jason Molenda02706c32013-11-08 04:59:54 +000035class HistoryThread : public lldb_private::Thread
36{
37public:
Jason Molenda8ee9cb52013-11-16 01:24:22 +000038 HistoryThread (lldb_private::Process &process, lldb::tid_t tid, std::vector<lldb::addr_t> pcs, uint32_t stop_id, bool stop_id_is_valid);
Jason Molenda02706c32013-11-08 04:59:54 +000039
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
Jason Molendaa7b5afa2013-11-15 00:17:32 +000054 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
Jason Molendaa6e91302013-11-19 05:44:41 +000078 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
Jason Molenda8ee9cb52013-11-16 01:24:22 +000090 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
Jason Molenda02706c32013-11-08 04:59:54 +0000105protected:
106 virtual lldb::StackFrameListSP
107 GetStackFrameList ();
108
109 mutable Mutex m_framelist_mutex;
110 lldb::StackFrameListSP m_framelist;
111 std::vector<lldb::addr_t> m_pcs;
112 uint32_t m_stop_id;
113 bool m_stop_id_is_valid;
Jason Molendaa7b5afa2013-11-15 00:17:32 +0000114
115 uint64_t m_extended_unwind_token;
116 std::string m_queue_name;
Jason Molenda8ee9cb52013-11-16 01:24:22 +0000117 std::string m_thread_name;
118 lldb::tid_t m_originating_unique_thread_id;
Jason Molendaa6e91302013-11-19 05:44:41 +0000119 lldb::queue_id_t m_queue_id;
Jason Molenda02706c32013-11-08 04:59:54 +0000120};
121
122} // namespace lldb_private
123
124#endif // liblldb_HistoryThread_h_