GDB (xrefs)
Loading...
Searching...
No Matches
x86-fbsd-nat.c
Go to the documentation of this file.
1/* Native-dependent code for FreeBSD x86.
2
3 Copyright (C) 2022-2023 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 "defs.h"
21#include "x86-fbsd-nat.h"
22#ifdef PT_GETXSTATE_INFO
23#include "nat/x86-xstate.h"
24#endif
25
26/* Implement the virtual fbsd_nat_target::low_new_fork method. */
27
28void
29x86_fbsd_nat_target::low_new_fork (ptid_t parent, pid_t child)
30{
32
33 /* If there is no parent state, no watchpoints nor breakpoints have
34 been set, so there is nothing to do. */
36 if (parent_state == nullptr)
37 return;
38
39 /* The kernel clears debug registers in the new child process after
40 fork, but GDB core assumes the child inherits the watchpoints/hw
41 breakpoints of the parent, and will remove them all from the
42 forked off process. Copy the debug registers mirrors into the
43 new process so that all breakpoints and watchpoints can be
44 removed together. */
45
48}
49
50#ifdef PT_GETXSTATE_INFO
51void
53{
55 return;
56
57 m_xsave_probed = true;
58
60 sizeof (m_xsave_info)) != 0)
61 return;
62 if (m_xsave_info.xsave_len != 0)
63 m_xsave_layout = x86_fetch_xsave_layout (m_xsave_info.xsave_mask,
64 m_xsave_info.xsave_len);
65}
66#endif
bool fetch_register_set(struct regcache *regcache, int regnum, int fetch_op, const struct regset *regset, int regbase, void *regs, size_t size)
Definition fbsd-nat.c:2336
void low_new_fork(ptid_t parent, pid_t child) override
#define ptrace(request, pid, addr, data)
Definition gdb_ptrace.h:141
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
Definition gnu-nat.c:1791
#define PTRACE_TYPE_ARG3
struct x86_debug_reg_state * x86_debug_reg_state(pid_t pid)
Definition x86-nat.c:64
struct x86_debug_reg_state * x86_lookup_debug_reg_state(pid_t pid)
Definition x86-nat.c:52
x86_xsave_layout x86_fetch_xsave_layout(uint64_t xcr0, int len)
Definition x86-xstate.c:55