Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/commit] GDB crash re-running program on Windows (native)
Date: Thu, 03 Jan 2019 03:48:00 -0000	[thread overview]
Message-ID: <bdbd77389265e70e1cacc0cc07dcc399@polymtl.ca> (raw)
In-Reply-To: <20190103033347.GD28188@adacore.com>

On 2019-01-02 22:33, Joel Brobecker wrote:
> Hi Simon,
> 
> Thanks for the review!
> 
>> > With that in mind, this commit fixes the issue by deleting the thread
>> > when the inferior sends the exit-process event as opposed to deleting it
>> > later, while starting a new inferior.
>> >
>> > This restores also restores the printing of the thread-exit notification
>> 
>> "This restores also restores"
>> 
>> > for the main thread, which was missing before. Looking at the transcript
>> > of the example show above, we can see 4 thread creation notifications,
>> > and only 3 notifications for thread exits. Now creation and exit
>> > notifications are balanced.
>> 
>> Another choice is to not show the main thread's creation and exit (as 
>> is
>> done on Linux), since it's kind of redundant with the process creation 
>> and
>> exit.
> 
> Indeed, that's a good idea. I propose to work on that as a followup
> patch, as I am a little short on time these next couple of weeks
> (broken hand :-().
> 
>> > In the handling of EXIT_THREAD_DEBUG_EVENT, the main_thread_id
>> > check is removed because deemed unnecessary: The main thread was
>> > introduced by a CREATE_THREAD_DEBUG_EVENT, and thus the kernel
>> > is expected to report its death via EXIT_PROCESS_DEBUG_EVENT.
>> 
>> Should that last EXIT_PROCESS_DEBUG_EVENT actually be
>> EXIT_THREAD_DEBUG_EVENT?
> 
> Not quite, but actually a good question nonetheless. There was
> an auto-completion error in the text above. New text:
> 
>     | In the handling of EXIT_THREAD_DEBUG_EVENT, the main_thread_id
>     | check is removed because deemed unnecessary: The main thread was
>     | introduced by a CREATE_PROCESS_DEBUG_EVENT, and thus the kernel
>     | is expected to report its death via EXIT_PROCESS_DEBUG_EVENT.
> 
> In other words, we don't expect to receive an EXIT_THREAD_DEBUG_EVENT
> for the main thread, because, at the Windows level, that thread really
> isn't a thread, but really a process.
> 
> 
>> > @@ -1607,6 +1599,9 @@ get_windows_debug_event (struct target_ops *ops,
>> >  	}
>> >        else if (saw_create == 1)
>> >  	{
>> > +	  windows_delete_thread (ptid_t (current_event.dwProcessId, 0,
>> > +					 main_thread_id),
>> > +				 0);
>> >  	  ourstatus->kind = TARGET_WAITKIND_EXITED;
>> >  	  ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
>> >  	  thread_id = main_thread_id;
>> 
>> If what you said above is right (that the kernel reports the main 
>> thread's
>> death through an EXIT_THREAD_DEBUG_EVENT), why is this new call to
>> windows_delete_thread needed?  Shouldn't it already be deleted at this
>> point?
> 
> Does the answer above allow us to make sense of this hunk?

Yes, thanks for the explanation, everything LGTM.

Simon


  reply	other threads:[~2019-01-03  3:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-31  3:58 Joel Brobecker
2019-01-02 23:03 ` Simon Marchi
2019-01-03  3:33   ` Joel Brobecker
2019-01-03  3:48     ` Simon Marchi [this message]
2019-01-05  7:57       ` Joel Brobecker

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=bdbd77389265e70e1cacc0cc07dcc399@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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