public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Fix GDB build failure on Windows
Date: Tue, 26 Jun 2018 11:15:00 -0000	[thread overview]
Message-ID: <072c18e0-448a-2978-6d9d-870fd09cb967@redhat.com> (raw)
In-Reply-To: <1529951254-45540-1-git-send-email-brobecker@adacore.com>

Hi Joel,

I had already pushed a patch to fix this:
<https://sourceware.org/ml/gdb-patches/2018-06/msg00583.html> 
which just restores the old behavior, but I'm fine with your
patch too.

Thanks,
Pedro Alves

On 06/25/2018 07:27 PM, Joel Brobecker wrote:
> ---
>  gdb/windows-nat.c | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index 63a7800..620e25c 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -479,7 +479,7 @@ windows_init_thread_list (void)
>  
>  /* Delete a thread from the list of threads.  */
>  static void
> -windows_delete_thread (ptid_t ptid, DWORD exit_code)
> +windows_delete_thread (const ptid_t &ptid, DWORD exit_code)
>  {
>    windows_thread_info *th;
>    DWORD id;
> @@ -493,7 +493,26 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code)
>    else if (print_thread_events && id != main_thread_id)
>      printf_unfiltered (_("[%s exited with code %u]\n"),
>  		       target_pid_to_str (ptid), (unsigned) exit_code);
> -  delete_thread (ptid);
> +
> +  thread_info *tp = find_thread_ptid (ptid);
> +  if (tp != NULL)
> +    delete_thread (tp);
> +  else
> +    {
> +      /* Something unexpected happened: We are trying to delete
> +	 a thread that the core layer apparently does not know about.
> +	 This should never happen, and thus we want to be able to
> +	 report this discrepancy should it actually happen and have
> +	 unanticipated side-effects; but since we were trying to
> +	 delete the thread anyway, it's quite possible that this
> +	 issue has no actual consequence in terms of the overall
> +	 behavior.  So, instead of unnecessarily worrying the user
> +	 with a warning or internal-error, just log a DEBUG_EVENTS
> +	 event.  */
> +      DEBUG_EVENTS (("gdb: windows_delete_thread cannot find thread"
> +		     " for ptid (pid=%d, tid=%ld)\n",
> +		     ptid.pid(), ptid.tid()));
> +    }
>  
>    for (th = &thread_head;
>         th->next != NULL && th->next->id != id;
> @@ -2000,7 +2019,7 @@ windows_nat_target::detach (inferior *inf, int from_tty)
>  
>    x86_cleanup_dregs ();
>    inferior_ptid = null_ptid;
> -  detach_inferior (current_event.dwProcessId);
> +  detach_inferior (current_inferior ());
>  
>    maybe_unpush_target ();
>  }

  reply	other threads:[~2018-06-26 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 18:27 Joel Brobecker
2018-06-26 11:15 ` Pedro Alves [this message]
2018-06-26 12: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=072c18e0-448a-2978-6d9d-870fd09cb967@redhat.com \
    --to=palves@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).