* [PATCH] Don't call init_thread_list in windows-nat.c
@ 2022-04-05 13:26 Tom Tromey
2022-04-05 14:24 ` Pedro Alves
2022-04-05 14:31 ` Simon Marchi
0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2022-04-05 13:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
I don't think there's any need to call init_thread_list in
windows-nat.c. This patch removes it. I tested this using the
internal AdaCore test suite on Windows, which FWIW does include some
multi-threaded inferiors.
---
gdb/windows-nat.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 44c1950ace9..646ddda7328 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -401,7 +401,6 @@ static void
windows_init_thread_list (void)
{
DEBUG_EVENTS ("called");
- init_thread_list ();
thread_list.clear ();
}
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't call init_thread_list in windows-nat.c
2022-04-05 13:26 [PATCH] Don't call init_thread_list in windows-nat.c Tom Tromey
@ 2022-04-05 14:24 ` Pedro Alves
2022-04-05 14:27 ` Tom Tromey
2022-04-05 14:31 ` Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2022-04-05 14:24 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2022-04-05 14:26, Tom Tromey via Gdb-patches wrote:
> I don't think there's any need to call init_thread_list in
> windows-nat.c. This patch removes it. I tested this using the
> internal AdaCore test suite on Windows, which FWIW does include some
> multi-threaded inferiors.
OK.
IIUC, thread_list is still a global after your globals elimination pass, so
that thread_list.clear() will also need some kind of adjustment for multi-inferior,
and I suspect it will just disappear too.
Pedro Alves
> ---
> gdb/windows-nat.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 44c1950ace9..646ddda7328 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -401,7 +401,6 @@ static void
> windows_init_thread_list (void)
> {
> DEBUG_EVENTS ("called");
> - init_thread_list ();
> thread_list.clear ();
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't call init_thread_list in windows-nat.c
2022-04-05 14:24 ` Pedro Alves
@ 2022-04-05 14:27 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-04-05 14:27 UTC (permalink / raw)
To: Pedro Alves; +Cc: Tom Tromey, gdb-patches
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
Pedro> IIUC, thread_list is still a global after your globals elimination pass, so
Pedro> that thread_list.clear() will also need some kind of adjustment for multi-inferior,
Pedro> and I suspect it will just disappear too.
Yeah. I only removed the globals (well, the removeable subset of them)
from gdb/nat/windows-nat.c, not from gdb/windows-nat.c. For those I
think the idea should be to move them to a subclass of
private_inferior. thread_list would be one of these.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't call init_thread_list in windows-nat.c
2022-04-05 13:26 [PATCH] Don't call init_thread_list in windows-nat.c Tom Tromey
2022-04-05 14:24 ` Pedro Alves
@ 2022-04-05 14:31 ` Simon Marchi
2022-04-05 17:57 ` Tom Tromey
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2022-04-05 14:31 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 2022-04-05 09:26, Tom Tromey via Gdb-patches wrote:
> I don't think there's any need to call init_thread_list in
> windows-nat.c. This patch removes it. I tested this using the
> internal AdaCore test suite on Windows, which FWIW does include some
> multi-threaded inferiors.
> ---
> gdb/windows-nat.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 44c1950ace9..646ddda7328 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -401,7 +401,6 @@ static void
> windows_init_thread_list (void)
> {
> DEBUG_EVENTS ("called");
> - init_thread_list ();
> thread_list.clear ();
> }
So, init_thread_list clears all threads of all inferiors?
In multi-target and multi-inferiors scenarios, it just doesn't make
sense. I quickly reviewed all calls to init_thread_list, and I think
they are all more or less bogus. I think we could go even further and
get rid of it.
In windows-nat.c, it is called after creating a new inferior (run) and
attaching. Since you are on the path of making windows-nat
multi-inferior aware, it definitely doesn't make sense to call that.
Otherwise, when running your second inferior, it would clear the threads
of your first inferior.
windows_init_thread_list also clears the thread_list global (which is
static to windows-nat.c). I presume you will make that per-inferior
eventually?
Anyway, the patch LGTM as it is.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't call init_thread_list in windows-nat.c
2022-04-05 14:31 ` Simon Marchi
@ 2022-04-05 17:57 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2022-04-05 17:57 UTC (permalink / raw)
To: Simon Marchi; +Cc: Tom Tromey, gdb-patches
Simon> windows_init_thread_list also clears the thread_list global (which is
Simon> static to windows-nat.c). I presume you will make that per-inferior
Simon> eventually?
Yeah, there are still a lot of globals in gdb/windows-nat.c that will
need to be per-inferior.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-05 17:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 13:26 [PATCH] Don't call init_thread_list in windows-nat.c Tom Tromey
2022-04-05 14:24 ` Pedro Alves
2022-04-05 14:27 ` Tom Tromey
2022-04-05 14:31 ` Simon Marchi
2022-04-05 17:57 ` Tom Tromey
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).