Updated copyright notices for most files.
[deliverable/binutils-gdb.git] / gdb / config / i386 / nm-i386.h
CommitLineData
52b98211 1/* Native macro definitions for GDB on an Intel i[3456]86.
0fb0cc75 2 Copyright 2001, 2004, 2007, 2008, 2009 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
c03374d5
DJ
27/* Add watchpoint methods to the provided target_ops. Targets which call
28 this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR. */
29struct target_ops;
30void i386_use_watchpoints (struct target_ops *);
31
52b98211
EZ
32/* Clear the reference counts and forget everything we knew about DRi. */
33extern void i386_cleanup_dregs (void);
34
35/* Insert a watchpoint to watch a memory region which starts at
36 address ADDR and whose length is LEN bytes. Watch memory accesses
37 of the type TYPE. Return 0 on success, -1 on failure. */
207e433e 38extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
39
40/* Remove a watchpoint that watched the memory region which starts at
41 address ADDR, whose length is LEN bytes, and for accesses of the
42 type TYPE. Return 0 on success, -1 on failure. */
207e433e 43extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
44
45/* Return non-zero if we can watch a memory region that starts at
46 address ADDR and whose length is LEN bytes. */
207e433e 47extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
52b98211
EZ
48
49/* Return non-zero if the inferior has some break/watchpoint that
50 triggered. */
207e433e 51extern int i386_stopped_by_hwbp (void);
52b98211 52
4aa7a7f5
JJ
53/* If the inferior has some break/watchpoint that triggered, set
54 the address associated with that break/watchpoint and return
55 true. Otherwise, return false. */
c03374d5 56extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
52b98211 57
8181d85f
DJ
58/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
59 Return 0 on success, EBUSY on failure. */
60struct bp_target_info;
61extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
52b98211 62
8181d85f
DJ
63/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
64 Return 0 on success, -1 on failure. */
65extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
52b98211 66
c03374d5
DJ
67extern int i386_stopped_by_watchpoint (void);
68
69#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR
70
52b98211
EZ
71/* Returns the number of hardware watchpoints of type TYPE that we can
72 set. Value is positive if we can set CNT watchpoints, zero if
73 setting watchpoints of type TYPE is not supported, and negative if
74 CNT is more than the maximum number of watchpoints of type TYPE
75 that we can support. TYPE is one of bp_hardware_watchpoint,
76 bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
77 CNT is the number of such watchpoints used so far (including this
78 one). OTHERTYPE is non-zero if other types of watchpoints are
79 currently enabled.
80
81 We always return 1 here because we don't have enough information
207e433e
MK
82 about possible overlap of addresses that they want to watch. As an
83 extreme example, consider the case where all the watchpoints watch
84 the same address and the same region length: then we can handle a
85 virtually unlimited number of watchpoints, due to debug register
86 sharing implemented via reference counts in i386-nat.c. */
52b98211
EZ
87
88#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
89
207e433e
MK
90/* Returns non-zero if we can use hardware watchpoints to watch a
91 region whose address is ADDR and whose length is LEN. */
52b98211 92
207e433e
MK
93#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
94 i386_region_ok_for_watchpoint (addr, len)
52b98211
EZ
95
96/* After a watchpoint trap, the PC points to the instruction after the
97 one that caused the trap. Therefore we don't need to step over it.
98 But we do need to reset the status register to avoid another trap. */
99
7df1a324 100#define HAVE_CONTINUABLE_WATCHPOINT 1
52b98211 101
4aa7a7f5
JJ
102#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
103
c03374d5
DJ
104#define target_stopped_data_address(target, x) \
105 i386_stopped_data_address(target, x)
52b98211
EZ
106
107/* Use these macros for watchpoint insertion/removal. */
108
207e433e 109#define target_insert_watchpoint(addr, len, type) \
52b98211
EZ
110 i386_insert_watchpoint (addr, len, type)
111
207e433e 112#define target_remove_watchpoint(addr, len, type) \
52b98211
EZ
113 i386_remove_watchpoint (addr, len, type)
114
8181d85f
DJ
115#define target_insert_hw_breakpoint(bp_tgt) \
116 i386_insert_hw_breakpoint (bp_tgt)
52b98211 117
8181d85f
DJ
118#define target_remove_hw_breakpoint(bp_tgt) \
119 i386_remove_hw_breakpoint (bp_tgt)
52b98211 120
c03374d5
DJ
121#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */
122
52b98211
EZ
123#endif /* I386_USE_GENERIC_WATCHPOINTS */
124
125#endif /* NM_I386_H */
This page took 0.485616 seconds and 4 git commands to generate.