Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Sascha Radike" <sascha@pasalacqua.de>
To: <gdb@sourceware.org>
Subject: Unable to interrupt a stepping GDB
Date: Tue, 20 Mar 2007 13:23:00 -0000	[thread overview]
Message-ID: <000001c76af2$f9828960$02b2a8c0@insanenotebook> (raw)

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


             reply	other threads:[~2007-03-20 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 13:23 Sascha Radike [this message]
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

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='000001c76af2$f9828960$02b2a8c0@insanenotebook' \
    --to=sascha@pasalacqua.de \
    --cc=gdb@sourceware.org \
    /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