]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/config/i386/nm-i386.h
Switch the license of all .c files to GPLv3.
[thirdparty/binutils-gdb.git] / gdb / config / i386 / nm-i386.h
CommitLineData
52b98211 1/* Native macro definitions for GDB on an Intel i[3456]86.
6aba47ca 2 Copyright 2001, 2004, 2007 Free Software Foundation, Inc.
52b98211
EZ
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
52b98211
EZ
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
52b98211
EZ
18
19#ifndef NM_I386_H
20#define NM_I386_H 1
21
52b98211
EZ
22/* Hardware-assisted breakpoints and watchpoints. */
23
24/* Targets should define this to use the generic x86 watchpoint support. */
25#ifdef I386_USE_GENERIC_WATCHPOINTS
26
52b98211
EZ
27/* Clear the reference counts and forget everything we knew about DRi. */
28extern void i386_cleanup_dregs (void);
29
30/* Insert a watchpoint to watch a memory region which starts at
31 address ADDR and whose length is LEN bytes. Watch memory accesses
32 of the type TYPE. Return 0 on success, -1 on failure. */
207e433e 33extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
34
35/* Remove a watchpoint that watched the memory region which starts at
36 address ADDR, whose length is LEN bytes, and for accesses of the
37 type TYPE. Return 0 on success, -1 on failure. */
207e433e 38extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
39
40/* Return non-zero if we can watch a memory region that starts at
41 address ADDR and whose length is LEN bytes. */
207e433e 42extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
52b98211
EZ
43
44/* Return non-zero if the inferior has some break/watchpoint that
45 triggered. */
207e433e 46extern int i386_stopped_by_hwbp (void);
52b98211 47
4aa7a7f5
JJ
48/* If the inferior has some break/watchpoint that triggered, set
49 the address associated with that break/watchpoint and return
50 true. Otherwise, return false. */
51extern int i386_stopped_data_address (CORE_ADDR *);
52b98211 52
8181d85f
DJ
53/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
54 Return 0 on success, EBUSY on failure. */
55struct bp_target_info;
56extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
52b98211 57
8181d85f
DJ
58/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
59 Return 0 on success, -1 on failure. */
60extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
52b98211
EZ
61
62/* Returns the number of hardware watchpoints of type TYPE that we can
63 set. Value is positive if we can set CNT watchpoints, zero if
64 setting watchpoints of type TYPE is not supported, and negative if
65 CNT is more than the maximum number of watchpoints of type TYPE
66 that we can support. TYPE is one of bp_hardware_watchpoint,
67 bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
68 CNT is the number of such watchpoints used so far (including this
69 one). OTHERTYPE is non-zero if other types of watchpoints are
70 currently enabled.
71
72 We always return 1 here because we don't have enough information
207e433e
MK
73 about possible overlap of addresses that they want to watch. As an
74 extreme example, consider the case where all the watchpoints watch
75 the same address and the same region length: then we can handle a
76 virtually unlimited number of watchpoints, due to debug register
77 sharing implemented via reference counts in i386-nat.c. */
52b98211
EZ
78
79#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
80
207e433e
MK
81/* Returns non-zero if we can use hardware watchpoints to watch a
82 region whose address is ADDR and whose length is LEN. */
52b98211 83
207e433e
MK
84#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
85 i386_region_ok_for_watchpoint (addr, len)
52b98211
EZ
86
87/* After a watchpoint trap, the PC points to the instruction after the
88 one that caused the trap. Therefore we don't need to step over it.
89 But we do need to reset the status register to avoid another trap. */
90
7df1a324 91#define HAVE_CONTINUABLE_WATCHPOINT 1
52b98211 92
4aa7a7f5 93extern int i386_stopped_by_watchpoint (void);
52b98211 94
4aa7a7f5
JJ
95#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
96
97#define target_stopped_data_address(target, x) i386_stopped_data_address(x)
52b98211
EZ
98
99/* Use these macros for watchpoint insertion/removal. */
100
207e433e 101#define target_insert_watchpoint(addr, len, type) \
52b98211
EZ
102 i386_insert_watchpoint (addr, len, type)
103
207e433e 104#define target_remove_watchpoint(addr, len, type) \
52b98211
EZ
105 i386_remove_watchpoint (addr, len, type)
106
8181d85f
DJ
107#define target_insert_hw_breakpoint(bp_tgt) \
108 i386_insert_hw_breakpoint (bp_tgt)
52b98211 109
8181d85f
DJ
110#define target_remove_hw_breakpoint(bp_tgt) \
111 i386_remove_hw_breakpoint (bp_tgt)
52b98211 112
9b4f1ba7
PM
113/* child_post_startup_inferior used to
114 reset all debug registers by calling i386_cleanup_dregs (). */
115#define CHILD_POST_STARTUP_INFERIOR
116
52b98211
EZ
117#endif /* I386_USE_GENERIC_WATCHPOINTS */
118
119#endif /* NM_I386_H */