04.06.2015 Views

Red Hat Developer Toolset 1.x User Guide - Linux

Red Hat Developer Toolset 1.x User Guide - Linux

Red Hat Developer Toolset 1.x User Guide - Linux

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

34 Chapter 3. GNU Debugger (GDB)<br />

print variable_name<br />

Example 3.9. Displaying the Current Values of Variables<br />

Assuming that you have followed the instructions in Example 3.8, “Executing the fibonacci Binary File”<br />

and the execution of the fibonacci binary stopped after reaching the breakpoint at line 10, you can<br />

display the current values of variables a and b as follows:<br />

(gdb) print a<br />

$1 = 0<br />

(gdb) print b<br />

$2 = 1<br />

3.8. Continuing Execution<br />

To resume the execution of the program you are debugging after it reached a breakpoint, run the<br />

following command:<br />

continue<br />

The execution stops again when another breakpoint is reached. To skip a certain number of breakpoints<br />

(typically when you are debugging a loop), you can run the continue command in the following form:<br />

continue number<br />

The gdb utility also allows you to stop the execution after executing a single line of code. To do so, run:<br />

step<br />

Finally, you can execute a certain number of lines by using the step command in the following form:<br />

step number

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!