GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
When running a Windows application from GDB, GDB gives control to the
application at a certain point.  It would be nice to, at an arbitrary
time, suspend the application and give control back to GDB.  I know
that I can set breakpoints, but sometimes I don't know exactly when I
want to break until after I'm running the application.  Ctrl-C
supposedly sends the SIGINT signal to GDB, breaking the running
application and restoring control to GDB.  However, this does not
appear to work, at least not on Cygwin.

I've tried /bin/kill -f -s SIGINT pid.  Sending SIGINT, or in fact any
other signal, simply terminates the Windows application.

I even wrote a simple program to suspend the Windows application at my
command using the Win32 API function SuspendThread.  While the program
does indeed suspend, GDB remains locked.

Perhaps there is some way to, using the Windows API, simulate a SIGINT
signal, or another signal to break the program (perhaps SIGSEGV would
be easiest).  Perhaps GDB could be modified in some way--it could map
Windows messages to UNIX signals.  Or maybe it could look for
keystrokes using Windows hooks rather than its current method (I'm not
even entirely sure what its current method is).  If anyone thinks any
of these methods would be feasible, I would be happy to contribute
code.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: GDB Interrupts on Cygwin

2006-03-17 Thread Dave Korn
On 17 March 2006 08:55, Doug Bohl wrote:

 When running a Windows application from GDB,

 Ctrl-C
 supposedly sends the SIGINT signal to GDB, breaking the running
 application and restoring control to GDB.  However, this does not
 appear to work, at least not on Cygwin.
 
 I've tried /bin/kill -f -s SIGINT pid.  Sending SIGINT, or in fact any
 other signal, simply terminates the Windows application.

  It's not entirely surprising that windows applications aren't aware of
cygwin signal handling!

  Have you tried running it with a mingw (i.e. windows native) version of gdb?


cheers,
  DaveK
-- 
Can't think of a witty .sigline today


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Bob Rossi
On Fri, Mar 17, 2006 at 03:55:08AM -0500, Doug Bohl wrote:
 When running a Windows application from GDB, GDB gives control to the
 application at a certain point.  It would be nice to, at an arbitrary
 time, suspend the application and give control back to GDB.  I know
 that I can set breakpoints, but sometimes I don't know exactly when I
 want to break until after I'm running the application.  Ctrl-C
 supposedly sends the SIGINT signal to GDB, breaking the running
 application and restoring control to GDB.  However, this does not
 appear to work, at least not on Cygwin.

Even though this may seem strange, try this. Before starting GDB, type
'tty' at the console. Then, after you start GDB, run the command 'tty
outputofttycommandfromconsole'. I think this will enable the ^c.

It's a bug in GDB that hopefully I'll get to look at one day.

Bob Rossi

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Christopher Faylor
On Fri, Mar 17, 2006 at 06:56:55AM -0500, Bob Rossi wrote:
On Fri, Mar 17, 2006 at 03:55:08AM -0500, Doug Bohl wrote:
 When running a Windows application from GDB, GDB gives control to the
 application at a certain point.  It would be nice to, at an arbitrary
 time, suspend the application and give control back to GDB.  I know
 that I can set breakpoints, but sometimes I don't know exactly when I
 want to break until after I'm running the application.  Ctrl-C
 supposedly sends the SIGINT signal to GDB, breaking the running
 application and restoring control to GDB.  However, this does not
 appear to work, at least not on Cygwin.

Even though this may seem strange, try this. Before starting GDB, type
'tty' at the console. Then, after you start GDB, run the command 'tty
outputofttycommandfromconsole'. I think this will enable the ^c.

This is a no-voodoo zone.

CTRL-C works fine in gdb.  I use it ALL of the time.

