20.09.2015 Views

Programming in C

Kochan - ProgramminginC

Kochan - ProgramminginC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

406 Chapter 18 Debugg<strong>in</strong>g Programs<br />

month = 11,<br />

day = 16,<br />

year = 2004<br />

}<br />

(gdb)<br />

Here, the function foo is as def<strong>in</strong>ed <strong>in</strong> Program 18.5.<br />

You can assign values to an array or structure by list<strong>in</strong>g them <strong>in</strong>side a set of curly<br />

braces, as follows:<br />

(gdb) pr<strong>in</strong>t array<br />

$14 = {1, 2, 3, 4, 5}<br />

(gdb) set var array = {100, 200}<br />

(gdb) pr<strong>in</strong>t array<br />

$15 = {100, 200, 0, 0} Unspecified values set to zero<br />

(gdb) pr<strong>in</strong>t today<br />

$16 = {<br />

month = 10,<br />

day = 11,<br />

year = 2004<br />

}<br />

(gdb) set var today={8, 8, 2004}<br />

(gdb) pr<strong>in</strong>t today<br />

$17 = {<br />

month = 8,<br />

day = 8,<br />

year = 2004<br />

}<br />

(gdb)<br />

Gett<strong>in</strong>g Help with gdb Commands<br />

You can use the built-<strong>in</strong> help command to get <strong>in</strong>formation about various commands or<br />

types of commands (called classes by gdb).<br />

The command help,without any arguments, lists all the available classes:<br />

(gdb) help<br />

List of classes of commands:<br />

aliases -- Aliases of other commands<br />

breakpo<strong>in</strong>ts -- Mak<strong>in</strong>g program stop at certa<strong>in</strong> po<strong>in</strong>ts<br />

data -- Exam<strong>in</strong><strong>in</strong>g data<br />

files -- Specify<strong>in</strong>g and exam<strong>in</strong><strong>in</strong>g files<br />

<strong>in</strong>ternals -- Ma<strong>in</strong>tenance commands<br />

obscure -- Obscure features<br />

runn<strong>in</strong>g -- Runn<strong>in</strong>g the program<br />

stack -- Exam<strong>in</strong><strong>in</strong>g the stack

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

Saved successfully!

Ooh no, something went wrong!