2004-10-08 Jeff Johnston <jjohnstn@redhat.com>
[deliverable/binutils-gdb.git] / gdb / config / i386 / nm-i386.h
CommitLineData
52b98211 1/* Native macro definitions for GDB on an Intel i[3456]86.
e74f0f02 2 Copyright 2001, 2004 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
8 the Free Software Foundation; either version 2 of the License, or
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
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#ifndef NM_I386_H
22#define NM_I386_H 1
23
52b98211
EZ
24/* Hardware-assisted breakpoints and watchpoints. */
25
26/* Targets should define this to use the generic x86 watchpoint support. */
27#ifdef I386_USE_GENERIC_WATCHPOINTS
28
52b98211
EZ
29/* Clear the reference counts and forget everything we knew about DRi. */
30extern void i386_cleanup_dregs (void);
31
32/* Insert a watchpoint to watch a memory region which starts at
33 address ADDR and whose length is LEN bytes. Watch memory accesses
34 of the type TYPE. Return 0 on success, -1 on failure. */
207e433e 35extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
36
37/* Remove a watchpoint that watched the memory region which starts at
38 address ADDR, whose length is LEN bytes, and for accesses of the
39 type TYPE. Return 0 on success, -1 on failure. */
207e433e 40extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
52b98211
EZ
41
42/* Return non-zero if we can watch a memory region that starts at
43 address ADDR and whose length is LEN bytes. */
207e433e 44extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
52b98211
EZ
45
46/* Return non-zero if the inferior has some break/watchpoint that
47 triggered. */
207e433e 48extern int i386_stopped_by_hwbp (void);
52b98211 49
4aa7a7f5
JJ
50/* If the inferior has some break/watchpoint that triggered, set
51 the address associated with that break/watchpoint and return
52 true. Otherwise, return false. */
53extern int i386_stopped_data_address (CORE_ADDR *);
52b98211
EZ
54
55/* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
56 unused. Return 0 on success, EBUSY on failure. */
207e433e 57extern int i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow);
52b98211
EZ
58
59/* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
207e433e 60 unused. Return 0 on success, -1 on failure. */
52b98211
EZ
61extern int i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow);
62
63/* Returns the number of hardware watchpoints of type TYPE that we can
64 set. Value is positive if we can set CNT watchpoints, zero if
65 setting watchpoints of type TYPE is not supported, and negative if
66 CNT is more than the maximum number of watchpoints of type TYPE
67 that we can support. TYPE is one of bp_hardware_watchpoint,
68 bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
69 CNT is the number of such watchpoints used so far (including this
70 one). OTHERTYPE is non-zero if other types of watchpoints are
71 currently enabled.
72
73 We always return 1 here because we don't have enough information
207e433e
MK
74 about possible overlap of addresses that they want to watch. As an
75 extreme example, consider the case where all the watchpoints watch
76 the same address and the same region length: then we can handle a
77 virtually unlimited number of watchpoints, due to debug register
78 sharing implemented via reference counts in i386-nat.c. */
52b98211
EZ
79
80#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
81
207e433e
MK
82/* Returns non-zero if we can use hardware watchpoints to watch a
83 region whose address is ADDR and whose length is LEN. */
52b98211 84
207e433e
MK
85#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
86 i386_region_ok_for_watchpoint (addr, len)
52b98211
EZ
87
88/* After a watchpoint trap, the PC points to the instruction after the
89 one that caused the trap. Therefore we don't need to step over it.
90 But we do need to reset the status register to avoid another trap. */
91
7df1a324 92#define HAVE_CONTINUABLE_WATCHPOINT 1
52b98211 93
4aa7a7f5 94extern int i386_stopped_by_watchpoint (void);
52b98211 95
4aa7a7f5
JJ
96#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
97
98#define target_stopped_data_address(target, x) i386_stopped_data_address(x)
52b98211
EZ
99
100/* Use these macros for watchpoint insertion/removal. */
101
207e433e 102#define target_insert_watchpoint(addr, len, type) \
52b98211
EZ
103 i386_insert_watchpoint (addr, len, type)
104
207e433e 105#define target_remove_watchpoint(addr, len, type) \
52b98211
EZ
106 i386_remove_watchpoint (addr, len, type)
107
207e433e
MK
108#define target_insert_hw_breakpoint(addr, shadow) \
109 i386_insert_hw_breakpoint (addr, shadow)
52b98211 110
207e433e
MK
111#define target_remove_hw_breakpoint(addr, shadow) \
112 i386_remove_hw_breakpoint (addr, shadow)
52b98211 113
9b4f1ba7
PM
114/* child_post_startup_inferior used to
115 reset all debug registers by calling i386_cleanup_dregs (). */
116#define CHILD_POST_STARTUP_INFERIOR
117
52b98211
EZ
118#endif /* I386_USE_GENERIC_WATCHPOINTS */
119
120#endif /* NM_I386_H */
This page took 0.288155 seconds and 4 git commands to generate.