kern/173723: Add file descriptor information to process core dumps

John Baldwin jhb at
Mon Nov 19 17:00:00 UTC 2012

>Number:         173723
>Category:       kern
>Synopsis:       Add file descriptor information to process core dumps
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 17:00:00 UTC 2012
>Originator:     John Baldwin
ELF core files already include metadata about processes including notes with the context of each running thread.  Occasionally I have wanted to examine the open fd's associated with a process while debugging.  With the advent of 'procstat -f' we now have a useful structure that holds file descriptor info in a somewhat abstract manner.  It seems possible that we could add a new set of notes to a core dump listing the various file descriptors associated with the process at the time of exit storing 'kinfo_file' objects in the relevant notes.  It is probably worth including additional notes for other "files" such as the working directory, etc. as show in 'procstat -f' output of a running process.

Once this is present there should be ways to extract the information from a core. One would be to teach libprocstat how to look for data from a core file (and thus procstat).  Another useful thing to do would be to add a new custom command to gdb to dump this table from within gdb.  Said command could use libprocstat to work against both coredumps and running processes.



More information about the freebsd-bugs mailing list