This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to interrupt a stepping GDB ?


Daniel Jacobowitz <drow@false.org> 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!"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]