Re: gdb "hangs" on delay loop
Charles Manning <[email protected]> Mon, 4 May 2009 11:14:11 +1200
| Newsgroups | gmane.comp.gdb.general |
|---|---|
| Message-ID | <[email protected]> |
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 :-).