diff options
author | John Baldwin <jhb@FreeBSD.org> | 2018-09-18 14:05:47 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2018-09-18 14:05:47 -0700 |
commit | 57c2a98a4c7e5ad4e62c876eb5cebe9d17a51ad0 (patch) | |
tree | f13c376547afb400c55506d33530fde80e9b64b2 /gdb/fbsd-tdep.h | |
parent | e98ee8c458f3a8405eb93e71b00f801b4bbe3635 (diff) | |
download | gdb-57c2a98a4c7e5ad4e62c876eb5cebe9d17a51ad0.zip gdb-57c2a98a4c7e5ad4e62c876eb5cebe9d17a51ad0.tar.gz gdb-57c2a98a4c7e5ad4e62c876eb5cebe9d17a51ad0.tar.bz2 |
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.
Diffstat (limited to 'gdb/fbsd-tdep.h')
-rw-r--r-- | gdb/fbsd-tdep.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/fbsd-tdep.h b/gdb/fbsd-tdep.h index 0b293e5..e0cad7d 100644 --- a/gdb/fbsd-tdep.h +++ b/gdb/fbsd-tdep.h @@ -22,6 +22,26 @@ extern void fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); +/* 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 |