public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kamil Rytarowski <krytarowski@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Implement "info proc exe" for NetBSD
Date: Sun, 12 Apr 2020 17:26:40 +0000 (GMT)	[thread overview]
Message-ID: <20200412172640.38323385BF83@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=51c133d547e21421c678276b0cb53383f5706781

commit 51c133d547e21421c678276b0cb53383f5706781
Author: Kamil Rytarowski <n54@gmx.com>
Date:   Sun Apr 12 17:04:34 2020 +0200

    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:
---
 gdb/ChangeLog  |  4 ++++
 gdb/nbsd-nat.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 336bd497413..3bbd5c3129d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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".
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c
index 2420153c7bc..05aedf8e3f1 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;


                 reply	other threads:[~2020-04-12 17:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200412172640.38323385BF83@sourceware.org \
    --to=krytarowski@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).