]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/x86-nat.h
Remove old lint code
[thirdparty/binutils-gdb.git] / gdb / x86-nat.h
CommitLineData
df7e5265 1/* Native-dependent code for x86 (i386 and x86-64).
9bb9e8ad
PM
2
3 Low level functions to implement Oeprating System specific
df7e5265 4 code to manipulate x86 debug registers.
9bb9e8ad 5
e2882c85 6 Copyright (C) 2009-2018 Free Software Foundation, Inc.
9bb9e8ad
PM
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22
df7e5265
GB
23#ifndef X86_NAT_H
24#define X86_NAT_H 1
9bb9e8ad 25
f6ac5f3d 26#include "breakpoint.h"
df7e5265 27#include "nat/x86-dregs.h"
f6ac5f3d 28#include "target.h"
b9228891 29
9bb9e8ad
PM
30/* Hardware-assisted breakpoints and watchpoints. */
31
df7e5265 32/* Use this function to set x86_dr_low debug_register_length field
9bb9e8ad
PM
33 rather than setting it directly to check that the length is only
34 set once. It also enables the 'maint set/show show-debug-regs'
35 command. */
36
df7e5265 37extern void x86_set_debug_register_length (int len);
9bb9e8ad 38
df7e5265 39/* Use this function to reset the x86-nat.c debug register state. */
9bb9e8ad 40
df7e5265 41extern void x86_cleanup_dregs (void);
9bb9e8ad 42
26cb8b7c
PA
43/* Called whenever GDB is no longer debugging process PID. It deletes
44 data structures that keep track of debug register state. */
45
df7e5265 46extern void x86_forget_process (pid_t pid);
7b50312a 47
f6ac5f3d
PA
48/* Helper functions used by x86_nat_target below. See their
49 definitions. */
50
51extern int x86_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype);
52extern int x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len);
53extern int x86_stopped_by_watchpoint ();
54extern int x86_stopped_data_address (CORE_ADDR *addr_p);
55extern int x86_insert_watchpoint (CORE_ADDR addr, int len,
56 enum target_hw_bp_type type,
57 struct expression *cond);
58extern int x86_remove_watchpoint (CORE_ADDR addr, int len,
59 enum target_hw_bp_type type,
60 struct expression *cond);
61extern int x86_insert_hw_breakpoint (struct gdbarch *gdbarch,
62 struct bp_target_info *bp_tgt);
63extern int x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
64 struct bp_target_info *bp_tgt);
65extern int x86_stopped_by_hw_breakpoint ();
66
67/* Convenience template mixin used to add x86 watchpoints support to a
68 target. */
69
70template <typename BaseTarget>
71struct x86_nat_target : public BaseTarget
72{
73 /* Hook in the x86 hardware watchpoints/breakpoints support. */
74
75 /* After a watchpoint trap, the PC points to the instruction after
76 the one that caused the trap. Therefore we don't need to step
77 over it. But we do need to reset the status register to avoid
78 another trap. */
79 bool have_continuable_watchpoint () override
80 { return true; }
81
82 int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
83 { return x86_can_use_hw_breakpoint (type, cnt, othertype); }
84
85 int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override
86 { return x86_region_ok_for_hw_watchpoint (addr, len); }
87
88 int insert_watchpoint (CORE_ADDR addr, int len,
89 enum target_hw_bp_type type,
90 struct expression *cond) override
91 { return x86_insert_watchpoint (addr, len, type, cond); }
92
93 int remove_watchpoint (CORE_ADDR addr, int len,
94 enum target_hw_bp_type type,
95 struct expression *cond) override
96 { return x86_remove_watchpoint (addr, len, type, cond); }
97
98 int insert_hw_breakpoint (struct gdbarch *gdbarch,
99 struct bp_target_info *bp_tgt) override
100 { return x86_insert_hw_breakpoint (gdbarch, bp_tgt); }
101
102 int remove_hw_breakpoint (struct gdbarch *gdbarch,
103 struct bp_target_info *bp_tgt) override
104 { return x86_remove_hw_breakpoint (gdbarch, bp_tgt); }
105
57810aa7 106 bool stopped_by_watchpoint () override
f6ac5f3d
PA
107 { return x86_stopped_by_watchpoint (); }
108
57810aa7 109 bool stopped_data_address (CORE_ADDR *addr_p) override
f6ac5f3d
PA
110 { return x86_stopped_data_address (addr_p); }
111
112 /* A target must provide an implementation of the
113 "supports_stopped_by_hw_breakpoint" target method before this
114 callback will be used. */
57810aa7 115 bool stopped_by_hw_breakpoint () override
f6ac5f3d
PA
116 { return x86_stopped_by_hw_breakpoint (); }
117};
118
df7e5265 119#endif /* X86_NAT_H */