public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tom@tromey.com>
Cc: Hannes Domani <ssbssa@yahoo.de>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] gdb/Windows: Fix detach while running
Date: Wed, 17 Apr 2024 18:57:41 +0100	[thread overview]
Message-ID: <69bbd1f3-7de8-4a4e-882e-0d753ec75f42@palves.net> (raw)
In-Reply-To: <878r1e36gc.fsf@tromey.com>

On 2024-04-15 18:02, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:
> 
> Pedro> Still in windows_nat_target::detach, we have an interesting issue that
> Pedro> ends up being the bulk of the patch -- only the process_thread thread
> Pedro> can call DebugActiveProcessStop, but if it is blocked in
> Pedro> WaitForDebugEvent, we need to somehow force it to break out of it.
> Pedro> The only way to do that, is to force the inferior to do something that
> Pedro> causes WaitForDebugEvent to return some event.
> 
> I generally like the Windows debug API but I can't really understand why
> they didn't integrate WaitForDebugEvent with WaitForMultipleObjects --
> it seems like such an obvious thing to do and it would have saved so
> many headaches.
> 
> I didn't read the patch in too much detail, but I did look over it and I
> read through the explanation.  It all makes sense to me.
> 
> I was wondering if something similar is needed for gdbserver?
> I assume not though.

It doesn't for two reasons:

#1 - gdbserver doesn't wait for Windows debug events with a separate thread.

#2 - in order to detach while the inferior is running with a remote target, we must
     be using the non-stop variant of the RSP (so we can send a packet other than
     \03 while the target is running), which the Windows gdbserver port does not support
     (and would need #1).

ATM, I can only focus mostly on native non-stop, other than making sure gdbserver
doesn't break.  But after the non-stop work, the gdb and gdbserver backends end up a
bit more similar in some areas, hopefully we'll end up being able to share more code
later on.

> 
> Reviewed-By: Tom Tromey <tom@tromey.com>
> 

Thanks.  I've added this and merged the patch.

  reply	other threads:[~2024-04-17 17:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 20:03 [PATCH] " Pedro Alves
2024-04-12 10:56 ` Hannes Domani
2024-04-12 13:41   ` [PATCH v2] " Pedro Alves
2024-04-15 17:02     ` Tom Tromey
2024-04-17 17:57       ` Pedro Alves [this message]
2024-04-17 18:18       ` Pedro Alves

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=69bbd1f3-7de8-4a4e-882e-0d753ec75f42@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.de \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).