1 /* Native macro definitions for GDB on an Intel i[3456]86.
2 Copyright 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
24 /* Hardware-assisted breakpoints and watchpoints. */
26 /* Targets should define this to use the generic x86 watchpoint support. */
27 #ifdef I386_USE_GENERIC_WATCHPOINTS
29 #ifndef TARGET_HAS_HARDWARE_WATCHPOINTS
30 #define TARGET_HAS_HARDWARE_WATCHPOINTS
33 /* Clear the reference counts and forget everything we knew about DRi. */
34 extern void i386_cleanup_dregs (void);
36 /* Insert a watchpoint to watch a memory region which starts at
37 address ADDR and whose length is LEN bytes. Watch memory accesses
38 of the type TYPE. Return 0 on success, -1 on failure. */
39 extern int i386_insert_watchpoint (CORE_ADDR addr
, int len
, int type
);
41 /* Remove a watchpoint that watched the memory region which starts at
42 address ADDR, whose length is LEN bytes, and for accesses of the
43 type TYPE. Return 0 on success, -1 on failure. */
44 extern int i386_remove_watchpoint (CORE_ADDR addr
, int len
, int type
);
46 /* Return non-zero if we can watch a memory region that starts at
47 address ADDR and whose length is LEN bytes. */
48 extern int i386_region_ok_for_watchpoint (CORE_ADDR addr
, int len
);
50 /* Return non-zero if the inferior has some break/watchpoint that
52 extern int i386_stopped_by_hwbp (void);
54 /* If the inferior has some break/watchpoint that triggered, return
55 the address associated with that break/watchpoint. Otherwise,
57 extern CORE_ADDR
i386_stopped_data_address (void);
59 /* Insert a hardware-assisted breakpoint at address ADDR. SHADOW is
60 unused. Return 0 on success, EBUSY on failure. */
61 extern int i386_insert_hw_breakpoint (CORE_ADDR addr
, void *shadow
);
63 /* Remove a hardware-assisted breakpoint at address ADDR. SHADOW is
64 unused. Return 0 on success, -1 on failure. */
65 extern int i386_remove_hw_breakpoint (CORE_ADDR addr
, void *shadow
);
67 /* Returns the number of hardware watchpoints of type TYPE that we can
68 set. Value is positive if we can set CNT watchpoints, zero if
69 setting watchpoints of type TYPE is not supported, and negative if
70 CNT is more than the maximum number of watchpoints of type TYPE
71 that we can support. TYPE is one of bp_hardware_watchpoint,
72 bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
73 CNT is the number of such watchpoints used so far (including this
74 one). OTHERTYPE is non-zero if other types of watchpoints are
77 We always return 1 here because we don't have enough information
78 about possible overlap of addresses that they want to watch. As an
79 extreme example, consider the case where all the watchpoints watch
80 the same address and the same region length: then we can handle a
81 virtually unlimited number of watchpoints, due to debug register
82 sharing implemented via reference counts in i386-nat.c. */
84 #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
86 /* Returns non-zero if we can use hardware watchpoints to watch a
87 region whose address is ADDR and whose length is LEN. */
89 #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
90 i386_region_ok_for_watchpoint (addr, len)
92 /* After a watchpoint trap, the PC points to the instruction after the
93 one that caused the trap. Therefore we don't need to step over it.
94 But we do need to reset the status register to avoid another trap. */
96 #define HAVE_CONTINUABLE_WATCHPOINT 1
98 #define STOPPED_BY_WATCHPOINT(W) (i386_stopped_data_address () != 0)
100 #define target_stopped_data_address() i386_stopped_data_address ()
102 /* Use these macros for watchpoint insertion/removal. */
104 #define target_insert_watchpoint(addr, len, type) \
105 i386_insert_watchpoint (addr, len, type)
107 #define target_remove_watchpoint(addr, len, type) \
108 i386_remove_watchpoint (addr, len, type)
110 #define target_insert_hw_breakpoint(addr, shadow) \
111 i386_insert_hw_breakpoint (addr, shadow)
113 #define target_remove_hw_breakpoint(addr, shadow) \
114 i386_remove_hw_breakpoint (addr, shadow)
116 #define DECR_PC_AFTER_HW_BREAK 0
118 /* child_post_startup_inferior used to
119 reset all debug registers by calling i386_cleanup_dregs (). */
120 #define CHILD_POST_STARTUP_INFERIOR
122 #endif /* I386_USE_GENERIC_WATCHPOINTS */
124 #endif /* NM_I386_H */
This page took 0.032256 seconds and 4 git commands to generate.