From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13481 invoked by alias); 3 Jul 2006 18:28:53 -0000 Received: (qmail 13469 invoked by uid 22791); 3 Jul 2006 18:28:52 -0000 X-Spam-Check-By: sourceware.org Received: from intranet.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.6) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Jul 2006 18:28:49 +0000 Received: (qmail 30444 invoked from network); 3 Jul 2006 18:28:47 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 3 Jul 2006 18:28:47 -0000 To: Sascha Cc: gdb@sourceware.org Subject: Re: How to interrupt a stepping GDB ? References: <20060620122335.GB20079@nevyn.them.org> From: Jim Blandy Date: Mon, 03 Jul 2006 18:28:00 -0000 In-Reply-To: <20060620122335.GB20079@nevyn.them.org> (Daniel Jacobowitz's message of "Tue, 20 Jun 2006 08:23:35 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00000.txt.bz2 Daniel Jacobowitz writes: > On Sun, Jun 18, 2006 at 11:55:19AM +0200, Sascha wrote: >> On a local, fast machine this might be okay. But on a (slow) remote target, >> stepping a loop like this will take minutes or hours because GDB sends >> thousands or even millions of step commands until a == 0; > > [The correct fix for this is to add a "step range" packet, which will > speed up the process immensely. As it happens, I hope to do that for > the next version of GDB after 6.5.] > >> Now the question: If I notice such a case - how can I interrupt GDB? If I >> notice that the stepping would take a long time I'd rather interrupt GDB and >> set a breakpoint on the next line. CTRL-C does not work. And waiting hours >> or shutting down GDB is no acceptable. > > Breakpoint 1, main () at loop.c:3 > 3 int a = 200000; > (gdb) s > 4 for (; a; --a); > (gdb) n > > Program received signal SIGINT, Interrupt. > 0x000000000040043c in main () at loop.c:4 > 4 for (; a; --a); > > CTRL-C works for me... Maybe this has been discussed before, but: Should 'step' stop stepping if the PC fails to make forward progress? In every situation I can think of, that would mean that a loop iteration has been completed. It shouldn't affect loops that cover more than one line. But it might be confusing to the user: "I told it to step, and nothing happened!"