This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] partially fix PR gdb/17130


On 07/11/2014 05:37 PM, Tom Tromey wrote:

> This patch also fixes a similar bug in target_supports_delete_record.
> 
> Unfortunately this patch doesn't actually fix the PR, because now
> windows-nat.c is using the native target code, which installs
> child_terminal_ours.  Pedro is looking into this.

Your patch makes that message go away from a Quit printed _before_
starting the program, before the target is pushed, on hosts that
don't have job control (such as native Windows).  And that's good.
No SIGINT is ever coming our way in that case.

Well, at least if we don't consider multi-process/multi-target
(we may have the focus on an inferior without execution, but
we may also have other inferiors started).

I got confused when I still saw:

 (gdb) Quit (expect signal SIGINT when the program is resumed)
 (gdb)

on Windows, after starting the program.  That is, after the
Windows native target is pushed.

I've looked at it, and it's not actually a bug.

I wrongly assumed that before the "native" target series that made
windows-nat.c inherit inf-child.c, the Windows target had a NULL
to_terminal_ours, but that turns out to be false.  It's been non-NULL,
for a looooong time, possibly forever.  In 1999, for example, we
already see:

 $ grep to_terminal_ours win32-nat.c
   child_ops.to_terminal_ours_for_output =   terminal_ours_for_output;
   child_ops.to_terminal_ours  =   terminal_ours;

...

  if (job_control
      /* If there is no terminal switching for this target, then we can't
	 possibly get screwed by the lack of job control.  */
      || current_target.to_terminal_ours == NULL)
    fprintf_unfiltered (gdb_stderr, "Quit\n");
  else
    fprintf_unfiltered (gdb_stderr,
	     "Quit (expect signal SIGINT when the program is resumed)\n");


So no regression on Windows there.

I got confused because when using the "system"'s cygwin GDB one
doesn't see that "expect SIGINT" note -- cygwin GDB uses the same
windows-nat.c -- but then, I recalled that Cygwin does have
job control.

Now that I try it out, it's really working as intended,
a SIGINT does really come out once the program is resumed.
On native Windows gdb:

 (gdb) *ctrl-c*
 (gdb) Quit (expect signal SIGINT when the program is resumed)
 (gdb) c
 Continuing.
 [New Thread 4004.0xf44]

 Program received signal SIGINT, Interrupt.
 [Switching to Thread 4004.0xf44]
 0x755073e7 in KERNEL32!CtrlRoutine () from C:\Windows\syswow64\kernel32.dll
 (gdb)

So in sum, the PR fully fixes the issue.  Please update the git log.  :-)

Thanks!

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]