Re: [PATCH 2/5] Add a new 'info proc files' subcommand of 'info proc'.

Simon Marchi
2018-09-08T22:32:51Z

On 2018-09-08 01:36 AM, John Baldwin wrote:
> This command displays a list of open file descriptors.
>
> gdb/ChangeLog:
>
> * defs.h (enum info_proc_what) [IP_FILES]: New value.
> * infcmd.c (info_proc_cmd_files): New function.
> (_initialize_infcmd): Register 'info proc files' command.
> ---
> gdb/ChangeLog | 6 ++++++
> gdb/defs.h | 3 +++
> gdb/infcmd.c | 12 ++++++++++++
> 3 files changed, 21 insertions(+)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index d32b390778..2e5cd0a687 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,9 @@
> +2018-09-07 John Baldwin <jhb@FreeBSD.org>
> +
> + * defs.h (enum info_proc_what) [IP_FILES]: New value.
> + * infcmd.c (info_proc_cmd_files): New function.
> + (_initialize_infcmd): Register 'info proc files' command.
> +
> 2018-09-07 John Baldwin <jhb@FreeBSD.org>
>
> * fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
> diff --git a/gdb/defs.h b/gdb/defs.h
> index fc4217005a..6e3f4df116 100644
> --- a/gdb/defs.h
> +++ b/gdb/defs.h
> @@ -389,6 +389,9 @@ enum info_proc_what
> /* * Display `info proc cwd'. */
> IP_CWD,
>
> + /* * Display `info proc files'. */
> + IP_FILES,
> +
> /* * Display all of the above. */
> IP_ALL
> };
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 860909f5e2..c6cfc10a49 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -3218,6 +3218,14 @@ info_proc_cmd_exe (const char *args, int from_tty)
> info_proc_cmd_1 (args, IP_EXE, from_tty);
> }
>
> +/* Implement `info proc files'. */
> +
> +static void
> +info_proc_cmd_files (const char *args, int from_tty)
> +{
> + info_proc_cmd_1 (args, IP_FILES, from_tty);
> +}
> +
> /* Implement `info proc all'. */
>
> static void
> @@ -3543,6 +3551,10 @@ List command line arguments of the process."),
> List absolute filename for executable of the process."),
> &info_proc_cmdlist);
>
> + add_cmd ("files", class_info, info_proc_cmd_files, _("\
> +List of open files."),
> + &info_proc_cmdlist);
> +
> add_cmd ("all", class_info, info_proc_cmd_all, _("\
> List all available /proc info."),
> &info_proc_cmdlist);
The code LGTM, but please wait for Eli's reply on the doc bits.

Thanks,

Simon