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 23namespace 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 35class HistoryThread : public lldb_private::Thread 36{ 37public: 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 105protected: 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; 114 115 uint64_t m_extended_unwind_token; 116 std::string m_queue_name; 117 std::string m_thread_name; 118 lldb::tid_t m_originating_unique_thread_id; 119 lldb::queue_id_t m_queue_id; 120}; 121 122} // namespace lldb_private 123 124#endif // liblldb_HistoryThread_h_ 125