Chapter 16. Altering Execution
137
jump *
address
Resume execution at the instruction at address
address
.
On many systems, you can get much the same effect as the
jump
command by storing a new value
into the register
$pc
. The difference is that this does not start your program running; it only changes
the address of where it
will
run when you continue. For example,
set $pc = 0x485
makes the next
continue
command or stepping command execute at address
0x485
, rather than at
the address where your program stopped. Refer to Section 7.2
Continuing and stepping
.
The most common occasion to use the
jump
command is to back up--perhaps with more breakpoints
set--over a portion of a program that has already executed, in order to examine its execution in more
detail.
16.3. Giving your program a signal
signal
signal
Resume execution where your program stopped, but immediately give it the signal
signal
.
signal
can be the name or the number of a signal. For example, on many systems
signal 2
and
signal SIGINT
are both ways of sending an interrupt signal.
Alternatively, if
signal
is zero, continue execution without giving a signal. This is useful when
your program stopped on account of a signal and would ordinary see the signal when resumed
with the
continue
command;
signal 0
causes it to resume without a signal.
signal
does not repeat when you press [RET] a second time after executing the command.
Invoking the
signal
command is not the same as invoking the
kill
utility from the shell. Sending
a signal with
kill
causes gdb to decide what to do with the signal depending on the signal handling
tables (refer to Section 7.3
Signals
). The
signal
command passes the signal directly to your program.
16.4. Returning from a function
return
return
expression
You can cancel execution of a function call with the
return
command. If you give an
expression
argument, its value is used as the function’s return value.
When you use
return
, gdb discards the selected stack frame (and all frames within it). You can think
of this as making the discarded frame return prematurely. If you wish to specify a value to be returned,
give that value as the argument to
return
.
This pops the selected stack frame (refer to Section 8.3
Selecting a frame
), and any other frames inside
of it, leaving its caller as the innermost remaining frame. That frame becomes selected. The specified
value is stored in the registers used for returning values of functions.
The
return
command does not resume execution; it leaves the program stopped in the state that
would exist if the function had just returned. In contrast, the
finish
command (refer to Section 7.2
Continuing and stepping
) resumes execution until the selected stack frame returns naturally.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......