2013-12-03 12:35:35 +01:00
|
|
|
/* Target-dependent code for FreeBSD, architecture independent.
|
|
|
|
|
2019-01-01 07:01:51 +01:00
|
|
|
Copyright (C) 2009-2019 Free Software Foundation, Inc.
|
2013-12-03 12:35:35 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef FBSD_TDEP_H
|
|
|
|
#define FBSD_TDEP_H
|
|
|
|
|
|
|
|
extern void fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
|
|
|
|
|
Add support for 'info proc files' on FreeBSD core dumps.
Walk the list of struct kinfo_file objects in the
NT_FREEBSD_PROCSTAT_FILES core dump note outputting a description of
each open file descriptor. For sockets, the local and remote socket
addresses are displayed in place of the file name field. For UNIX
local domain sockets, only a single address is displayed since most
UNIX sockets only have one valid address and printing both pathnames
could be quite long. The output format was somewhat inspired by the
output of the "procstat -f" command on FreeBSD, but with a few less
details and some fields were condensed.
gdb/ChangeLog:
* fbsd-tdep.c (KF_FLAGS, KF_OFFSET, KF_VNODE_TYPE, KF_SOCK_DOMAIN)
(KF_SOCK_TYPE, KF_SOCK_PROTOCOL, KF_SA_LOCAL, KF_SA_PEER)
(KINFO_FILE_TYPE_SOCKET, KINFO_FILE_TYPE_PIPE)
(KINFO_FILE_TYPE_FIFO, KINFO_FILE_TYPE_KQUEUE)
(KINFO_FILE_TYPE_CRYPTO, KINFO_FILE_TYPE_MQUEUE)
(KINFO_FILE_TYPE_SHM, KINFO_FILE_TYPE_SEM, KINFO_FILE_TYPE_PTS)
(KINFO_FILE_TYPE_PROCDESC, KINFO_FILE_FD_TYPE_ROOT)
(KINFO_FILE_FD_TYPE_JAIL, KINFO_FILE_FD_TYPE_TRACE)
(KINFO_FILE_FD_TYPE_CTTY, KINFO_FILE_FLAG_READ)
(KINFO_FILE_FLAG_WRITE, KINFO_FILE_FLAG_APPEND)
(KINFO_FILE_FLAG_ASYNC, KINFO_FILE_FLAG_FSYNC)
(KINFO_FILE_FLAG_NONBLOCK, KINFO_FILE_FLAG_DIRECT)
(KINFO_FILE_FLAG_HASLOCK, KINFO_FILE_FLAG_EXEC)
(KINFO_FILE_VTYPE_VREG, KINFO_FILE_VTYPE_VDIR)
(KINFO_FILE_VTYPE_VCHR, KINFO_FILE_VTYPE_VLNK)
(KINFO_FILE_VTYPE_VSOCK, KINFO_FILE_VTYPE_VFIFO, FBSD_AF_UNIX)
(FBSD_AF_INET, FBSD_AF_INET6, FBSD_SOCK_STREAM, FBSD_SOCK_DGRAM)
(FBSD_SOCK_SEQPACKET, FBSD_IPPROTO_ICMP, FBSD_IPPROTO_TCP)
(FBSD_IPPROTO_UDP, FBSD_IPPROTO_SCTP): New defines.
(struct fbsd_sockaddr_in, struct fbsd_sockaddr_in6)
(struct fbsd_sockaddr_un): New types.
(fbsd_file_fd, fbsd_file_type, fbsd_file_flags, fbsd_ipproto)
(fbsd_print_sockaddr_in, fbsd_print_sockaddr_in6)
(fbsd_info_proc_files_header, fbsd_info_proc_files_entry)
(fbsd_core_info_proc_files): New functions.
(fbsd_core_info_proc): List open file descriptors for IP_FILES and
IP_ALL.
* fbsd-tdep.h (fbsd_info_proc_files_header)
(fbsd_info_proc_files_entry): New.
2018-09-18 23:05:47 +02:00
|
|
|
/* Output the header for "info proc files". */
|
|
|
|
|
|
|
|
extern void fbsd_info_proc_files_header ();
|
|
|
|
|
|
|
|
/* Output description of a single file descriptor for "info proc
|
|
|
|
files". The KF_TYPE, KF_FD, KF_FLAGS, KF_OFFSET, KF_VNODE_TYPE,
|
|
|
|
KF_SOCK_DOMAIN, KF_SOCK_TYPE, and KF_SOCK_PROTOCOL parameters
|
|
|
|
should contain the value of the corresponding fields in a 'struct
|
|
|
|
kinfo_file'. The KF_SA_LOCAL, KF_SA_PEER, and KF_PATH parameters
|
|
|
|
should contain pointers to the corresponding fields in a 'struct
|
|
|
|
kinfo_file'. */
|
|
|
|
|
|
|
|
extern void fbsd_info_proc_files_entry (int kf_type, int kf_fd, int kf_flags,
|
|
|
|
LONGEST kf_offset, int kf_vnode_type,
|
|
|
|
int kf_sock_domain, int kf_sock_type,
|
|
|
|
int kf_sock_protocol,
|
|
|
|
const void *kf_sa_local,
|
|
|
|
const void *kf_sa_peer,
|
|
|
|
const void *kf_path);
|
|
|
|
|
2018-10-17 20:41:30 +02:00
|
|
|
/* Output the header for "info proc mappings". ADDR_BIT is the size
|
|
|
|
of a virtual address in bits. */
|
|
|
|
|
|
|
|
extern void fbsd_info_proc_mappings_header (int addr_bit);
|
|
|
|
|
|
|
|
/* Output description of a single memory range for "info proc
|
|
|
|
mappings". ADDR_BIT is the size of a virtual address in bits. The
|
|
|
|
KVE_START, KVE_END, KVE_OFFSET, KVE_FLAGS, and KVE_PROTECTION
|
|
|
|
parameters should contain the value of the corresponding fields in
|
|
|
|
a 'struct kinfo_vmentry'. The KVE_PATH parameter should contain a
|
|
|
|
pointer to the 'kve_path' field in a 'struct kinfo_vmentry'. */
|
|
|
|
|
|
|
|
extern void fbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
|
|
|
|
ULONGEST kve_end,
|
|
|
|
ULONGEST kve_offset,
|
|
|
|
int kve_flags, int kve_protection,
|
|
|
|
const void *kve_path);
|
Support 'info proc' for FreeBSD process core dumps.
- Command line arguments are obtained from the pr_psargs[] array
saved in the NT_PRPSINFO note.
- The 'cwd' and 'exe' values are obtained from the per-process file
descriptor table stored in the NT_PROCSTAT_FILES core note.
- 'mappings' is implemented by walking the array of VM map entries
stored in the NT_PROCSTAT_VMMAP core note.
- 'status' output is generated by outputting fields from
the first structure stored in the NT_PROCSTAT_PROC core note.
- 'stat' is aliased to 'status'.
gdb/ChangeLog:
* fbsd-tdep.c (KVE_STRUCTSIZE, KVE_START, KVE_END, KVE_OFFSET)
(KVE_FLAGS, KVE_PROTECTION, KVE_PATH, KINFO_VME_PROT_READ)
(KINFO_VME_PROT_WRITE, KINFO_VME_PROT_EXEC, KINFO_VME_FLAG_COW)
(KINFO_VME_FLAG_NEEDS_COPY, KINFO_VME_FLAG_NOCOREDUMP)
(KINFO_VME_FLAG_SUPER, KINFO_VME_FLAG_GROWS_UP)
(KINFO_VME_FLAG_GROWS_DOWN, KF_STRUCTSIZE, KF_TYPE, KF_FD)
(KF_PATH, KINFO_FILE_TYPE_VNODE, KINFO_FILE_FD_TYPE_CWD)
(KINFO_FILE_FD_TYPE_TEXT, SIG_WORDS, struct kinfo_proc_layout)
(kinfo_proc_layout_32, kinfo_proc_layout_i386)
(kinfo_proc_layout_64, fbsd_vm_map_entry_flags)
(fbsd_core_info_proc_mappings, fbsd_core_vnode_path)
(fbsd_core_fetch_timeval, fbsd_print_sigset)
(fbsd_core_info_proc_status, fbsd_core_info_proc): New.
(fbsd_init_abi): Install gdbarch "core_info_proc" method.
* fbsd-tdep.h (fbsd_vm_map_entry_flags): New.
2018-01-09 22:35:17 +01:00
|
|
|
|
2019-03-12 21:39:02 +01:00
|
|
|
/* Helper function to fetch the address of a thread-local variable.
|
|
|
|
DTV_ADDR is the base address of the thread's dtv array. LM_ADDR is
|
|
|
|
the address of the link_map structure for the associated object
|
|
|
|
file. OFFSET is the offset of the variable in the object file's
|
|
|
|
thread-local variable block. */
|
|
|
|
|
|
|
|
extern CORE_ADDR fbsd_get_thread_local_address (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR dtv_addr,
|
|
|
|
CORE_ADDR lm_addr,
|
|
|
|
CORE_ADDR offset);
|
|
|
|
|
2013-12-03 12:35:35 +01:00
|
|
|
#endif /* fbsd-tdep.h */
|