3 <title>Debugging with GDB
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Debugging with GDB">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Jumping">Jumping
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Signaling.html#Signaling">Signaling
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Assignment.html#Assignment">Assignment
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"Altering.html#Altering">Altering
</a>
19 <h3 class=
"section">Continuing at a different address
</h3>
21 <p>Ordinarily, when you continue your program, you do so at the place where
22 it stopped, with the
<code>continue
</code> command. You can instead continue at
23 an address of your own choosing, with the following commands:
26 <dt><code>jump
</code><var>linespec
</var><code></code>
27 <dd>Resume execution at line
<var>linespec
</var>. Execution stops again
28 immediately if there is a breakpoint there. See
<a href=
"List.html#List">Printing source lines
</a>, for a description of the different forms of
29 <var>linespec
</var>. It is common practice to use the
<code>tbreak
</code> command
30 in conjunction with
<code>jump
</code>. See
<a href=
"Set-Breaks.html#Set%20Breaks">Setting breakpoints
</a>.
32 <p>The
<code>jump
</code> command does not change the current stack frame, or
33 the stack pointer, or the contents of any memory location or any
34 register other than the program counter. If line
<var>linespec
</var> is in
35 a different function from the one currently executing, the results may
36 be bizarre if the two functions expect different patterns of arguments or
37 of local variables. For this reason, the
<code>jump
</code> command requests
38 confirmation if the specified line is not in the function currently
39 executing. However, even bizarre results are predictable if you are
40 well acquainted with the machine-language code of your program.
42 <br><dt><code>jump *
</code><var>address
</var><code></code>
43 <dd>Resume execution at the instruction at address
<var>address
</var>.
46 <p>On many systems, you can get much the same effect as the
<code>jump
</code>
47 command by storing a new value into the register
<code>$pc
</code>. The
48 difference is that this does not start your program running; it only
49 changes the address of where it
<em>will
</em> run when you continue. For
52 <pre class=
"example"> set $pc =
0x485
55 <p>makes the next
<code>continue
</code> command or stepping command execute at
56 address
<code>0x485</code>, rather than at the address where your program stopped.
57 See
<a href=
"Continuing-and-Stepping.html#Continuing%20and%20Stepping">Continuing and stepping
</a>.
59 <p>The most common occasion to use the
<code>jump
</code> command is to back
60 up--perhaps with more breakpoints set--over a portion of a program
61 that has already executed, in order to examine its execution in more