public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Implement pid_to_exec_file for Windows in gdbserver
Date: Wed, 27 Apr 2022 21:33:51 -0400	[thread overview]
Message-ID: <52345d0e-12bf-bbd8-0ec6-fdfd6b5487ef@simark.ca> (raw)
In-Reply-To: <20220427172800.858822-3-tromey@adacore.com>

> diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
> index 29fd0a3a69b..4244426f5eb 100644
> --- a/gdb/nat/windows-nat.h
> +++ b/gdb/nat/windows-nat.h
> @@ -249,6 +249,8 @@ struct windows_process_info
>  
>    gdb::optional<pending_stop> fetch_pending_stop (bool debug_events);
>  
> +  const char *pid_to_exec_file (int);

It seems a bit strange to pass a pid to this method.  Doesn't a
windows_process_info object know its own pid?  And so passing the pid as
a parameter would be redundant?

Right now gdb/windows-nat.c supports a single process only, so it must
be that the pid that is requested as a parameter must match the (only)
process' pid.  So maybe we can have a gdb_assert in
windows_nat_target::pid_to_exec_file to verify that (and the same
GDBserver-side)?

The day the windows-nat target becomes multi-process, then I guess we'll
use the passed-in pid to look up a specific windows_process_info by pid
in whatever data structure will contain all the windows_process_infos.
And then we can call windows_process_info::pid_to_exec_file without
passing any pid.

Note that this is all speculation, I haven't tried anything.  I'm just
assuming that windows_process_info::id is the same as "pid".

Otherwise, LGTM.

Simon

  reply	other threads:[~2022-04-28  1:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 17:27 [PATCH 0/2] " Tom Tromey
2022-04-27 17:27 ` [PATCH 1/2] Constify target_pid_to_exec_file Tom Tromey
2022-04-27 17:49   ` John Baldwin
2022-04-27 17:28 ` [PATCH 2/2] Implement pid_to_exec_file for Windows in gdbserver Tom Tromey
2022-04-28  1:33   ` Simon Marchi [this message]
2022-04-28 13:09     ` Tom Tromey
2022-04-28 19:50     ` Tom Tromey
2022-04-28 19:56       ` Simon Marchi

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=52345d0e-12bf-bbd8-0ec6-fdfd6b5487ef@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /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).