From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28251 invoked by alias); 8 Sep 2018 00:38:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 28208 invoked by uid 89); 8 Sep 2018 00:38:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=baldwin, Baldwin, 2180 X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Sep 2018 00:38:12 +0000 Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7C47A10A87D for ; Fri, 7 Sep 2018 20:38:10 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 0/5] Add a new 'info proc files' command Date: Sat, 08 Sep 2018 00:38:00 -0000 Message-Id: <20180908003659.37482-1-jhb@FreeBSD.org> X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00148.txt.bz2 This series adds a new 'info proc files' subcommand of 'info proc'. This subcommand lists information about the open file descriptors of a process similar to how 'info proc mappings' lists information about the active virtual memory mappings of a process. The series includes support for reading the list of file descriptors from both process core dumps and live processes under FreeBSD. I've included some sample output below from a live ssh process. One possibly odd thing to note is that FreeBSD includes some "special" files in the list of open files that are not actual file descriptors, but other files that each process references such as the current working directory, the root directory (affected by chroot), the controlling tty, etc. (gdb) info proc files 22136 process 22136 Open files: FD Type Offset Flags Name text file - r-------- /usr/bin/slogin ctty chr - rw------- /dev/pts/20 cwd dir - r-------- /usr/home/john root dir - r-------- / 0 chr 0x32933a4 rw------- /dev/pts/20 1 chr 0x32933a4 rw------- /dev/pts/20 2 chr 0x32933a4 rw------- /dev/pts/20 3 socket 0x0 rw----n-- tcp4 10.0.1.2:53014 -> 10.0.1.10:22 4 socket 0x0 rw------- unix stream:/tmp/ssh-FIt89oAzOn5f/agent.2456 5 chr 0x32933a4 rw------- /dev/pts/20 6 chr 0x32933a4 rw------- /dev/pts/20 7 chr 0x32933a4 rw------- /dev/pts/20 John Baldwin (5): Use KF_PATH to verify the size of a struct kinfo_file. Add a new 'info proc files' subcommand of 'info proc'. Add support for 'info proc files' on FreeBSD core dumps. Support 'info proc files' on live FreeBSD processes. Document the 'info proc files' command. gdb/ChangeLog | 51 +++++ gdb/NEWS | 3 + gdb/defs.h | 3 + gdb/doc/ChangeLog | 5 + gdb/doc/gdb.texinfo | 8 + gdb/fbsd-nat.c | 44 ++++- gdb/fbsd-tdep.c | 443 +++++++++++++++++++++++++++++++++++++++++++- gdb/fbsd-tdep.h | 31 ++++ gdb/infcmd.c | 12 ++ 9 files changed, 597 insertions(+), 3 deletions(-) -- 2.18.0