From: "Rohr, Stephan" <stephan.rohr@intel.com>
To: Simon Marchi <simon.marchi@polymtl.ca>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] gdbserver/win32-low.cc: remove use of `all_threads`
Date: Mon, 2 Dec 2024 20:48:20 +0000 [thread overview]
Message-ID: <DS7PR11MB6247C64B7DA28BCB7091C8C993352@DS7PR11MB6247.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20241202194722.1297596-1-simon.marchi@polymtl.ca>
Hi Simon,
thanks for fixing this. I missed to check the windows build when submitting the
thread map patch for GDBserver. The fix itself looks ok, but I also cannot judge if
GDBserver only supports a single process at a time. We could also use something
like
int num_threads = 0;
for_each_process ([&num_threads] (process_info *process)
{
num_threads += process->thread_map ().size ();
});
if (num_threads == 0)
return;
to preserve the same behaviour as implemented now.
Stephan
> -----Original Message-----
> From: Simon Marchi <simon.marchi@polymtl.ca>
> Sent: Monday, 2 December 2024 20:47
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi <simon.marchi@polymtl.ca>
> Subject: [PATCH] gdbserver/win32-low.cc: remove use of `all_threads`
>
> Fix this:
>
> /home/simark/src/binutils-gdb/gdbserver/win32-low.cc: In function ‘void
> child_delete_thread(DWORD, DWORD)’:
> /home/simark/src/binutils-gdb/gdbserver/win32-low.cc:192:7: error:
> ‘all_threads’ was not declared in this scope; did you mean ‘using_threads’?
> 192 | if (all_threads.size () == 1)
> | ^~~~~~~~~~~
> | using_threads
>
> Commit 9f77b3aa0bfc ("gdbserver: change 'all_processes' and
> 'all_threads' list type") changed the type of `all_thread` to an
> intrusive_list, without changing this particular use, which broke the
> build because an intrusive_list doesn't know its size (we, could,
> Boost's version has an option for that, but we don't need it at the
> moment). The subsequent commit removed `all_threads`, leading to the
> error above.
>
> Fix it by using the number of threads of the current process instead.
> My rationale: as far as I know, GDBserver on Windows only supports one
> process at a time, so there's no need to iterate over all processes. It
> would be nice if someone familiar with the Windows port could confirm
> (and test) this.
>
> Change-Id: I84d6226532b887d99248cf3be90f5065fb7a074a
> ---
> gdbserver/win32-low.cc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
> index 0174a32e5d19..ef00f3452f31 100644
> --- a/gdbserver/win32-low.cc
> +++ b/gdbserver/win32-low.cc
> @@ -189,7 +189,7 @@ static void
> child_delete_thread (DWORD pid, DWORD tid)
> {
> /* If the last thread is exiting, just return. */
> - if (all_threads.size () == 1)
> + if (current_process ()->thread_map ().size () == 1)
> return;
>
> thread_info *thread = find_thread_ptid (ptid_t (pid, tid));
>
> base-commit: 3eccfdce99e030be759ea20c66d6f78978b11a25
> --
> 2.47.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2024-12-02 20:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 19:47 Simon Marchi
2024-12-02 20:48 ` Rohr, Stephan [this message]
2024-12-03 2:48 ` Simon Marchi
2024-12-03 9:03 ` Rohr, Stephan
2024-12-03 15:54 ` Simon Marchi
2024-12-03 14:34 ` Hannes Domani
2024-12-03 15:58 ` 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=DS7PR11MB6247C64B7DA28BCB7091C8C993352@DS7PR11MB6247.namprd11.prod.outlook.com \
--to=stephan.rohr@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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