Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: John Cortell <rat042@freescale.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb@sourceware.org, Joel Brobecker <brobecker@adacore.com>
Subject: Re: sending CTRL-C to Cygwin gdb 6.8 has no effect
Date: Sat, 24 Apr 2010 22:30:00 -0000	[thread overview]
Message-ID: <201004242238.o3OMc6O6015080@az33smr01.freescale.net> (raw)
In-Reply-To: <201004240313.12994.pedro@codesourcery.com>

At 09:13 PM 4/23/2010, Pedro Alves wrote:
>I already answered that.  I'll try again.  In the latter case (when CDT
>sends gdb the CTRL-C), if GDB is _not_ sharing a console with the inferior,
>only GDB will get the CTRL_C_EVENT (that's how Windows works).  Before
>the patch that Joel pointed you at (GDB 6.8 does not have that patch),
>a CTRL_C_EVENT sent to GDB when the inferior is running does nothing.

OK. Now I get it. It was the 'themselves' in '[gdb] will catch the
CTRL_C_EVENT themselves' that made me think there was a 
misunderstanding. Now I see we're on the same page.


>The patch Joel pointed you at, made it so that when GDB gets a
>CTRL_C_EVENT, and, gdb knows it is not sharing a console with the
>inferior, then gdb knows that the inferior hasn't seen the CTRL_C_EVENT
>as well, so it needs to take the job of interrupting the inferior
>itself with DebugBreakProcess.  GDB 6.8 does not have that patch
>applied, GDB simply ignores the CTRL_C_EVENT --- it does nothing,
>as you say.  Try a more recent GDB, and things will probably work
>a bit better.  Building a Cygwin GDB is very easy, there's nothing
>to it (install a few devel packages using Cygwin's setup.exp;
>./configure; make).  It would be quite helpful if frontend people
>once in a while tried out top of tree (or recent) GDBs.
>
>In a Windows command shell session (the former case you describe
>as working), GDB _is sharing_ a console with the inferior, so
>ctrl-c generates an event in all processes in the console
>process group.  That is, the inferior also gets a CTRL_C_EVENT
>automatically generated by Windows itself.  GDB intercepts this
>event, like any other debug event, and reports it as SIGINT to the
>frontend.  In this case, GDB _also_ receives the CTRL_C_EVENT event,
>but, since it knows it is sharing the console with the inferior, it
>simply ignores it.  Again, older GDBs, like 6.8, _always_ ignored
>this CTRL_C_EVENT they themselves get; they didn't even install a
>handler.

Great. That makes perfect sense now. So, given the behavior I'm 
seeing, it would seem the gdb that CDT launches is NOT sharing the 
console with the inferior. What is left for me to answer is "why?", 
since that's not what I expect. CDT, through an intermediary launcher 
process, does a  Win32 CreateProcess call to launch gdb. 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. The console 
relationship between gdb and the inferior seems out of the hands of 
CDT. That is, once we establish an mi connection with gdb, we till it 
to load aprogram.exe and run it. We don't specify whether gdb should 
share the console with it. So what's the expected behavior? Again, I 
would expect the two to share the console. After all, they apparently 
do when I carry out the same thing from a Windows command shell 
session. There too, I don't tell gdb to share a console with the 
inferior or not, and apparently it does.

OK. I'll give building cygwin gdb from HEAD a try, so I can have it 
around for reference. I appreciate your time on these questions, BTW. 
We're having a hell of a time interrupting the debugged program and 
hopefully this will help me get to the bottom of it.

John 



  reply	other threads:[~2010-04-24 22:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 19:33 John Cortell
2010-04-23 19:44 ` Joel Brobecker
2010-04-23 19:57   ` John Cortell
2010-04-23 20:11     ` Joel Brobecker
2010-04-23 20:27       ` John Cortell
2010-04-24  1:10         ` Pedro Alves
2010-04-24  1:58           ` John Cortell
2010-04-24  2:13             ` Pedro Alves
2010-04-24 22:30               ` John Cortell [this message]
2010-04-24 23:56                 ` Dave Korn
2010-04-25 14:10                   ` John Cortell
2010-04-25 21:25                     ` Pedro Alves
2010-04-26  6:22                       ` Christopher Faylor
2010-04-26 11:38                         ` Pierre Muller
2010-04-26 14:30                           ` Christopher Faylor
     [not found]                       ` <201004261330.o3QDUfph028936@az33smr01.freescale.net>
2010-04-26 13:37                         ` 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=201004242238.o3OMc6O6015080@az33smr01.freescale.net \
    --to=rat042@freescale.com \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@codesourcery.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