From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20101 invoked by alias); 25 Apr 2010 21:25:23 -0000 Received: (qmail 20087 invoked by uid 22791); 25 Apr 2010 21:25:21 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 25 Apr 2010 21:25:17 +0000 Received: (qmail 19906 invoked from network); 25 Apr 2010 21:25:15 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 25 Apr 2010 21:25:15 -0000 From: Pedro Alves To: John Cortell Subject: Re: sending CTRL-C to Cygwin gdb 6.8 has no effect Date: Sun, 25 Apr 2010 21:25:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: Dave Korn , gdb@sourceware.org, Joel Brobecker References: <201004231941.o3NJfbWR021914@az33smr01.freescale.net> <4BD389B3.2030409@gmail.com> <201004251418.o3PEIBMG000580@az33smr01.freescale.net> In-Reply-To: <201004251418.o3PEIBMG000580@az33smr01.freescale.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004252225.08587.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00133.txt.bz2 On Sunday 25 April 2010 15:09:22, John Cortell wrote: > 1. I ruled out POSIX emulation in the inferior being a factor by > debugging a MinGW-built program. No change in behavior.CTRL-C to gdb > programatically has no effect. Okay, at this point, we have some confusion in terminology. When you say "CTRL-C to GDB", I assume a CTRL_C_EVENT with GenerateConsoleCtrlEvent. Sending a SIGINT (Cygwin) signal is a different story. It is important that we understand exactly what is what you're doing. On Saturday 24 April 2010 23:29:21, John Cortell wrote: > The call > specifies whether to launch it attached or not, and if attached, > whether to share the console. Fine, but that is between CDT's > launcher process and gdb, not gdb and the inferior. But, is there a console to share at all? Does the launcher create one (even if hidden)? Are you using "tty"/"set inferior-tty" so GDB makes the inferior use it? On Sunday 25 April 2010 15:09:22, John Cortell wrote: > So, I decided to look at how we send the CTRL-C to gdb. If the > program spawned by our launcher is using the cygwin runtime dll, we > run a 'kill -SIGINT '. In this case, the launched program is > cygwin's gdb, which does use the cygwin runtime, so that's what we > end up doing. And for sure, this command isn't interrupting either > gdb or the inferior. Looking at the code, this will not work with a Windows GDB in the case of the inferior having been attaced to ("attach" vs "run"). Not even when debugging a Cygwin inferior with a Cygwin GDB. That works with native debugging on linux (and other unixen), because those GDB ports install a SIGINT handler that forwards the SIGINT to the inferior, whenever the inferior is running. This is all these set_sigint_trap calls do: >grep --exclude="ChangeLog*" set_sigint_trap *.c darwin-nat.c: /* set_sigint_trap (); */ inflow.c:/* Call set_sigint_trap when you need to pass a signal on to an attached inflow.c:set_sigint_trap (void) inf-ptrace.c: set_sigint_trap (); inf-ttrace.c: set_sigint_trap (); linux-nat.c: set_sigint_trap (); linux-nat.c: set_sigint_trap (); rs6000-nat.c: set_sigint_trap (); spu-linux-nat.c: set_sigint_trap (); /* Causes SIGINT to be passed on to the Note there's none in `windows-nat.c'. I suppose that if we added them to windows-nat.c, sending a real Cygwin SIGINT to GDB would indeed forward it succesfully the inferior, but iff the inferior is also a Cygwin program. It wouldn't work with a Cygwin GDB x MinGW inferior, of course. > 2. I added 'set new-console off' in the .gdbinit file (and confirmed > it took effect with a 'show new-console' at debug time). No change in behavior. "off" is the default.. -- Pedro Alves