l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 10: LUGOD Installfests coming again soon
Page last updated:
2002 Sep 19 21:31

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] gdb: until doesn't work as advertised?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] gdb: until doesn't work as advertised?



from the gdb user manual:

until
-----
Continue running until a source line past the current line, in the
current stack frame, is reached. This command is used to avoid single
stepping through a loop more than once. It is like the next command,
except that when until encounters a jump, it automatically continues
execution until the program counter is greater than the address of the
jump. This means that when you reach the end of a loop after single
stepping though it, until makes your program continue execution until it
exits the loop.


now consider the following code:

#include <stdio.h>     line 1

int main(void)
{
   int i=0, j=0;
   scanf("%d", &i);

   while (i) {         line 8
      --i;             line 9
      ++j;             line 10
   }                   line 11
                       line 12
   return 0;
}


if you place a breakpoint at line 9  "--i;", then:

run
5

then use until, then gdb will go through the loop 5 times, just like how
next would.   i let the user input what "i" is so that gcc wouldn't
unroll the loop.  but until STILL isn't working as advertised.

also, "until 12" doesn't leave the while loop either, however, "until
12" does.

any comments?   does until only "work" on for loops?

pete
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!