GDBserver

x86-linux.c
Go to the documentation of this file.
1 /* Native-dependent code for GNU/Linux x86 (i386 and x86-64).
2
3 Copyright (C) 1999-2018 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"
22 #include "x86-linux-dregs.h"
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 }
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_delete_thread (struct arch_lwp_info *arch_lwp)
72 {
73 xfree (arch_lwp);
74 }
75
76 /* See nat/x86-linux.h. */
77
78 void
79 x86_linux_prepare_to_resume (struct lwp_info *lwp)
80 {
81 x86_linux_update_debug_registers (lwp);
82 }
xfree
static void xfree(T *ptr)
Definition: common-utils.h:54
x86_linux_update_debug_registers
void x86_linux_update_debug_registers(struct lwp_info *lwp)
Definition: x86-linux-dregs.c:141
lwp_info
Definition: linux-low.h:276
x86-linux.h
arch_lwp_info::debug_registers_changed
int debug_registers_changed
Definition: x86-linux.c:30
x86_linux_new_thread
void x86_linux_new_thread(struct lwp_info *lwp)
Definition: x86-linux.c:63
lwp_debug_registers_changed
int lwp_debug_registers_changed(struct lwp_info *lwp)
Definition: x86-linux.c:47
arch_lwp_info
Definition: linux-arm-low.c:113
lwp_set_debug_registers_changed
void lwp_set_debug_registers_changed(struct lwp_info *lwp, int value)
Definition: x86-linux.c:36
common-defs.h
x86-linux-dregs.h
x86_linux_delete_thread
void x86_linux_delete_thread(struct arch_lwp_info *arch_lwp)
Definition: x86-linux.c:71
XCNEW
#define XCNEW(T)
Definition: poison.h:121
lwp_set_arch_private_info
void lwp_set_arch_private_info(struct lwp_info *lwp, struct arch_lwp_info *info)
Definition: linux-low.c:152
lwp_arch_private_info
struct arch_lwp_info * lwp_arch_private_info(struct lwp_info *lwp)
Definition: linux-low.c:161
x86_linux_prepare_to_resume
void x86_linux_prepare_to_resume(struct lwp_info *lwp)
Definition: x86-linux.c:79