Commit | Line | Data |
---|---|---|
578c1c03 MK |
1 | /* Native-dependent code for FreeBSD. |
2 | ||
3666a048 | 3 | Copyright (C) 2004-2021 Free Software Foundation, Inc. |
578c1c03 MK |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
578c1c03 MK |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
578c1c03 MK |
19 | |
20 | #ifndef FBSD_NAT_H | |
21 | #define FBSD_NAT_H | |
22 | ||
d55e5aa6 | 23 | #include "inf-ptrace.h" |
ddce1758 | 24 | #include <osreldate.h> |
4de283e4 | 25 | #include <sys/proc.h> |
d55e5aa6 | 26 | |
ddce1758 JB |
27 | /* FreeBSD kernels 11.3 and later report valid si_code values for |
28 | SIGTRAP on all architectures. Older FreeBSD kernels that supported | |
29 | TRAP_BRKPT did not report valid values for MIPS and sparc64. Even | |
30 | older kernels without TRAP_BRKPT support did not report valid | |
31 | values on any architecture. */ | |
32 | #if (__FreeBSD_kernel_version >= 1102502) || (__FreeBSD_version >= 1102502) | |
33 | # define USE_SIGTRAP_SIGINFO | |
34 | #elif defined(TRAP_BRKPT) | |
f6ac5f3d PA |
35 | # if !defined(__mips__) && !defined(__sparc64__) |
36 | # define USE_SIGTRAP_SIGINFO | |
37 | # endif | |
38 | #endif | |
39 | ||
40 | /* A prototype FreeBSD target. */ | |
41 | ||
42 | class fbsd_nat_target : public inf_ptrace_target | |
43 | { | |
44 | public: | |
45 | char *pid_to_exec_file (int pid) override; | |
46 | ||
bd583225 | 47 | int find_memory_regions (find_memory_region_ftype func, void *data) override; |
f6ac5f3d | 48 | |
bd583225 | 49 | bool info_proc (const char *, enum info_proc_what) override; |
f6ac5f3d | 50 | |
f6ac5f3d PA |
51 | enum target_xfer_status xfer_partial (enum target_object object, |
52 | const char *annex, | |
53 | gdb_byte *readbuf, | |
54 | const gdb_byte *writebuf, | |
55 | ULONGEST offset, ULONGEST len, | |
56 | ULONGEST *xfered_len) override; | |
f6ac5f3d | 57 | |
57810aa7 | 58 | bool thread_alive (ptid_t ptid) override; |
a068643d | 59 | std::string pid_to_str (ptid_t) override; |
f6ac5f3d PA |
60 | |
61 | #ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME | |
62 | const char *thread_name (struct thread_info *) override; | |
63 | #endif | |
64 | ||
65 | void update_thread_list () override; | |
66 | ||
67 | thread_control_capabilities get_thread_control_capabilities () override | |
68 | { return tc_schedlock; } | |
69 | ||
70 | void resume (ptid_t, int, enum gdb_signal) override; | |
71 | ||
b60cea74 | 72 | ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override; |
f6ac5f3d PA |
73 | |
74 | void post_startup_inferior (ptid_t) override; | |
75 | void post_attach (int) override; | |
76 | ||
77 | #ifdef USE_SIGTRAP_SIGINFO | |
57810aa7 PA |
78 | bool supports_stopped_by_sw_breakpoint () override; |
79 | bool stopped_by_sw_breakpoint () override; | |
f6ac5f3d PA |
80 | #endif |
81 | ||
82 | #ifdef TDP_RFPPWAIT | |
e97007b6 | 83 | void follow_fork (bool, bool) override; |
f6ac5f3d PA |
84 | |
85 | int insert_fork_catchpoint (int) override; | |
86 | int remove_fork_catchpoint (int) override; | |
87 | ||
88 | int insert_vfork_catchpoint (int) override; | |
89 | int remove_vfork_catchpoint (int) override; | |
90 | #endif | |
91 | ||
f6ac5f3d PA |
92 | int insert_exec_catchpoint (int) override; |
93 | int remove_exec_catchpoint (int) override; | |
f6ac5f3d PA |
94 | |
95 | #ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE | |
96 | int set_syscall_catchpoint (int, bool, int, gdb::array_view<const int>) | |
97 | override; | |
98 | #endif | |
54904d81 JB |
99 | |
100 | bool supports_multi_process () override; | |
f6ac5f3d | 101 | }; |
578c1c03 | 102 | |
578c1c03 | 103 | #endif /* fbsd-nat.h */ |