gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdb "hangs" on delay loop


From: Gene Smith
Subject: Re: gdb "hangs" on delay loop
Date: Tue, 05 May 2009 11:39:00 -0400
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

Charles Manning wrote:
On Saturday 02 May 2009 07:03:10 Gene Smith wrote:
With -O0 opt level, gdb refuses to step (S) over a delay loop like this:

code1; //<-- steps over this OK
for(c=0; c<10000; c++);   //<--- hangs here
code2;

If I control-c and examine c it seems to be increasing slowly.

When I change the code structure like this:

code1;
for(c=0; c<10000; )
        c++;
code2;

then I can step.

This is with embedded arm. See the same thing with arm-insight and
arm-gdb. Haven't tried this with native.

Is this to be expected?

The stepping in ARM, and perhaps other CPUs, is prone to getting stuck like this.

To get out of this either:
* restructure code
* set break at the next line and continue.
* -if you're brave - try improve gdb :-).


It seems to be "stepping" 10000 times in the background to get over this instruction so it will take a while. I think I verified this by setting c to 9995 and it took just a short time to step to the next source line. I think another "improvement" would be to eliminate erratic stepping when optimization is applied (if that is possible).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]