Commit | Line | Data |
---|---|---|
4b134ca1 GB |
1 | /* Native-dependent code for GNU/Linux x86 (i386 and x86-64). |
2 | ||
3 | Copyright (C) 1999-2015 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #include "common-defs.h" | |
21 | #include "x86-linux.h" | |
369f6daa | 22 | #include "x86-linux-dregs.h" |
4b134ca1 GB |
23 | |
24 | /* Per-thread arch-specific data we want to keep. */ | |
25 | ||
26 | struct arch_lwp_info | |
27 | { | |
28 | /* Non-zero if our copy differs from what's recorded in the | |
29 | thread. */ | |
30 | int debug_registers_changed; | |
31 | }; | |
32 | ||
33 | /* See nat/x86-linux.h. */ | |
34 | ||
35 | void | |
36 | lwp_set_debug_registers_changed (struct lwp_info *lwp, int value) | |
37 | { | |
38 | if (lwp_arch_private_info (lwp) == NULL) | |
39 | lwp_set_arch_private_info (lwp, XCNEW (struct arch_lwp_info)); | |
40 | ||
41 | lwp_arch_private_info (lwp)->debug_registers_changed = value; | |
42 | } | |
43 | ||
44 | /* See nat/x86-linux.h. */ | |
45 | ||
46 | int | |
47 | lwp_debug_registers_changed (struct lwp_info *lwp) | |
48 | { | |
49 | struct arch_lwp_info *info = lwp_arch_private_info (lwp); | |
50 | ||
51 | /* NULL means either that this is the main thread still going | |
52 | through the shell, or that no watchpoint has been set yet. | |
53 | The debug registers are unchanged in either case. */ | |
54 | if (info == NULL) | |
55 | return 0; | |
56 | ||
57 | return info->debug_registers_changed; | |
58 | } | |
369f6daa GB |
59 | |
60 | /* See nat/x86-linux.h. */ | |
61 | ||
62 | void | |
63 | x86_linux_new_thread (struct lwp_info *lwp) | |
64 | { | |
65 | lwp_set_debug_registers_changed (lwp, 1); | |
66 | } | |
67 | ||
68 | /* See nat/x86-linux.h. */ | |
69 | ||
70 | void | |
71 | x86_linux_prepare_to_resume (struct lwp_info *lwp) | |
72 | { | |
73 | x86_linux_update_debug_registers (lwp); | |
74 | } |