From: Kamil Rytarowski <n54@gmx.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Implement "info proc exe" for NetBSD
Date: Sun, 12 Apr 2020 17:36:53 +0200 [thread overview]
Message-ID: <20200412153653.6277-1-n54@gmx.com> (raw)
Use pid_to_exec_file() to query the program.
gdb/ChangeLog:
* nbsd-nat.c (nbsd_nat_target::info_proc): Add do_exe.
---
gdb/nbsd-nat.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c
index 2420153c7bc..828bbb57c82 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."));
}
@@ -345,6 +349,14 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
else
warning (_("unable to fetch virtual memory map"));
}
+ 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"));
+ }
return true;
}
--
2.25.0
next reply other threads:[~2020-04-12 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-12 15:36 Kamil Rytarowski [this message]
2020-04-12 17:13 ` Simon Marchi
2020-04-12 17:22 ` Kamil Rytarowski
2020-04-12 17:53 Kamil Rytarowski
2020-04-12 17:59 ` Simon Marchi
2020-04-12 17:58 ` Kamil Rytarowski
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=20200412153653.6277-1-n54@gmx.com \
--to=n54@gmx.com \
--cc=gdb-patches@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