]>
git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/nat/aarch64-linux.c
121542a22d7118762d75d8901d98f967da4c9243
1 /* Copyright (C) 2009-2015 Free Software Foundation, Inc.
2 Contributed by ARM Ltd.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include "common-defs.h"
20 #include "break-common.h"
21 #include "nat/linux-nat.h"
22 #include "nat/aarch64-linux-hw-point.h"
23 #include "nat/aarch64-linux.h"
25 /* Called when resuming a thread LWP.
26 The hardware debug registers are updated when there is any change. */
29 aarch64_linux_prepare_to_resume (struct lwp_info
*lwp
)
31 struct arch_lwp_info
*info
= lwp_arch_private_info (lwp
);
33 /* NULL means this is the main thread still going through the shell,
34 or, no watchpoint has been set yet. In that case, there's
39 if (DR_HAS_CHANGED (info
->dr_changed_bp
)
40 || DR_HAS_CHANGED (info
->dr_changed_wp
))
42 ptid_t ptid
= ptid_of_lwp (lwp
);
43 int tid
= ptid_get_lwp (ptid
);
44 struct aarch64_debug_reg_state
*state
45 = aarch64_get_debug_reg_state (ptid_get_pid (ptid
));
48 debug_printf ("prepare_to_resume thread %d\n", tid
);
51 if (DR_HAS_CHANGED (info
->dr_changed_wp
))
53 aarch64_linux_set_debug_regs (state
, tid
, 1);
54 DR_CLEAR_CHANGED (info
->dr_changed_wp
);
58 if (DR_HAS_CHANGED (info
->dr_changed_bp
))
60 aarch64_linux_set_debug_regs (state
, tid
, 0);
61 DR_CLEAR_CHANGED (info
->dr_changed_bp
);
66 /* Function to call when a new thread is detected. */
69 aarch64_linux_new_thread (struct lwp_info
*lwp
)
71 struct arch_lwp_info
*info
= xcalloc (1, sizeof (*info
));
73 /* Mark that all the hardware breakpoint/watchpoint register pairs
74 for this thread need to be initialized (with data from
75 aarch_process_info.debug_reg_state). */
76 DR_MARK_ALL_CHANGED (info
->dr_changed_bp
, aarch64_num_bp_regs
);
77 DR_MARK_ALL_CHANGED (info
->dr_changed_wp
, aarch64_num_wp_regs
);
79 lwp_set_arch_private_info (lwp
, info
);