binutils-gdb/gdb/fbsd-tdep.h

53 lines
2.0 KiB
C
Raw Normal View History

/* Target-dependent code for FreeBSD, architecture independent.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
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);
/* Helper function to generate mappings flags for a single VM map
entry in 'info proc mappings'. The KVE_FLAGS and KVE_PROTECTION
parameters should contain the values of the corresponding fields in
a 'struct kinfo_vmentry'. */
extern const char *fbsd_vm_map_entry_flags (int kve_flags, int kve_protection);
#endif /* fbsd-tdep.h */