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 | ||
ecd75fc8 | 6 | Copyright (C) 2009-2014 Free Software Foundation, Inc. |
9bb9e8ad PM |
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 | ||
9bb9e8ad PM |
23 | #ifndef I386_NAT_H |
24 | #define I386_NAT_H 1 | |
25 | ||
b9228891 GB |
26 | #include "nat/i386-dregs.h" |
27 | ||
9bb9e8ad PM |
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 | ||
b9228891 | 39 | Each target should provide several low-level functions |
1777feb0 | 40 | regrouped into i386_dr_low_type struct below. These functions |
9bb9e8ad PM |
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) | |
a79d3c27 | 46 | register to a given value for all LWPs |
9bb9e8ad PM |
47 | |
48 | set_addr -- put an address into one debug | |
a79d3c27 | 49 | register for all LWPs |
9bb9e8ad | 50 | |
7b50312a PA |
51 | get_addr -- return the address in a given debug |
52 | register of the current LWP | |
9bb9e8ad PM |
53 | |
54 | get_status -- return the value of the debug | |
a79d3c27 JK |
55 | status (DR6) register for current LWP |
56 | ||
7b50312a PA |
57 | get_control -- return the value of the debug |
58 | control (DR7) register for current LWP | |
9bb9e8ad PM |
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 | ||
7b50312a | 64 | struct i386_dr_low_type |
9bb9e8ad PM |
65 | { |
66 | void (*set_control) (unsigned long); | |
67 | void (*set_addr) (int, CORE_ADDR); | |
7b50312a | 68 | CORE_ADDR (*get_addr) (int); |
9bb9e8ad | 69 | unsigned long (*get_status) (void); |
7b50312a | 70 | unsigned long (*get_control) (void); |
9bb9e8ad PM |
71 | int debug_register_length; |
72 | }; | |
73 | ||
74 | extern struct i386_dr_low_type i386_dr_low; | |
75 | ||
76 | /* Use this function to set i386_dr_low debug_register_length field | |
77 | rather than setting it directly to check that the length is only | |
78 | set once. It also enables the 'maint set/show show-debug-regs' | |
79 | command. */ | |
80 | ||
81 | extern void i386_set_debug_register_length (int len); | |
82 | ||
83 | /* Use this function to reset the i386-nat.c debug register state. */ | |
84 | ||
85 | extern void i386_cleanup_dregs (void); | |
86 | ||
26cb8b7c PA |
87 | /* Return a pointer to the local mirror of the debug registers of |
88 | process PID. */ | |
7b50312a | 89 | |
26cb8b7c PA |
90 | extern struct i386_debug_reg_state *i386_debug_reg_state (pid_t pid); |
91 | ||
92 | /* Called whenever GDB is no longer debugging process PID. It deletes | |
93 | data structures that keep track of debug register state. */ | |
94 | ||
95 | extern void i386_forget_process (pid_t pid); | |
7b50312a | 96 | |
9bb9e8ad | 97 | #endif /* I386_NAT_H */ |