LLDB mainline
ThreadMemory.h
Go to the documentation of this file.
1//===-- ThreadMemory.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_UTILITY_THREADMEMORY_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_THREADMEMORY_H
11
12#include <string>
13
14#include "lldb/Target/Thread.h"
15
17public:
19 const lldb::ValueObjectSP &thread_info_valobj_sp);
20
22 llvm::StringRef name, llvm::StringRef queue,
23 lldb::addr_t register_data_addr);
24
25 ~ThreadMemory() override;
26
28
31
32 bool CalculateStopInfo() override;
33
34 const char *GetInfo() override {
36 m_backing_thread_sp->GetInfo();
37 return nullptr;
38 }
39
40 const char *GetName() override {
41 if (!m_name.empty())
42 return m_name.c_str();
44 m_backing_thread_sp->GetName();
45 return nullptr;
46 }
47
48 const char *GetQueueName() override {
49 if (!m_queue.empty())
50 return m_queue.c_str();
52 m_backing_thread_sp->GetQueueName();
53 return nullptr;
54 }
55
56 void WillResume(lldb::StateType resume_state) override;
57
58 void DidResume() override {
60 m_backing_thread_sp->DidResume();
61 }
62
63 lldb::user_id_t GetProtocolID() const override {
65 return m_backing_thread_sp->GetProtocolID();
66 return Thread::GetProtocolID();
67 }
68
69 void RefreshStateAfterStop() override;
70
72
73 void ClearStackFrames() override;
74
75 void ClearBackingThread() override { m_backing_thread_sp.reset(); }
76
77 bool SetBackingThread(const lldb::ThreadSP &thread_sp) override {
78 // printf ("Thread 0x%llx is being backed by thread 0x%llx\n", GetID(),
79 // thread_sp->GetID());
80 m_backing_thread_sp = thread_sp;
81 return (bool)thread_sp;
82 }
83
86 }
87
88protected:
89 bool IsOperatingSystemPluginThread() const override { return true; }
90
91 // If this memory thread is actually represented by a thread from the
92 // lldb_private::Process subclass, then fill in the thread here and
93 // all APIs will be routed through this thread object. If m_backing_thread_sp
94 // is empty, then this thread is simply in memory with no representation
95 // through the process plug-in.
98 std::string m_name;
99 std::string m_queue;
101
102private:
103 ThreadMemory(const ThreadMemory &) = delete;
104 const ThreadMemory &operator=(const ThreadMemory &) = delete;
105};
106
107#endif // LLDB_SOURCE_PLUGINS_PROCESS_UTILITY_THREADMEMORY_H
lldb::addr_t m_register_data_addr
Definition: ThreadMemory.h:100
const char * GetInfo() override
Definition: ThreadMemory.h:34
void DidResume() override
Definition: ThreadMemory.h:58
lldb::ThreadSP GetBackingThread() const override
Definition: ThreadMemory.h:84
const ThreadMemory & operator=(const ThreadMemory &)=delete
bool IsOperatingSystemPluginThread() const override
Definition: ThreadMemory.h:89
std::string m_queue
Definition: ThreadMemory.h:99
lldb::ThreadSP m_backing_thread_sp
Definition: ThreadMemory.h:96
std::string m_name
Definition: ThreadMemory.h:98
const char * GetQueueName() override
Retrieve the Queue name for the queue currently using this Thread.
Definition: ThreadMemory.h:48
lldb::RegisterContextSP GetRegisterContext() override
lldb::ValueObjectSP m_thread_info_valobj_sp
Definition: ThreadMemory.h:97
void RefreshStateAfterStop() override
const char * GetName() override
Definition: ThreadMemory.h:40
lldb::ValueObjectSP & GetValueObject()
Definition: ThreadMemory.h:71
ThreadMemory(const ThreadMemory &)=delete
lldb::RegisterContextSP CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override
void ClearBackingThread() override
Definition: ThreadMemory.h:75
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
~ThreadMemory() override
bool SetBackingThread(const lldb::ThreadSP &thread_sp) override
Definition: ThreadMemory.h:77
void WillResume(lldb::StateType resume_state) override
lldb::user_id_t GetProtocolID() const override
Definition: ThreadMemory.h:63
void ClearStackFrames() override
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
This base class provides an interface to stack frames.
Definition: StackFrame.h:44
std::shared_ptr< lldb_private::Thread > ThreadSP
Definition: lldb-forward.h:450
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
StateType
Process and Thread States.
uint64_t user_id_t
Definition: lldb-types.h:82
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Definition: lldb-forward.h:394
uint64_t tid_t
Definition: lldb-types.h:84