Maybe the OP has CYGWIN=tty set or is trying to run from rxvt.  If so,
don't do that.  Run gdb from a windows console and it should work fine.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Bob Rossi
On Fri, Mar 17, 2006 at 10:15:13AM -0500, Christopher Faylor wrote:
 On Fri, Mar 17, 2006 at 06:56:55AM -0500, Bob Rossi wrote:
 On Fri, Mar 17, 2006 at 03:55:08AM -0500, Doug Bohl wrote:
  When running a Windows application from GDB, GDB gives control to the
  application at a certain point.  It would be nice to, at an arbitrary
  time, suspend the application and give control back to GDB.  I know
  that I can set breakpoints, but sometimes I don't know exactly when I
  want to break until after I'm running the application.  Ctrl-C
  supposedly sends the SIGINT signal to GDB, breaking the running
  application and restoring control to GDB.  However, this does not
  appear to work, at least not on Cygwin.
 
 Even though this may seem strange, try this. Before starting GDB, type
 'tty' at the console. Then, after you start GDB, run the command 'tty
 outputofttycommandfromconsole'. I think this will enable the ^c.
 
 This is a no-voodoo zone.
 
 CTRL-C works fine in gdb.  I use it ALL of the time.
 
 Maybe the OP has CYGWIN=tty set or is trying to run from rxvt.  If so,
 don't do that.  Run gdb from a windows console and it should work fine.

O, right. Sorry. The bug I was talking about only appears when you
fork/exec GDB from within a program.

Bob Rossi

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
Yes, I'm running it from a Windows console.  I had CYGWIN=tty, but
I've now removed it, and Ctrl-C still isn't working.

I tried the MinGW version of GDB.  Still no Ctrl-C.  I tried Bob's tty
'voodoo'.  Still no Ctrl-C.

I'm using GDB 6.3.50_2004-12-28-cvs (cygwin-special), I have also
compiled GDB 6.4 but it crashes immediately upon trying to debug a
program (I'm not interested in solving this problem for now).

For anyone who has gotten Ctrl-C to work on Cygwin: what version of
GDB are you using?

On 3/17/06, Christopher Faylor [EMAIL PROTECTED] wrote:
 On Fri, Mar 17, 2006 at 06:56:55AM -0500, Bob Rossi wrote:
 On Fri, Mar 17, 2006 at 03:55:08AM -0500, Doug Bohl wrote:
  When running a Windows application from GDB, GDB gives control to the
  application at a certain point.  It would be nice to, at an arbitrary
  time, suspend the application and give control back to GDB.  I know
  that I can set breakpoints, but sometimes I don't know exactly when I
  want to break until after I'm running the application.  Ctrl-C
  supposedly sends the SIGINT signal to GDB, breaking the running
  application and restoring control to GDB.  However, this does not
  appear to work, at least not on Cygwin.
 
 Even though this may seem strange, try this. Before starting GDB, type
 'tty' at the console. Then, after you start GDB, run the command 'tty
 outputofttycommandfromconsole'. I think this will enable the ^c.

 This is a no-voodoo zone.

 CTRL-C works fine in gdb.  I use it ALL of the time.

 Maybe the OP has CYGWIN=tty set or is trying to run from rxvt.  If so,
 don't do that.  Run gdb from a windows console and it should work fine.

 cgf

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Christopher Faylor
On Fri, Mar 17, 2006 at 02:11:54PM -0500, Doug Bohl wrote:
Yes, I'm running it from a Windows console.  I had CYGWIN=tty, but
I've now removed it, and Ctrl-C still isn't working.

What does I've removed it mean?  You can't just unset it in a bash shell.
You have to remove it before any cygwin program runs.

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: GDB Interrupts on Cygwin

2006-03-17 Thread Doug Bohl
I know.  I removed it using the Environment Variables option in My
Computer, logged off, and logged back on, went into Cygwin, and
checked the $CYGWIN variable.  tty was no longer there.

On 3/17/06, Christopher Faylor [EMAIL PROTECTED] wrote:
 On Fri, Mar 17, 2006 at 02:11:54PM -0500, Doug Bohl wrote:
 Yes, I'm running it from a Windows console.  I had CYGWIN=tty, but
 I've now removed it, and Ctrl-C still isn't working.

 What does I've removed it mean?  You can't just unset it in a bash shell.
 You have to remove it before any cygwin program runs.

 cgf

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/