From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9662 invoked by alias); 20 Mar 2007 13:23:49 -0000 Received: (qmail 9652 invoked by uid 22791); 20 Mar 2007 13:23:47 -0000 X-Spam-Check-By: sourceware.org Received: from hb17.de (HELO ww17.hb17.de) (80.190.209.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 Mar 2007 13:23:41 +0000 Received: from insanenotebook (p57a28a6a.dip0.t-ipconnect.de [87.162.138.106]) by ww17.hb17.de (ww17.hb17.de) with ESMTP id ACE4BFC0D58 for ; Tue, 20 Mar 2007 14:23:37 +0100 (CET) From: "Sascha Radike" To: Subject: Unable to interrupt a stepping GDB Date: Tue, 20 Mar 2007 13:23:00 -0000 Message-ID: <000001c76af2$f9828960$02b2a8c0@insanenotebook> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00228.txt.bz2 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