1 /* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
3 Copyright (C) 1999-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #include "gdbsupport/common-defs.h"
21 #include "x86-linux.h"
22 #include "x86-linux-dregs.h"
24 /* Per-thread arch-specific data we want to keep. */
28 /* Non-zero if our copy differs from what's recorded in the
30 int debug_registers_changed
;
33 /* See nat/x86-linux.h. */
36 lwp_set_debug_registers_changed (struct lwp_info
*lwp
, int value
)
38 if (lwp_arch_private_info (lwp
) == NULL
)
39 lwp_set_arch_private_info (lwp
, XCNEW (struct arch_lwp_info
));
41 lwp_arch_private_info (lwp
)->debug_registers_changed
= value
;
44 /* See nat/x86-linux.h. */
47 lwp_debug_registers_changed (struct lwp_info
*lwp
)
49 struct arch_lwp_info
*info
= lwp_arch_private_info (lwp
);
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. */
57 return info
->debug_registers_changed
;
60 /* See nat/x86-linux.h. */
63 x86_linux_new_thread (struct lwp_info
*lwp
)
65 lwp_set_debug_registers_changed (lwp
, 1);
68 /* See nat/x86-linux.h. */
71 x86_linux_delete_thread (struct arch_lwp_info
*arch_lwp
)
76 /* See nat/x86-linux.h. */
79 x86_linux_prepare_to_resume (struct lwp_info
*lwp
)
81 x86_linux_update_debug_registers (lwp
);