Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: RE: [RFA] windows-nat.c: Enable processed input at startup
Date: Mon, 26 Apr 2010 15:07:00 -0000	[thread overview]
Message-ID: <006901cae552$36e27450$a4a75cf0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20100426143241.GB1534@ednor.casa.cgf.cx>


> >+  std_in_handle = CreateFile ("CONIN$", GENERIC_READ | GENERIC_WRITE,
> >+			      FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
> >+
> >+  if (std_in_handle != INVALID_HANDLE_VALUE)
> >+    {
> >+      DWORD console_mode;
> >+      CHECK (GetConsoleMode (std_in_handle, &console_mode));
> >+      console_mode = console_mode | ENABLE_PROCESSED_INPUT;
> >+      CHECK (SetConsoleMode (std_in_handle, console_mode));
> >+    }
> >
> >   init_windows_ops ();
> 
> That has to be conditional on __CYGWIN__ since you'll be screwing up
> Cygwin's
> notion of the console state.

  Is there a Cygwin way to do the same?
 
> And, the name std_in_handle is a misnomer.  It should be console_handle
> or something like that.
 Renamed to conin_handle.
> Can't you just set what you need and close the handle?  I thought this
> setting was global.
  Of course I should close the handle as soon as I changed the
console mode.
  What about this version?

Pierre

2010-04-26  Pierre Muller  <muller@ics.u-strasbg.fr>

	* windows-nat.c (_initialize_windows_nat): Try to set
	ENABLE_PROCESSED_INPUT for console mode if accessible.

Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.208
diff -u -p -r1.208 windows-nat.c
--- windows-nat.c	16 Apr 2010 07:49:35 -0000	1.208
+++ windows-nat.c	26 Apr 2010 15:03:52 -0000
@@ -2357,6 +2357,27 @@ _initialize_windows_nat (void)
 {
   struct cmd_list_element *c;
 
+#ifndef __CYGWIN__
+
+  HANDLE conin_handle;
+
+  /* Try to enable processed input for the console.
+     This should allow to use '^C' to interrupt the debuggee
+     at least as log as the debugge does not modify the
+     console mode settings.  */
+  conin_handle = CreateFile ("CONIN$", GENERIC_READ | GENERIC_WRITE,
+			     FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+
+  if (conin_handle != INVALID_HANDLE_VALUE)
+    {
+      DWORD console_mode;
+      CHECK (GetConsoleMode (conin_handle, &console_mode));
+      console_mode = console_mode | ENABLE_PROCESSED_INPUT;
+      CHECK (SetConsoleMode (conin_handle, console_mode));
+      CHECK (CloseHandle (conin_handle));
+    }
+#endif
+
   init_windows_ops ();
 
 #ifdef __CYGWIN__


  reply	other threads:[~2010-04-26 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 11:41 Pierre Muller
2010-04-26 14:32 ` Christopher Faylor
2010-04-26 15:07   ` Pierre Muller [this message]
2010-04-26 15:20     ` Christopher Faylor
2010-04-26 15:47       ` Pierre Muller
2010-04-26 18:24         ` Christopher Faylor

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='006901cae552$36e27450$a4a75cf0$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --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