Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
39644 views
//===-- ThreadGDBRemote.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_GDB_REMOTE_THREADGDBREMOTE_H9#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_THREADGDBREMOTE_H1011#include <string>1213#include "lldb/Target/Thread.h"14#include "lldb/Utility/StructuredData.h"1516#include "GDBRemoteRegisterContext.h"1718class StringExtractor;1920namespace lldb_private {21class Process;2223namespace process_gdb_remote {2425class ProcessGDBRemote;2627class ThreadGDBRemote : public Thread {28public:29ThreadGDBRemote(Process &process, lldb::tid_t tid);3031~ThreadGDBRemote() override;3233void WillResume(lldb::StateType resume_state) override;3435void RefreshStateAfterStop() override;3637const char *GetName() override;3839const char *GetQueueName() override;4041lldb::QueueKind GetQueueKind() override;4243lldb::queue_id_t GetQueueID() override;4445lldb::QueueSP GetQueue() override;4647lldb::addr_t GetQueueLibdispatchQueueAddress() override;4849void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override;5051bool ThreadHasQueueInformation() const override;5253lldb::RegisterContextSP GetRegisterContext() override;5455lldb::RegisterContextSP56CreateRegisterContextForFrame(StackFrame *frame) override;5758void Dump(Log *log, uint32_t index);5960static bool ThreadIDIsValid(lldb::tid_t thread);6162bool ShouldStop(bool &step_more);6364const char *GetBasicInfoAsString();6566void SetName(const char *name) override {67if (name && name[0])68m_thread_name.assign(name);69else70m_thread_name.clear();71}7273lldb::addr_t GetThreadDispatchQAddr() { return m_thread_dispatch_qaddr; }7475void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr) {76m_thread_dispatch_qaddr = thread_dispatch_qaddr;77}7879void ClearQueueInfo();8081void SetQueueInfo(std::string &&queue_name, lldb::QueueKind queue_kind,82uint64_t queue_serial, lldb::addr_t dispatch_queue_t,83lldb_private::LazyBool associated_with_libdispatch_queue);8485lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override;8687void SetAssociatedWithLibdispatchQueue(88lldb_private::LazyBool associated_with_libdispatch_queue) override;8990StructuredData::ObjectSP FetchThreadExtendedInfo() override;9192protected:93friend class ProcessGDBRemote;9495std::string m_thread_name;96std::string m_dispatch_queue_name;97lldb::addr_t m_thread_dispatch_qaddr;98lldb::addr_t m_dispatch_queue_t;99lldb::QueueKind100m_queue_kind; // Queue info from stop reply/stop info for thread101uint64_t102m_queue_serial_number; // Queue info from stop reply/stop info for thread103lldb_private::LazyBool m_associated_with_libdispatch_queue;104105GDBRemoteDynamicRegisterInfoSP m_reg_info_sp;106107bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef<uint8_t> data);108109bool PrivateSetRegisterValue(uint32_t reg, uint64_t regval);110111bool CachedQueueInfoIsValid() const {112return m_queue_kind != lldb::eQueueKindUnknown;113}114void SetStopInfoFromPacket(StringExtractor &stop_packet, uint32_t stop_id);115116bool CalculateStopInfo() override;117118llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>119GetSiginfo(size_t max_size) const override;120};121122} // namespace process_gdb_remote123} // namespace lldb_private124125#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_THREADGDBREMOTE_H126127128