• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- NativeRegisterContextWindows_i386.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 #if defined(__i386__) || defined(_M_IX86)
10 #ifndef liblldb_NativeRegisterContextWindows_i386_h_
11 #define liblldb_NativeRegisterContextWindows_i386_h_
12 
13 #include "Plugins/Process/Utility/RegisterContext_x86.h"
14 #include "Plugins/Process/Utility/lldb-x86-register-enums.h"
15 
16 #include "NativeRegisterContextWindows.h"
17 
18 namespace lldb_private {
19 
20 class NativeThreadWindows;
21 
22 class NativeRegisterContextWindows_i386 : public NativeRegisterContextWindows {
23 public:
24   NativeRegisterContextWindows_i386(const ArchSpec &target_arch,
25                                     NativeThreadProtocol &native_thread);
26 
27   uint32_t GetRegisterSetCount() const override;
28 
29   const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
30 
31   Status ReadRegister(const RegisterInfo *reg_info,
32                       RegisterValue &reg_value) override;
33 
34   Status WriteRegister(const RegisterInfo *reg_info,
35                        const RegisterValue &reg_value) override;
36 
37   Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
38 
39   Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
40 
41   Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
42 
43   Status GetWatchpointHitIndex(uint32_t &wp_index,
44                                lldb::addr_t trap_addr) override;
45 
46   Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override;
47 
48   bool ClearHardwareWatchpoint(uint32_t wp_index) override;
49 
50   Status ClearAllHardwareWatchpoints() override;
51 
52   uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
53                                  uint32_t watch_flags) override;
54 
55   lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override;
56 
57   uint32_t NumSupportedHardwareWatchpoints() override;
58 
59 protected:
60   Status GPRRead(const uint32_t reg, RegisterValue &reg_value);
61   Status GPRWrite(const uint32_t reg, const RegisterValue &reg_value);
62 
63   Status DRRead(const uint32_t reg, RegisterValue &reg_value);
64   Status DRWrite(const uint32_t reg, const RegisterValue &reg_value);
65 
66 private:
67   Status ApplyHardwareBreakpoint(uint32_t wp_index, lldb::addr_t addr,
68                                  size_t size, uint32_t flags);
69 
70   bool IsGPR(uint32_t reg_index) const;
71   bool IsDR(uint32_t reg_index) const;
72 };
73 
74 } // namespace lldb_private
75 
76 #endif // liblldb_NativeRegisterContextWindows_i386_h_
77 #endif // defined(__i386__) || defined(_M_IX86)
78