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