]> Git Repo - binutils.git/blob - gdb/aarch64-nat.h
Automatic date update in version.in
[binutils.git] / gdb / aarch64-nat.h
1 /* Native-dependent code for AArch64.
2
3    Copyright (C) 2011-2022 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 #ifndef AARCH64_NAT_H
21 #define AARCH64_NAT_H
22
23 #include "breakpoint.h"
24 #include "nat/aarch64-hw-point.h"
25 #include "target.h"
26
27 /* Hardware-assisted breakpoints and watchpoints.  */
28
29 /* Initialize platform-independent state for hardware-assisted
30    breakpoints and watchpoints.  */
31
32 void aarch64_initialize_hw_point ();
33
34 /* Return the debug register state for process PID.  If no existing
35    state is found for this process, return nullptr.  */
36
37 struct aarch64_debug_reg_state *aarch64_lookup_debug_reg_state (pid_t pid);
38
39 /* Return the debug register state for process PID.  If no existing
40    state is found for this process, create new state.  */
41
42 struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid);
43
44 /* Remove any existing per-process debug state for process PID.  */
45
46 void aarch64_remove_debug_reg_state (pid_t pid);
47
48 /* Helper for the "stopped_data_address" target method.  Returns TRUE
49    if a hardware watchpoint trap at ADDR_TRAP matches a set
50    watchpoint.  The address of the matched watchpoint is returned in
51    *ADDR_P.  */
52
53 bool aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
54                                    CORE_ADDR addr_trap, CORE_ADDR *addr_p);
55
56 /* Helper functions used by aarch64_nat_target below.  See their
57    definitions.  */
58
59 int aarch64_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype);
60 int aarch64_insert_watchpoint (CORE_ADDR addr, int len,
61                                enum target_hw_bp_type type,
62                                struct expression *cond);
63 int aarch64_remove_watchpoint (CORE_ADDR addr, int len,
64                                enum target_hw_bp_type type,
65                                struct expression *cond);
66 int aarch64_insert_hw_breakpoint (struct gdbarch *gdbarch,
67                                   struct bp_target_info *bp_tgt);
68 int aarch64_remove_hw_breakpoint (struct gdbarch *gdbarch,
69                                   struct bp_target_info *bp_tgt);
70 int aarch64_stopped_by_hw_breakpoint ();
71
72 /* Convenience template mixin used to add aarch64 watchpoints support to a
73    target.  */
74
75 template <typename BaseTarget>
76 struct aarch64_nat_target : public BaseTarget
77 {
78   /* Hook in common aarch64 hardware watchpoints/breakpoints support.  */
79
80   int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
81   { return aarch64_can_use_hw_breakpoint (type, cnt, othertype); }
82
83   int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override
84   { return aarch64_region_ok_for_watchpoint (addr, len); }
85
86   int insert_watchpoint (CORE_ADDR addr, int len,
87                          enum target_hw_bp_type type,
88                          struct expression *cond) override
89   { return aarch64_insert_watchpoint (addr, len, type, cond); }
90
91   int remove_watchpoint (CORE_ADDR addr, int len,
92                          enum target_hw_bp_type type,
93                          struct expression *cond) override
94   { return aarch64_remove_watchpoint (addr, len, type, cond); }
95
96   int insert_hw_breakpoint (struct gdbarch *gdbarch,
97                             struct bp_target_info *bp_tgt) override
98   { return aarch64_insert_hw_breakpoint (gdbarch, bp_tgt); }
99
100   int remove_hw_breakpoint (struct gdbarch *gdbarch,
101                             struct bp_target_info *bp_tgt) override
102   { return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt); }
103
104   bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
105                                      int length) override
106   { return start <= addr && start + length - 1 >= addr; }
107 };
108
109 #endif /* AARCH64_NAT_H */
This page took 0.030813 seconds and 4 git commands to generate.