This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Thread exit messages on MS-Windows
- From: asmwarrior <asmwarrior at gmail dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 27 Apr 2013 17:58:36 +0800
- Subject: Re: [RFA] Thread exit messages on MS-Windows
- References: <83obd1tyi7 dot fsf at gnu dot org> <838v44tnf8 dot fsf at gnu dot org>
On 2013-4-27 15:58, Eli Zaretskii wrote:
>> Date: Fri, 26 Apr 2013 12:46:56 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>>
>> This is from the node "Threads" of the manual:
>>
>> `set print thread-events'
>> `set print thread-events on'
>> `set print thread-events off'
>> The `set print thread-events' command allows you to enable or
>> disable printing of messages when GDB notices that new threads have
>> started or that threads have exited. By default, these messages
>> will be printed if detection of these events is supported by the
>> target. Note that these messages cannot be disabled on all
>> targets.
>>
>> However, debugging MinGW programs on MS-Windows, I see only messages
>> about new threads, like this:
>>
>> [New Thread 6184.0x1bbc]
>> [New Thread 6184.0x13c8]
>> [New Thread 6184.0x1a3c]
>>
>> I never see any messages about threads that exited, although examining
>> the details of the program being debugged, I clearly see that most of
>> them did.
>>
>> Does that mean that GDB doesn't support thread exit messages on
>> Windows? What feature(s) are missing for this support to be
>> available?
>>
>> I can get thread exit messages from windows-nat.c such as
>>
>> [Deleting Thread 8112.0x1494]
>> [Deleting Thread 8112.0x11d0]
>>
>> if I "set verbose on", but that mode causes GDB to become much more
>> talkative than I'd like.
>>
>> In thread.c, I see that add_thread_with_info will announce new threads
>> if print_thread_events is non-zero, but I see no similar announcement
>> in delete_thread or its subroutines. Is this supposed to be handled
>> by target-specific back ends? I see something like that in, e.g.,
>> linux-nat.c and in inf-ttrace.c, but I'm unsure whether that is a
>> conclusive evidence.
>>
>> If indeed thread deletion should be announced by the target, why this
>> asymmetry with thread creation?
>>
>> TIA for any help or info.
>
> No one replied, so I'm now converting this into an RFA. The patch
> below causes GDB on Windows to display thread exit messages like this:
>
> [Thread 5920.0x13e4 exited with code 0]
> [Thread 5920.0x12d0 exited with code 0]
> [Thread 5920.0x1cbc exited with code 0]
>
> OK to commit this (on the trunk)?
>
I just applied your patch, and the result GDB works fine. Great work!
Yuanhui Zhang