From: Kamil Rytarowski Date: Sun, 12 Apr 2020 15:04:34 +0000 (+0200) Subject: Implement "info proc exe" for NetBSD X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=51c133d547e21421c678276b0cb53383f5706781;p=deliverable%2Fbinutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 336bd49741..3bbd5c3129 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-04-12 Kamil Rytarowski + + * nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe. + 2020-04-11 Kamil Rytarowski * nbsd-nat.c; Include "nbsd-tdep.h" and "gdbarch.h". diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c index 2420153c7b..05aedf8e3f 100644 --- a/gdb/nbsd-nat.c +++ b/gdb/nbsd-nat.c @@ -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;