2013-12-03 13:51:59 -05:00
|
|
|
//===-- HistoryThread.h -----------------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
2019-08-20 16:51:52 -04:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-12-03 13:51:59 -05:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2020-07-26 15:36:28 -04:00
|
|
|
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
|
|
|
|
|
#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
|
2013-12-03 13:51:59 -05:00
|
|
|
|
2016-07-23 16:50:09 -04:00
|
|
|
#include <mutex>
|
|
|
|
|
|
2013-12-03 13:51:59 -05:00
|
|
|
#include "lldb/Core/UserSettingsController.h"
|
|
|
|
|
#include "lldb/Target/ExecutionContextScope.h"
|
|
|
|
|
#include "lldb/Target/StackFrameList.h"
|
|
|
|
|
#include "lldb/Target/Thread.h"
|
2019-01-19 05:06:29 -05:00
|
|
|
#include "lldb/Utility/Broadcaster.h"
|
|
|
|
|
#include "lldb/Utility/Event.h"
|
2017-04-16 12:04:10 -04:00
|
|
|
#include "lldb/Utility/UserID.h"
|
2017-01-02 14:26:05 -05:00
|
|
|
#include "lldb/lldb-private.h"
|
2013-12-03 13:51:59 -05:00
|
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
|
|
2019-08-20 16:51:52 -04:00
|
|
|
/// \class HistoryThread HistoryThread.h "HistoryThread.h"
|
2018-07-28 07:09:23 -04:00
|
|
|
/// A thread object representing a backtrace from a previous point in the
|
2017-01-02 14:26:05 -05:00
|
|
|
/// process execution
|
2014-02-18 11:23:10 -05:00
|
|
|
///
|
|
|
|
|
/// This subclass of Thread is used to provide a backtrace from earlier in
|
2019-08-20 16:51:52 -04:00
|
|
|
/// process execution. It is given a backtrace list of pc addresses and it
|
2018-07-28 07:09:23 -04:00
|
|
|
/// will create stack frames for them.
|
2014-02-18 11:23:10 -05:00
|
|
|
|
2017-01-02 14:26:05 -05:00
|
|
|
class HistoryThread : public lldb_private::Thread {
|
2013-12-03 13:51:59 -05:00
|
|
|
public:
|
2017-01-02 14:26:05 -05:00
|
|
|
HistoryThread(lldb_private::Process &process, lldb::tid_t tid,
|
2020-07-26 15:36:28 -04:00
|
|
|
std::vector<lldb::addr_t> pcs,
|
|
|
|
|
bool pcs_are_call_addresses = false);
|
2017-01-02 14:26:05 -05:00
|
|
|
|
|
|
|
|
~HistoryThread() override;
|
|
|
|
|
|
|
|
|
|
lldb::RegisterContextSP GetRegisterContext() override;
|
|
|
|
|
|
|
|
|
|
lldb::RegisterContextSP
|
|
|
|
|
CreateRegisterContextForFrame(StackFrame *frame) override;
|
|
|
|
|
|
|
|
|
|
void RefreshStateAfterStop() override {}
|
|
|
|
|
|
|
|
|
|
bool CalculateStopInfo() override { return false; }
|
|
|
|
|
|
|
|
|
|
void SetExtendedBacktraceToken(uint64_t token) override {
|
|
|
|
|
m_extended_unwind_token = token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint64_t GetExtendedBacktraceToken() override {
|
|
|
|
|
return m_extended_unwind_token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *GetQueueName() override { return m_queue_name.c_str(); }
|
|
|
|
|
|
|
|
|
|
void SetQueueName(const char *name) override { m_queue_name = name; }
|
|
|
|
|
|
|
|
|
|
lldb::queue_id_t GetQueueID() override { return m_queue_id; }
|
|
|
|
|
|
|
|
|
|
void SetQueueID(lldb::queue_id_t queue) override { m_queue_id = queue; }
|
|
|
|
|
|
|
|
|
|
const char *GetThreadName() { return m_thread_name.c_str(); }
|
|
|
|
|
|
|
|
|
|
uint32_t GetExtendedBacktraceOriginatingIndexID() override;
|
|
|
|
|
|
|
|
|
|
void SetThreadName(const char *name) { m_thread_name = name; }
|
|
|
|
|
|
|
|
|
|
const char *GetName() override { return m_thread_name.c_str(); }
|
|
|
|
|
|
|
|
|
|
void SetName(const char *name) override { m_thread_name = name; }
|
2013-12-03 13:51:59 -05:00
|
|
|
|
|
|
|
|
protected:
|
2017-01-02 14:26:05 -05:00
|
|
|
virtual lldb::StackFrameListSP GetStackFrameList();
|
|
|
|
|
|
|
|
|
|
mutable std::mutex m_framelist_mutex;
|
|
|
|
|
lldb::StackFrameListSP m_framelist;
|
|
|
|
|
std::vector<lldb::addr_t> m_pcs;
|
|
|
|
|
|
|
|
|
|
uint64_t m_extended_unwind_token;
|
|
|
|
|
std::string m_queue_name;
|
|
|
|
|
std::string m_thread_name;
|
|
|
|
|
lldb::tid_t m_originating_unique_thread_id;
|
|
|
|
|
lldb::queue_id_t m_queue_id;
|
2013-12-03 13:51:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
|
2020-07-26 15:36:28 -04:00
|
|
|
#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_HISTORYTHREAD_H
|