Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Hannes Domani <ssbssa@yahoo.de>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdbserver/win32-low.cc: remove use of `all_threads`
Date: Tue, 3 Dec 2024 10:58:18 -0500	[thread overview]
Message-ID: <e370b257-3960-4047-8050-a18048c7f7bc@polymtl.ca> (raw)
In-Reply-To: <1118788268.7833323.1733236497630@mail.yahoo.com>

On 12/3/24 9:34 AM, Hannes Domani wrote:
>  Am Montag, 2. Dezember 2024 um 20:50:34 MEZ hat Simon Marchi <simon.marchi@polymtl.ca> Folgendes geschrieben:
> 
>> 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.
> 
> I tested it now, and there seems to be no problem.
> 
> But this if() actually never triggered for me, I never got an
> EXIT_THREAD_DEBUG_EVENT for the final thread, only an
> EXIT_PROCESS_DEBUG_EVENT.
> I tried it out on both Win7 and Win11, but maybe there is some special
> constellation where this can happen, or it was different on earlier
> Windows versions.

Damn, I hoped you would know.  The comment is somewhat useless, it just
literally explains what the code does, much like:

  /* Add 1 and 2 together and assign to x.  */
  x = 1 + 2;

> Tested-By: Hannes Domani <ssbssa@yahoo.de>

Thanks for testing, bug I will send a v2 implementing Stephan's
suggestion.  It's a minor change, but better be safe than sorry.

Simon

      reply	other threads:[~2024-12-03 16:00 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
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 [this message]

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=e370b257-3960-4047-8050-a18048c7f7bc@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /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