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 liblldb_HistoryThread_h_
10 #define liblldb_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
31 /// optionally a stop_id of when those pc addresses were collected, and it
32 /// will create stack frames for them.
33 
35 public:
37  std::vector<lldb::addr_t> pcs, uint32_t stop_id,
38  bool stop_id_is_valid);
39 
40  ~HistoryThread() override;
41 
42  lldb::RegisterContextSP GetRegisterContext() override;
43 
44  lldb::RegisterContextSP
46 
47  void RefreshStateAfterStop() override {}
48 
49  bool CalculateStopInfo() override { return false; }
50 
51  void SetExtendedBacktraceToken(uint64_t token) override {
53  }
54 
55  uint64_t GetExtendedBacktraceToken() override {
57  }
58 
59  const char *GetQueueName() override { return m_queue_name.c_str(); }
60 
61  void SetQueueName(const char *name) override { m_queue_name = name; }
62 
63  lldb::queue_id_t GetQueueID() override { return m_queue_id; }
64 
65  void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
66 
67  const char *GetThreadName() { return m_thread_name.c_str(); }
68 
70 
71  void SetThreadName(const char *name) { m_thread_name = name; }
72 
73  const char *GetName() override { return m_thread_name.c_str(); }
74 
75  void SetName(const char *name) override { m_thread_name = name; }
76 
77 protected:
78  virtual lldb::StackFrameListSP GetStackFrameList();
79 
80  mutable std::mutex m_framelist_mutex;
81  lldb::StackFrameListSP m_framelist;
82  std::vector<lldb::addr_t> m_pcs;
85 
87  std::string m_queue_name;
88  std::string m_thread_name;
91 };
92 
93 } // namespace lldb_private
94 
95 #endif // liblldb_HistoryThread_h_
uint64_t GetExtendedBacktraceToken() override
Gets the extended backtrace token for this thread.
Definition: HistoryThread.h:55
virtual lldb::StackFrameListSP GetStackFrameList()
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
lldb::RegisterContextSP GetRegisterContext() override
const char * GetQueueName() override
Retrieve the Queue name for the queue currently using this Thread.
Definition: HistoryThread.h:59
void SetQueueID(lldb::queue_id_t queue) override
Definition: HistoryThread.h:65
void SetQueueName(const char *name) override
Definition: HistoryThread.h:61
bool CalculateStopInfo() override
Definition: HistoryThread.h:49
void RefreshStateAfterStop() override
Definition: HistoryThread.h:47
lldb::queue_id_t GetQueueID() override
Retrieve the Queue ID for the queue currently using this Thread.
Definition: HistoryThread.h:63
lldb::tid_t m_originating_unique_thread_id
Definition: HistoryThread.h:89
std::vector< lldb::addr_t > m_pcs
Definition: HistoryThread.h:82
uint64_t tid_t
Definition: lldb-types.h:86
HistoryThread(lldb_private::Process &process, lldb::tid_t tid, std::vector< lldb::addr_t > pcs, uint32_t stop_id, bool stop_id_is_valid)
void SetName(const char *name) override
Definition: HistoryThread.h:75
A plug-in interface definition class for debugging a process.
Definition: Process.h:353
uint32_t GetExtendedBacktraceOriginatingIndexID() override
const char * GetThreadName()
Definition: HistoryThread.h:67
void SetThreadName(const char *name)
Definition: HistoryThread.h:71
A thread object representing a backtrace from a previous point in the process execution.
Definition: HistoryThread.h:34
uint64_t queue_id_t
Definition: lldb-types.h:91
lldb::StackFrameListSP m_framelist
Definition: HistoryThread.h:81
void SetExtendedBacktraceToken(uint64_t token) override
Sets the extended backtrace token for this thread.
Definition: HistoryThread.h:51
lldb::queue_id_t m_queue_id
Definition: HistoryThread.h:90
const char * GetName() override
Definition: HistoryThread.h:73
This base class provides an interface to stack frames.
Definition: StackFrame.h:40
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) override