48
Chapter 7. Stopping and Continuing
next [
count
]
Continue to the next source line in the current (innermost) stack frame. This is similar to
step
,
but function calls that appear within the line of code are executed without stopping. Execution
stops when control reaches a different line of code at the original stack level that was executing
when you gave the
next
command. This command is abbreviated
n
.
An argument
count
is a repeat count, as for
step
.
The
next
command only stops at the first instruction of a source line. This prevents multiple
stops that could otherwise occur in
switch
statements,
for
loops, etc.
set step-mode
set step-mode on
The
set step-mode on
command causes the
step
command to stop at the first instruction of
a function which contains no debug line information rather than stepping over it.
This is useful in cases where you may be interested in inspecting the machine instructions of a
function which has no symbolic info and do not want gdb to automatically skip over this function.
set step-mode off
Causes the
step
command to step over any functions which contains no debug information. This
is the default.
finish
Continue running until just after function in the selected stack frame returns. Print the returned
value (if any).
Contrast this with the
return
command (refer to Section 16.4
Returning from a function
).
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
for
-loop is
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......