LLDB mainline
NativeThreadWindows.h
Go to the documentation of this file.
1//===-- NativeThreadWindows.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 liblldb_NativeThreadWindows_h_
10#define liblldb_NativeThreadWindows_h_
11
15
17
18namespace lldb_private {
19
21
23public:
25
26 ~NativeThreadWindows() override = default;
27
28 Status DoStop();
29 Status DoResume(lldb::StateType resume_state);
30
31 /// Whether the last DoResume() single-stepped this thread.
32 bool IsSingleStepping() const { return m_single_stepping; }
33
34 /// Called when a stop is reported. Returns true if the single step of the
35 /// last DoResume() moved the PC but its trap was not handled: the kernel
36 /// holds that trap until the thread runs again.
38
40
42 return std::exchange(m_single_step_trap_pending, false);
43 }
44
45 void SetSingleStepFlag();
46
47 std::string GetName() override;
48
49 lldb::StateType GetState() override { return m_state; }
50
54
55 bool GetStopReason(ThreadStopInfo &stop_info,
56 std::string &description) override;
57
58 Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
59 bool hardware) override;
60
62
63 Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
64
66
68
69 void SetStopReason(ThreadStopInfo stop_info, std::string description);
70
72
73protected:
75 std::string m_name;
76 bool m_single_stepping = false;
79 std::unique_ptr<NativeRegisterContextWindows> m_reg_context_up;
80 // Cache address and index of the watchpoints and hardware breakpoints since
81 // the register context does not.
82 using IndexMap = std::map<lldb::addr_t, uint32_t>;
86};
87} // namespace lldb_private
88
89#endif // #ifndef liblldb_NativeThreadWindows_h_
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid)
bool IsSingleStepping() const
Whether the last DoResume() single-stepped this thread.
StructuredData::ObjectSP GetExtendedInfo() const override
Status RemoveWatchpoint(lldb::addr_t addr) override
~NativeThreadWindows() override=default
bool CompleteSingleStepWithoutTrap()
Called when a stop is reported.
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
void SetStopReason(ThreadStopInfo stop_info, std::string description)
Status DoResume(lldb::StateType resume_state)
std::map< lldb::addr_t, uint32_t > IndexMap
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
NativeRegisterContextWindows & GetRegisterContext() override
lldb::StateType GetState() override
NativeThreadWindows(NativeProcessWindows &process, const HostThread &thread)
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
std::unique_ptr< NativeRegisterContextWindows > m_reg_context_up
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
An error handling class.
Definition Status.h:118
std::shared_ptr< Object > ObjectSP
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
StateType
Process and Thread States.
uint64_t addr_t
Definition lldb-types.h:80