Implement "info proc exe" for NetBSD
authorKamil Rytarowski <n54@gmx.com>
Sun, 12 Apr 2020 15:04:34 +0000 (17:04 +0200)
committerKamil Rytarowski <n54@gmx.com>
Sun, 12 Apr 2020 17:25:35 +0000 (19:25 +0200)
Use pid_to_exec_file() to query the program.

gdb/ChangeLog:

* nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe.

gdb/ChangeLog
gdb/nbsd-nat.c

index 336bd497413046513227eb55c47d817e9a6d3a55..3bbd5c3129d09d1eed270a1ca8d9b80c8eb28182 100644 (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".
index 2420153c7bc5cfd8fbf9830d57c475ed13284ba2..05aedf8e3f1e10aebafc282b9f3b7f8864f5fe2c 100644 (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;
This page took 0.028989 seconds and 4 git commands to generate.