Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Unable to interrupt a stepping GDB
@ 2007-03-20 13:23 Sascha Radike
  2007-03-20 13:55 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Radike @ 2007-03-20 13:23 UTC (permalink / raw)
  To: gdb

Hi,

I have simple C code line like this (it might work with other long running
"steps", too):

for (; a; --a);

with "a" being set to a high value.

When I execute 'next' GDB will step until it reaches the next line (which
takes time, of course). GDB will fire alot of 's' packets to the remote stub
until "a" is down to zero. There are times when I want to interrupt the
target by hitting 'CTRL-C'.

This works about 66% of the time. Result:

Program received signal SIGINT, Interrupt.
0x00200068 in delay (a=10) at ../src/loop.c:16
16        for (;a ;--a);

Unfortunately there are quite some situations when hitting 'CTRL-C' does NOT
work. GDB just does not stop. This is quite an issue when used by the
Eclipse CDT/MI, but it also happens on the command line.

On the command line GDB it is possible to hit 'CTRL-C' severeal times or
just hold down the keys and GDB will stop after a while with a result like
this:

Program received signal SIGINT, Interrupt.
0x00200068 in delay (a=10) at ../src/loop.c:16
16        for (;a ;--a);
(gdb) Quit (expect signal SIGINT when the program is resumed)

***
I think it might be a bug. In remote.c: remote_wait (...) it says:

      ofunc = signal (SIGINT, remote_interrupt);
      getpkt (&rs->buf, &rs->buf_size, 1);
      signal (SIGINT, ofunc);

So I guess GDB does only listen for SIGINT correctly while waiting for the
stub to stop. But what happens if the user hits 'CTRL-C' after getpkt and
before sending the next 's' step packet to the stub ? A long running step
operation might send thousands of 's' step packets, so the chances are quite
high the user might hit CTRL-C at the "wrong time": after getpkt.

Should I raise a bug ? Does anyone know how to fix this?

Thanks

Sascha


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unable to interrupt a stepping GDB
  2007-03-20 13:23 Unable to interrupt a stepping GDB Sascha Radike
@ 2007-03-20 13:55 ` Daniel Jacobowitz
       [not found]   ` <000001c76b15$3a2c3750$02b2a8c0@insanenotebook>
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-03-20 13:55 UTC (permalink / raw)
  To: Sascha Radike; +Cc: gdb

On Tue, Mar 20, 2007 at 02:23:38PM +0100, Sascha Radike wrote:
> Should I raise a bug ? Does anyone know how to fix this?

Not offhand, but I agree that it should be fixed.  Our way of
handling user Control-C is very complicated, though.

There's a "QUIT;" in resume() already.  It looks like that's supposed
to accomplish what you want, but we're not setting the flag it checks
in time.  I guess the question is which of the various SIGINT handlers
is running for you.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Unable to interrupt a stepping GDB
       [not found]     ` <20070320173306.GA10566@caradoc.them.org>
@ 2007-03-21  8:00       ` Sascha Radike
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Radike @ 2007-03-21  8:00 UTC (permalink / raw)
  To: 'Daniel Jacobowitz', gdb

>Are you working with GDB from CVS, or an older release?  If not CVS,
please try it - it may be fixed.

Yay! In the current CVS it has been fixed.

There's just one flaw: GDB does now print "QUIT (Expect SIGINT when..." as
error when the target has been stopped by pressing CTRL-C. This causes the
Eclipse CDT (based on MI) to popup an error dialog. I don't think
interrupting a stepping process is a "fatal error".

Anyway, this can easily be hacked for my needs so it is not a major problem.
The CDT community might prefer a different solution though. Maybe it can be
addressed in the future.

Thanks!

Sascha



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-21  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-20 13:23 Unable to interrupt a stepping GDB Sascha Radike
2007-03-20 13:55 ` Daniel Jacobowitz
     [not found]   ` <000001c76b15$3a2c3750$02b2a8c0@insanenotebook>
     [not found]     ` <20070320173306.GA10566@caradoc.them.org>
2007-03-21  8:00       ` Sascha Radike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox