Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Process / Utility / HistoryThread.h
bloba66e0f2d4207c98148253437478356f4d95c1f73
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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
12 #include <mutex>
14 #include "lldb/Core/UserSettingsController.h"
15 #include "lldb/Target/ExecutionContextScope.h"
16 #include "lldb/Target/StackFrameList.h"
17 #include "lldb/Target/Thread.h"
18 #include "lldb/Utility/Broadcaster.h"
19 #include "lldb/Utility/Event.h"
20 #include "lldb/Utility/UserID.h"
21 #include "lldb/lldb-private.h"
23 namespace lldb_private {
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.
33 class HistoryThread : public lldb_private::Thread {
34 public:
35 HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
36 std::vector<lldb::addr_t> pcs,
37 bool pcs_are_call_addresses = false);
39 ~HistoryThread() override;
41 lldb::RegisterContextSP GetRegisterContext() override;
43 lldb::RegisterContextSP
44 CreateRegisterContextForFrame(StackFrame *frame) override;
46 void RefreshStateAfterStop() override {}
48 bool CalculateStopInfo() override { return false; }
50 void SetExtendedBacktraceToken(uint64_t token) override {
51 m_extended_unwind_token = token;
54 uint64_t GetExtendedBacktraceToken() override {
55 return m_extended_unwind_token;
58 const char *GetQueueName() override { return m_queue_name.c_str(); }
60 void SetQueueName(const char *name) override { m_queue_name = name; }
62 lldb::queue_id_t GetQueueID() override { return m_queue_id; }
64 void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
66 const char *GetThreadName() { return m_thread_name.c_str(); }
68 uint32_t GetExtendedBacktraceOriginatingIndexID() override;
70 void SetThreadName(const char *name) { m_thread_name = name; }
72 const char *GetName() override { return m_thread_name.c_str(); }
74 void SetName(const char *name) override { m_thread_name = name; }
76 protected:
77 virtual lldb::StackFrameListSP GetStackFrameList();
79 mutable std::mutex m_framelist_mutex;
80 lldb::StackFrameListSP m_framelist;
81 std::vector<lldb::addr_t> m_pcs;
83 uint64_t m_extended_unwind_token;
84 std::string m_queue_name;
85 std::string m_thread_name;
86 lldb::tid_t m_originating_unique_thread_id;
87 lldb::queue_id_t m_queue_id;
90 } // namespace lldb_private
92 #endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H