LLDB  mainline
HistoryThread.h
Go to the documentation of this file.
1 //===-- HistoryThread.h -----------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
11 
12 #include <mutex>
13 
17 #include "lldb/Target/Thread.h"
19 #include "lldb/Utility/Event.h"
20 #include "lldb/Utility/UserID.h"
21 #include "lldb/lldb-private.h"
22 
23 namespace lldb_private {
24 
25 /// \class HistoryThread HistoryThread.h "HistoryThread.h"
26 /// A thread object representing a backtrace from a previous point in the
27 /// 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 it
31 /// will create stack frames for them.
32 
34 public:
36  std::vector<lldb::addr_t> pcs,
37  bool pcs_are_call_addresses = false);
38 
39  ~HistoryThread() override;
40 
41  lldb::RegisterContextSP GetRegisterContext() override;
42 
43  lldb::RegisterContextSP
45 
46  void RefreshStateAfterStop() override {}
47 
48  bool CalculateStopInfo() override { return false; }
49 
50  void SetExtendedBacktraceToken(uint64_t token) override {
52  }
53 
54  uint64_t GetExtendedBacktraceToken() override {
56  }
57 
58  const char *GetQueueName() override { return m_queue_name.c_str(); }
59 
60  void SetQueueName(const char *name) override { m_queue_name = name; }
61 
62  lldb::queue_id_t GetQueueID() override { return m_queue_id; }
63 
64  void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
65 
66  const char *GetThreadName() { return m_thread_name.c_str(); }
67 
69 
70  void SetThreadName(const char *name) { m_thread_name = name; }
71 
72  const char *GetName() override { return m_thread_name.c_str(); }
73 
74  void SetName(const char *name) override { m_thread_name = name; }
75 
76 protected:
77  virtual lldb::StackFrameListSP GetStackFrameList();
78 
79  mutable std::mutex m_framelist_mutex;
80  lldb::StackFrameListSP m_framelist;
81  std::vector<lldb::addr_t> m_pcs;
82 
88 };
89 
90 } // namespace lldb_private
91 
92 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
lldb_private::HistoryThread::SetQueueName
void SetQueueName(const char *name) override
Definition: HistoryThread.h:60
lldb_private::HistoryThread::GetRegisterContext
lldb::RegisterContextSP GetRegisterContext() override
Definition: HistoryThread.cpp:49
lldb_private::Process
Definition: Process.h:341
lldb_private::HistoryThread::RefreshStateAfterStop
void RefreshStateAfterStop() override
Definition: HistoryThread.h:46
lldb_private::HistoryThread
Definition: HistoryThread.h:33
lldb_private::HistoryThread::GetQueueName
const char * GetQueueName() override
Retrieve the Queue name for the queue currently using this Thread.
Definition: HistoryThread.h:58
lldb_private::HistoryThread::SetThreadName
void SetThreadName(const char *name)
Definition: HistoryThread.h:70
Broadcaster.h
lldb_private::HistoryThread::CalculateStopInfo
bool CalculateStopInfo() override
Definition: HistoryThread.h:48
lldb::queue_id_t
uint64_t queue_id_t
Definition: lldb-types.h:91
lldb_private::HistoryThread::m_originating_unique_thread_id
lldb::tid_t m_originating_unique_thread_id
Definition: HistoryThread.h:86
lldb_private::HistoryThread::~HistoryThread
~HistoryThread() override
Definition: HistoryThread.cpp:42
lldb_private::HistoryThread::GetExtendedBacktraceOriginatingIndexID
uint32_t GetExtendedBacktraceOriginatingIndexID() override
Definition: HistoryThread.cpp:75
lldb_private::HistoryThread::SetQueueID
void SetQueueID(lldb::queue_id_t queue) override
Definition: HistoryThread.h:64
lldb_private::HistoryThread::GetName
const char * GetName() override
Definition: HistoryThread.h:72
lldb_private::Thread
Definition: Thread.h:60
StackFrameList.h
lldb_private::HistoryThread::m_queue_name
std::string m_queue_name
Definition: HistoryThread.h:84
lldb_private::HistoryThread::CreateRegisterContextForFrame
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) override
Definition: HistoryThread.cpp:59
lldb_private::HistoryThread::SetName
void SetName(const char *name) override
Definition: HistoryThread.h:74
lldb_private::HistoryThread::GetQueueID
lldb::queue_id_t GetQueueID() override
Retrieve the Queue ID for the queue currently using this Thread.
Definition: HistoryThread.h:62
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
Thread.h
Event.h
UserID.h
lldb-private.h
lldb_private::HistoryThread::SetExtendedBacktraceToken
void SetExtendedBacktraceToken(uint64_t token) override
Sets the extended backtrace token for this thread.
Definition: HistoryThread.h:50
uint32_t
UserSettingsController.h
lldb_private::HistoryThread::m_pcs
std::vector< lldb::addr_t > m_pcs
Definition: HistoryThread.h:81
lldb_private::HistoryThread::HistoryThread
HistoryThread(lldb_private::Process &process, lldb::tid_t tid, std::vector< lldb::addr_t > pcs, bool pcs_are_call_addresses=false)
Definition: HistoryThread.cpp:27
ExecutionContextScope.h
lldb_private::HistoryThread::GetStackFrameList
virtual lldb::StackFrameListSP GetStackFrameList()
Definition: HistoryThread.cpp:63
lldb_private::HistoryThread::m_framelist
lldb::StackFrameListSP m_framelist
Definition: HistoryThread.h:80
lldb_private::HistoryThread::m_queue_id
lldb::queue_id_t m_queue_id
Definition: HistoryThread.h:87
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::HistoryThread::GetExtendedBacktraceToken
uint64_t GetExtendedBacktraceToken() override
Gets the extended backtrace token for this thread.
Definition: HistoryThread.h:54
lldb_private::HistoryThread::m_framelist_mutex
std::mutex m_framelist_mutex
Definition: HistoryThread.h:79
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::HistoryThread::m_thread_name
std::string m_thread_name
Definition: HistoryThread.h:85
lldb_private::HistoryThread::m_extended_unwind_token
uint64_t m_extended_unwind_token
Definition: HistoryThread.h:83
lldb_private::HistoryThread::GetThreadName
const char * GetThreadName()
Definition: HistoryThread.h:66
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86