Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Process/Utility/HistoryThread.h
39644 views
//===-- HistoryThread.h -----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H9#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H1011#include <mutex>1213#include "lldb/Core/UserSettingsController.h"14#include "lldb/Target/ExecutionContextScope.h"15#include "lldb/Target/StackFrameList.h"16#include "lldb/Target/Thread.h"17#include "lldb/Utility/Broadcaster.h"18#include "lldb/Utility/Event.h"19#include "lldb/Utility/UserID.h"20#include "lldb/lldb-private.h"2122namespace lldb_private {2324/// \class HistoryThread HistoryThread.h "HistoryThread.h"25/// A thread object representing a backtrace from a previous point in the26/// process execution27///28/// This subclass of Thread is used to provide a backtrace from earlier in29/// process execution. It is given a backtrace list of pc addresses and it30/// will create stack frames for them.3132class HistoryThread : public lldb_private::Thread {33public:34HistoryThread(lldb_private::Process &process, lldb::tid_t tid,35std::vector<lldb::addr_t> pcs,36bool pcs_are_call_addresses = false);3738~HistoryThread() override;3940lldb::RegisterContextSP GetRegisterContext() override;4142lldb::RegisterContextSP43CreateRegisterContextForFrame(StackFrame *frame) override;4445void RefreshStateAfterStop() override {}4647bool CalculateStopInfo() override { return false; }4849void SetExtendedBacktraceToken(uint64_t token) override {50m_extended_unwind_token = token;51}5253uint64_t GetExtendedBacktraceToken() override {54return m_extended_unwind_token;55}5657const char *GetQueueName() override { return m_queue_name.c_str(); }5859void SetQueueName(const char *name) override { m_queue_name = name; }6061lldb::queue_id_t GetQueueID() override { return m_queue_id; }6263void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }6465const char *GetThreadName() { return m_thread_name.c_str(); }6667uint32_t GetExtendedBacktraceOriginatingIndexID() override;6869void SetThreadName(const char *name) { m_thread_name = name; }7071const char *GetName() override { return m_thread_name.c_str(); }7273void SetName(const char *name) override { m_thread_name = name; }7475protected:76virtual lldb::StackFrameListSP GetStackFrameList();7778mutable std::mutex m_framelist_mutex;79lldb::StackFrameListSP m_framelist;80std::vector<lldb::addr_t> m_pcs;8182uint64_t m_extended_unwind_token;83std::string m_queue_name;84std::string m_thread_name;85lldb::tid_t m_originating_unique_thread_id;86lldb::queue_id_t m_queue_id;87};8889} // namespace lldb_private9091#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H929394