Move macros from i386-{nat,low}.c to i386-{nat,low}.h
[deliverable/binutils-gdb.git] / gdb / i386-nat.h
1 /* Native-dependent code for the i386.
2
3 Low level functions to implement Oeprating System specific
4 code to manipulate I386 debug registers.
5
6 Copyright (C) 2009-2014 Free Software Foundation, Inc.
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
23 #ifndef I386_NAT_H
24 #define I386_NAT_H 1
25
26 #include "nat/i386-dregs.h"
27
28 /* Hardware-assisted breakpoints and watchpoints. */
29
30 /* Add watchpoint methods to the provided target_ops.
31 Targets using i386 family debug registers for watchpoints should call
32 this. */
33 struct target_ops;
34 extern void i386_use_watchpoints (struct target_ops *);
35
36 /* Support for hardware watchpoints and breakpoints using the i386
37 debug registers.
38
39 Each target should provide several low-level functions
40 regrouped into i386_dr_low_type struct below. These functions
41 that will be called to insert watchpoints and hardware breakpoints
42 into the inferior, remove them, and check their status. These
43 functions are:
44
45 set_control -- set the debug control (DR7)
46 register to a given value for all LWPs
47
48 set_addr -- put an address into one debug
49 register for all LWPs
50
51 get_addr -- return the address in a given debug
52 register of the current LWP
53
54 get_status -- return the value of the debug
55 status (DR6) register for current LWP
56
57 get_control -- return the value of the debug
58 control (DR7) register for current LWP
59
60 Additionally, the native file should set the debug_register_length
61 field to 4 or 8 depending on the number of bytes used for
62 deubg registers. */
63
64 struct i386_dr_low_type
65 {
66 void (*set_control) (unsigned long);
67 void (*set_addr) (int, CORE_ADDR);
68 CORE_ADDR (*get_addr) (int);
69 unsigned long (*get_status) (void);
70 unsigned long (*get_control) (void);
71 int debug_register_length;
72 };
73
74 extern struct i386_dr_low_type i386_dr_low;
75
76 /* Can we update the inferior's debug registers? */
77 #define i386_dr_low_can_set_addr() (i386_dr_low.set_addr != NULL)
78
79 /* Update the inferior's debug register REGNUM from STATE. */
80 #define i386_dr_low_set_addr(new_state, i) \
81 (i386_dr_low.set_addr ((i), (new_state)->dr_mirror[(i)]))
82
83 /* Return the inferior's debug register REGNUM. */
84 #define i386_dr_low_get_addr(i) (i386_dr_low.get_addr ((i)))
85
86 /* Can we update the inferior's DR7 control register? */
87 #define i386_dr_low_can_set_control() (i386_dr_low.set_control != NULL)
88
89 /* Update the inferior's DR7 debug control register from STATE. */
90 #define i386_dr_low_set_control(new_state) \
91 (i386_dr_low.set_control ((new_state)->dr_control_mirror))
92
93 /* Return the value of the inferior's DR7 debug control register. */
94 #define i386_dr_low_get_control() (i386_dr_low.get_control ())
95
96 /* Return the value of the inferior's DR6 debug status register. */
97 #define i386_dr_low_get_status() (i386_dr_low.get_status ())
98
99 /* Return the debug register size, in bytes. */
100 #define i386_get_debug_register_length() \
101 (i386_dr_low.debug_register_length)
102
103 /* Use this function to set i386_dr_low debug_register_length field
104 rather than setting it directly to check that the length is only
105 set once. It also enables the 'maint set/show show-debug-regs'
106 command. */
107
108 extern void i386_set_debug_register_length (int len);
109
110 /* Use this function to reset the i386-nat.c debug register state. */
111
112 extern void i386_cleanup_dregs (void);
113
114 /* Return a pointer to the local mirror of the debug registers of
115 process PID. */
116
117 extern struct i386_debug_reg_state *i386_debug_reg_state (pid_t pid);
118
119 /* Called whenever GDB is no longer debugging process PID. It deletes
120 data structures that keep track of debug register state. */
121
122 extern void i386_forget_process (pid_t pid);
123
124 #endif /* I386_NAT_H */
This page took 0.037896 seconds and 5 git commands to generate.