1 | //===-- NativeThreadProtocol.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_HOST_COMMON_NATIVETHREADPROTOCOL_H |
10 | #define LLDB_HOST_COMMON_NATIVETHREADPROTOCOL_H |
11 | |
12 | #include <memory> |
13 | |
14 | #include "lldb/Host/Debug.h" |
15 | #include "lldb/Utility/UnimplementedError.h" |
16 | #include "lldb/lldb-private-forward.h" |
17 | #include "lldb/lldb-types.h" |
18 | |
19 | #include "llvm/Support/Error.h" |
20 | #include "llvm/Support/MemoryBuffer.h" |
21 | |
22 | namespace lldb_private { |
23 | // NativeThreadProtocol |
24 | class NativeThreadProtocol { |
25 | public: |
26 | NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid); |
27 | |
28 | virtual ~NativeThreadProtocol() = default; |
29 | |
30 | virtual std::string GetName() = 0; |
31 | |
32 | virtual lldb::StateType GetState() = 0; |
33 | |
34 | virtual NativeRegisterContext &GetRegisterContext() = 0; |
35 | |
36 | virtual bool GetStopReason(ThreadStopInfo &stop_info, |
37 | std::string &description) = 0; |
38 | |
39 | lldb::tid_t GetID() const { return m_tid; } |
40 | |
41 | NativeProcessProtocol &GetProcess() { return m_process; } |
42 | |
43 | // Thread-specific watchpoints |
44 | virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, |
45 | uint32_t watch_flags, bool hardware) = 0; |
46 | |
47 | virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0; |
48 | |
49 | // Thread-specific Hardware Breakpoint routines |
50 | virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; |
51 | |
52 | virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; |
53 | |
54 | virtual llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> |
55 | GetSiginfo() const { |
56 | return llvm::make_error<UnimplementedError>(); |
57 | } |
58 | |
59 | protected: |
60 | NativeProcessProtocol &m_process; |
61 | lldb::tid_t m_tid; |
62 | }; |
63 | } |
64 | |
65 | #endif // LLDB_HOST_COMMON_NATIVETHREADPROTOCOL_H |
66 |