Re: [RFA 2/2][master only] gdb/windows-nat.c: Get rid of main_thread_id global

Eli Zaretskii
2019-04-23T05:54:18Z

> Date: Mon, 22 Apr 2019 23:46:07 +0200
> From: AndrÃ© PÃ¶nitz <apoenitz@t-online.de>
> Cc: Joel Brobecker <brobecker@adacore.com>, Eli Zaretskii <eliz@gnu.org>,
> gdb-patches@sourceware.org
>
> > - be quiet wrt to threads with single-threaded programs.
>
> TBH, I don't see the necessity of this requirement. That would be two
> lines of noise per run.

It violates the same principle of least astonishment, in the important
use case of a program that has only one application thread, the main
thread.

And please also keep in mind that we are not talking about introducing
a new feature, we are talking about preserving an existing feature, in
a way that will avoid crashing GDB in some rare cases. It sounds
wrong to me to lose a feature because its implementation causes
problems in a rare use case; we should instead fix the implementation.

> > - inform the user the main thread exited while other threads stay running.
>
> Also here, I don't see enough gain in one suppressed line of output
> to compensate for the inconsistency, this time even with a CLI user hat on.

Forgive me for asking, but do you frequently debug with GDB on
Windows? Because this issue is specific to native Windows debugging,
it won't affect any other platforms. On Windows, we already have
threads popping up and exiting that are started by the OS beyond our
control, which is already quite jarring even to me, certainly to
someone who doesn't debug day in and day out. Having the main thread
of my program add more noise is not insignificant, because ideally I
don't want to see any of my application threads shown unless my
program really started a thread.

Thanks.