LLDB mainline
ThreadMemory.cpp
Go to the documentation of this file.
1//===-- ThreadMemory.cpp --------------------------------------------------===//
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
10
13#include "lldb/Target/Process.h"
16#include "lldb/Target/Unwind.h"
17
18#include <memory>
19
20using namespace lldb;
21using namespace lldb_private;
22
28
30 Process &process, lldb::tid_t tid, llvm::StringRef name,
31 llvm::StringRef queue, lldb::addr_t register_data_addr)
32 : ThreadMemoryProvidingName(process, tid, register_data_addr, name),
33 m_thread_info_valobj_sp(), m_queue(std::string(queue)) {}
34
36
39 m_backing_thread_sp->WillResume(resume_state);
40}
41
47
50 m_reg_context_sp = std::make_shared<RegisterContextThreadMemory>(
52 return m_reg_context_sp;
53}
54
57 uint32_t concrete_frame_idx = 0;
58
59 if (frame)
60 concrete_frame_idx = frame->GetConcreteFrameIndex();
61
62 if (concrete_frame_idx == 0)
63 return GetRegisterContext();
65}
66
69 lldb::StopInfoSP backing_stop_info_sp(
70 m_backing_thread_sp->GetPrivateStopInfo());
71 if (backing_stop_info_sp &&
72 backing_stop_info_sp->IsValidForOperatingSystemThread(*this)) {
73 backing_stop_info_sp->SetThread(shared_from_this());
74 SetStopInfo(backing_stop_info_sp);
75 return true;
76 }
77 } else {
78 ProcessSP process_sp(GetProcess());
79
80 if (process_sp) {
81 OperatingSystem *os = process_sp->GetOperatingSystem();
82 if (os) {
84 return true;
85 }
86 }
87 }
88 return false;
89}
90
93 return m_backing_thread_sp->RefreshStateAfterStop();
94
96 m_reg_context_sp->InvalidateAllRegisters();
97}
lldb::ValueObjectSP m_thread_info_valobj_sp
ThreadMemoryProvidingNameAndQueue(lldb_private::Process &process, lldb::tid_t tid, const lldb::ValueObjectSP &thread_info_valobj_sp)
ThreadMemoryProvidingName(lldb_private::Process &process, lldb::tid_t tid, lldb::addr_t register_data_addr, llvm::StringRef name)
lldb::addr_t m_register_data_addr
lldb::ThreadSP m_backing_thread_sp
lldb::RegisterContextSP GetRegisterContext() override
void RefreshStateAfterStop() override
lldb::RegisterContextSP CreateRegisterContextForFrame(lldb_private::StackFrame *frame) override
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
~ThreadMemory() override
void WillResume(lldb::StateType resume_state) override
void ClearStackFrames() override
virtual lldb::StopInfoSP CreateThreadStopReason(Thread *thread)=0
A plug-in interface definition class for debugging a process.
Definition Process.h:357
uint32_t GetConcreteFrameIndex() const
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
Definition StackFrame.h:455
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
Definition Thread.cpp:464
virtual void DestroyThread()
Definition Thread.cpp:252
virtual void ClearStackFrames()
Definition Thread.cpp:1453
virtual Unwind & GetUnwinder()
Definition Thread.cpp:1934
friend class OperatingSystem
Definition Thread.h:1304
lldb::ProcessSP GetProcess() const
Definition Thread.h:158
friend class StackFrame
Definition Thread.h:1303
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
Definition Thread.h:1370
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame)
Definition Unwind.h:56
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
StateType
Process and Thread States.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
uint64_t tid_t
Definition lldb-types.h:84