Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: gdbserver/win32, fix ctrl-c handling.
Date: Thu, 26 Nov 2009 22:30:00 -0000	[thread overview]
Message-ID: <200911262230.34939.pedro@codesourcery.com> (raw)
In-Reply-To: <200911262228.04610.pedro@codesourcery.com>

On Thursday 26 November 2009 22:28:04, Pedro Alves wrote:
> Sometimes, a win32 gdbserver would ignore a ctrl-c, because
> this
> 
>  remote-utils.c:input_interrupt:
> 
>       if (cc != 1 || c != '\003' || current_inferior == NULL)
> 	{
> 	  fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n",
> 		   cc, c, c);
> 	  return;
> 	}
> 
> was being reached with current_inferior == NULL.  current_inferior
> ends up set to NULL after a EXIT_THREAD_DEBUG_EVENT event.  Between
> a thread exit event and any other event that forced a curren_inferiot
> switch, ctrl-c's where ignored.  I've applied this patch to handle it
> like linux-low.c does.  When a thread exits, switch to any thread
> other thread (always the first in the thread list, just because it's
> simple and handy).
> 

Here's the patch.

2009-11-26  Pedro Alves  <pedro@codesourcery.com>

	Issue #7133.

	gdb/gdbserver/
	* win32-low.c (get_child_debug_event): On EXIT_THREAD_DEBUG_EVENT
	events, don't leave current_inferior pointing at null.

-- 
Pedro Alves

---
 gdb/gdbserver/win32-low.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: src/gdb/gdbserver/win32-low.c
===================================================================
--- src.orig/gdb/gdbserver/win32-low.c	2009-11-26 19:20:21.000000000 +0000
+++ src/gdb/gdbserver/win32-low.c	2009-11-26 19:20:27.000000000 +0000
@@ -1438,10 +1438,6 @@ get_child_debug_event (struct target_wai
 
  gotevent:
 
-  ptid = debug_event_ptid (&current_event);
-  current_inferior =
-    (struct thread_info *) find_inferior_id (&all_threads, ptid);
-
   switch (current_event.dwDebugEventCode)
     {
     case CREATE_THREAD_DEBUG_EVENT:
@@ -1463,7 +1459,9 @@ get_child_debug_event (struct target_wai
 		(unsigned) current_event.dwThreadId));
       child_delete_thread (current_event.dwProcessId,
 			   current_event.dwThreadId);
-      break;
+
+      current_inferior = (struct thread_info *) all_threads.head;
+      return 1;
 
     case CREATE_PROCESS_DEBUG_EVENT:
       OUTMSG2 (("gdbserver: kernel event CREATE_PROCESS_DEBUG_EVENT "
@@ -1558,6 +1556,7 @@ get_child_debug_event (struct target_wai
       break;
     }
 
+  ptid = debug_event_ptid (&current_event);
   current_inferior =
     (struct thread_info *) find_inferior_id (&all_threads, ptid);
   return 1;


      reply	other threads:[~2009-11-26 22:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26 22:28 Pedro Alves
2009-11-26 22:30 ` Pedro Alves [this message]

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=200911262230.34939.pedro@codesourcery.com \
    --to=pedro@codesourcery.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