LLDB mainline
ThreadGDBRemote.h
Go to the documentation of this file.
1//===-- ThreadGDBRemote.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 LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_THREADGDBREMOTE_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_THREADGDBREMOTE_H
11
12#include <string>
13
14#include "lldb/Target/Thread.h"
16
18
19class StringExtractor;
20
21namespace lldb_private {
22class Process;
23
24namespace process_gdb_remote {
25
26class ProcessGDBRemote;
27
28class ThreadGDBRemote : public Thread {
29public:
30 ThreadGDBRemote(Process &process, lldb::tid_t tid);
31
32 ~ThreadGDBRemote() override;
33
34 void WillResume(lldb::StateType resume_state) override;
35
36 void RefreshStateAfterStop() override;
37
38 const char *GetName() override;
39
40 const char *GetQueueName() override;
41
43
45
46 lldb::QueueSP GetQueue() override;
47
49
50 void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override;
51
52 bool ThreadHasQueueInformation() const override;
53
55
58
59 void Dump(Log *log, uint32_t index);
60
61 static bool ThreadIDIsValid(lldb::tid_t thread);
62
63 bool ShouldStop(bool &step_more);
64
65 const char *GetBasicInfoAsString();
66
67 void SetName(const char *name) override {
68 if (name && name[0])
69 m_thread_name.assign(name);
70 else
71 m_thread_name.clear();
72 }
73
75
76 void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr) {
77 m_thread_dispatch_qaddr = thread_dispatch_qaddr;
78 }
79
80 void ClearQueueInfo();
81
82 void SetQueueInfo(std::string &&queue_name, lldb::QueueKind queue_kind,
83 uint64_t queue_serial, lldb::addr_t dispatch_queue_t,
84 lldb_private::LazyBool associated_with_libdispatch_queue);
85
87
89 lldb_private::LazyBool associated_with_libdispatch_queue) override;
90
92
93protected:
94 friend class ProcessGDBRemote;
95
96 std::string m_thread_name;
101 m_queue_kind; // Queue info from stop reply/stop info for thread
102 uint64_t
103 m_queue_serial_number; // Queue info from stop reply/stop info for thread
105
107
108 bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef<uint8_t> data);
109
110 bool PrivateSetRegisterValue(uint32_t reg, uint64_t regval);
111
114 }
115 void SetStopInfoFromPacket(StringExtractor &stop_packet, uint32_t stop_id);
116
117 bool CalculateStopInfo() override;
118
119 llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>>
120 GetSiginfo(size_t max_size) const override;
121};
122
123} // namespace process_gdb_remote
124} // namespace lldb_private
125
126#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_THREADGDBREMOTE_H
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
This base class provides an interface to stack frames.
Definition: StackFrame.h:43
std::shared_ptr< Object > ObjectSP
StructuredData::ObjectSP FetchThreadExtendedInfo() override
void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) override
bool ThreadHasQueueInformation() const override
Whether this Thread already has all the Queue information cached or not.
lldb::QueueSP GetQueue() override
Retrieve the Queue for this thread, if any.
void SetQueueInfo(std::string &&queue_name, lldb::QueueKind queue_kind, uint64_t queue_serial, lldb::addr_t dispatch_queue_t, lldb_private::LazyBool associated_with_libdispatch_queue)
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > GetSiginfo(size_t max_size) const override
void SetThreadDispatchQAddr(lldb::addr_t thread_dispatch_qaddr)
lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() override
Whether this thread can be associated with a libdispatch queue.
lldb::QueueKind GetQueueKind() override
Retrieve the Queue kind for the queue currently using this Thread.
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) override
lldb::queue_id_t GetQueueID() override
Retrieve the Queue ID for the queue currently using this Thread.
const char * GetQueueName() override
Retrieve the Queue name for the queue currently using this Thread.
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
void WillResume(lldb::StateType resume_state) override
lldb::RegisterContextSP GetRegisterContext() override
lldb::addr_t GetQueueLibdispatchQueueAddress() override
Retrieve the address of the libdispatch_queue_t struct for queue currently using this Thread.
void SetAssociatedWithLibdispatchQueue(lldb_private::LazyBool associated_with_libdispatch_queue) override
bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef< uint8_t > data)
void SetStopInfoFromPacket(StringExtractor &stop_packet, uint32_t stop_id)
std::shared_ptr< GDBRemoteDynamicRegisterInfo > GDBRemoteDynamicRegisterInfoSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Queue > QueueSP
Definition: lldb-forward.h:396
StateType
Process and Thread States.
QueueKind
Queue type.
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Definition: lldb-forward.h:392
uint64_t tid_t
Definition: lldb-types.h:84
uint64_t queue_id_t
Definition: lldb-types.h:90