until, u | 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. In contrast, a next command |
| at the end of a loop simply steps back to the beginning of the |
| loop, which forces you to step through the next iteration. |
| until always stops your program if it attempts to exit the |
| current stack frame. |
| until may produce somewhat counterintuitive results if the |
| order of machine code does not match the order of the source |
| lines. For example, in the following excerpt from a debugging |
| session, the f (frame) command shows that execution is stopped |
| at line 206; yet when we use until, we get to line 195: |
| ((gdb)) f |
| #0 main (argc=4, argv=0xf7fffae8) at m4.c:206 |
| 206 expand_input(); |
| ((gdb)) until |
| 195 for ( ; argc > 0; NEXTARG) { |
| This happened because, for execution efficiency, the compiler |
| had generated code for the loop closure test at the end, rather |
| than the start, of the loop―even though the test in a C |
| is written before the body of the loop. The until command |
| appeared to step back to the beginning of the loop when it |
| advanced to this expression; however, it has not really gone to |
| an earlier statement―not in terms of the actual machine code. |
| until with no argument works by means of single instruction |
| stepping, and hence is slower than until with an argument. |
until location, | Continue running your program until either the specified |
u location | location is reached, or the current stack frame returns. location |
| is any of the forms of argument acceptable to break (see |
| “Setting breakpoints” (page 52)). This form of the command |
| uses breakpoints, and hence is quicker than until without an |
| argument. |
66 Stopping and Continuing