Implement "info proc exe" for NetBSD

Use pid_to_exec_file() to query the program.

gdb/ChangeLog:

	* nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe.
This commit is contained in:
Kamil Rytarowski 2020-04-12 17:04:34 +02:00
parent 54b8cbd0e4
commit 51c133d547
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2020-04-12 Kamil Rytarowski <n54@gmx.com>
* nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe.
2020-04-11 Kamil Rytarowski <n54@gmx.com>
* nbsd-nat.c; Include "nbsd-tdep.h" and "gdbarch.h".

View File

@ -299,6 +299,7 @@ bool
nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
{
pid_t pid;
bool do_exe = false;
bool do_mappings = false;
switch (what)
@ -306,6 +307,9 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
case IP_MAPPINGS:
do_mappings = true;
break;
case IP_EXE:
do_exe = true;
break;
default:
error (_("Not supported on this target."));
}
@ -324,6 +328,14 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
printf_filtered (_("process %d\n"), pid);
if (do_exe)
{
const char *exe = pid_to_exec_file (pid);
if (exe != nullptr)
printf_filtered ("exe = '%s'\n", exe);
else
warning (_("unable to fetch executable path name"));
}
if (do_mappings)
{
size_t nvment;