Commit | Line | Data |
---|---|---|
9bb9e8ad PM |
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 | |
7 | Free Software Foundation, Inc. | |
8 | ||
9 | This file is part of GDB. | |
10 | ||
11 | This program is free software; you can redistribute it and/or modify | |
12 | it under the terms of the GNU General Public License as published by | |
13 | the Free Software Foundation; either version 3 of the License, or | |
14 | (at your option) any later version. | |
15 | ||
16 | This program is distributed in the hope that it will be useful, | |
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | GNU General Public License for more details. | |
20 | ||
21 | You should have received a copy of the GNU General Public License | |
22 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
23 | ||
24 | #include "defs.h" | |
25 | ||
26 | #ifndef I386_NAT_H | |
27 | #define I386_NAT_H 1 | |
28 | ||
29 | /* Hardware-assisted breakpoints and watchpoints. */ | |
30 | ||
31 | /* Add watchpoint methods to the provided target_ops. | |
32 | Targets using i386 family debug registers for watchpoints should call | |
33 | this. */ | |
34 | struct target_ops; | |
35 | extern void i386_use_watchpoints (struct target_ops *); | |
36 | ||
37 | /* Support for hardware watchpoints and breakpoints using the i386 | |
38 | debug registers. | |
39 | ||
40 | This provides several functions for inserting and removing | |
41 | hardware-assisted breakpoints and watchpoints, testing if one or | |
42 | more of the watchpoints triggered and at what address, checking | |
43 | whether a given region can be watched, etc. | |
44 | ||
45 | In addition, each target should provide several low-level functions | |
46 | regrouped into i386_dr_low_type struct below. These functions | |
47 | that will be called to insert watchpoints and hardware breakpoints | |
48 | into the inferior, remove them, and check their status. These | |
49 | functions are: | |
50 | ||
51 | set_control -- set the debug control (DR7) | |
a79d3c27 | 52 | register to a given value for all LWPs |
9bb9e8ad PM |
53 | |
54 | set_addr -- put an address into one debug | |
a79d3c27 | 55 | register for all LWPs |
9bb9e8ad PM |
56 | |
57 | reset_addr -- reset the address stored in | |
a79d3c27 | 58 | one debug register for all LWPs |
9bb9e8ad PM |
59 | |
60 | get_status -- return the value of the debug | |
a79d3c27 JK |
61 | status (DR6) register for current LWP |
62 | ||
63 | unset_status -- unset the specified bits of the debug | |
64 | status (DR6) register for all LWPs | |
9bb9e8ad PM |
65 | |
66 | Additionally, the native file should set the debug_register_length | |
67 | field to 4 or 8 depending on the number of bytes used for | |
68 | deubg registers. */ | |
69 | ||
70 | struct i386_dr_low_type | |
71 | { | |
72 | void (*set_control) (unsigned long); | |
73 | void (*set_addr) (int, CORE_ADDR); | |
74 | void (*reset_addr) (int); | |
75 | unsigned long (*get_status) (void); | |
a79d3c27 | 76 | void (*unset_status) (unsigned long); |
9bb9e8ad PM |
77 | int debug_register_length; |
78 | }; | |
79 | ||
80 | extern struct i386_dr_low_type i386_dr_low; | |
81 | ||
82 | /* Use this function to set i386_dr_low debug_register_length field | |
83 | rather than setting it directly to check that the length is only | |
84 | set once. It also enables the 'maint set/show show-debug-regs' | |
85 | command. */ | |
86 | ||
87 | extern void i386_set_debug_register_length (int len); | |
88 | ||
89 | /* Use this function to reset the i386-nat.c debug register state. */ | |
90 | ||
91 | extern void i386_cleanup_dregs (void); | |
92 | ||
93 | #endif /* I386_NAT_H */ |