summaryrefslogtreecommitdiff
path: root/reference/C/GDB/gdb.html
blob: 5d1ff6998a8a2c8c9634ec8b8764e2fbc886663d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<title>GDB Debugger</title>
<head>
<script language="JavaScript">
</script>
</head>
<body bgcolor="#ffffcc">
<hr>
<center>
<h1>GDB Debugger</h1>
</center>
<hr>
<p>
The other common debug programs on Unix systems are dbx and dbxtool.<p>
Before a program can be processed by the debugger, it must be compiled 
with the debugger option.
<pre>
	gcc -ggdb -o pipe pipe.c
</pre>
The program can then be passed to the debugger with
<pre>
	gdb pipe
</pre>
To pass command line parameters to the program use:
<pre>
	set args -size big
</pre>
This is equivalent to saying:
<pre>
	pipe -size big
</pre>
To single step:
<pre>
	break
	run
	step
</pre>
The <b>step</b> command stops execution at the next source statement,
if that statement is a function call, gdb will single step into the function.
<br>
 A simular command is <b>next</b> this will also single step source 
statements but when a it meets a function call, the function is executed 
and gdb stops when it reaches a new source statement in the calling 
function.
<p>
<b>step</b> can be abreviated to <b>s</b>
<br>
<b>next</b> can be abreviated to <b>n</b>
<p> 
To set break points:
<pre>
	break 48	<-- Program will stop BEFORE executing line 48
	break FuncName  <-- Program will stop when entering the function
	run
</pre>
To display the contents of a variable:
<pre>
	print ant[0]
</pre>
	
To change the value of a variable:
<pre>
	set ant[0] = 4
	set char = 'z'
</pre>

<p>
<hr>
<p>
<center>
<table border=2 width=80% bgcolor="ivory">
<tr align=center>
<td width=25%>
<a href=../cref.html>                  Top</a>
</td><td width=25%>
<a href=../master_index.html>          Master Index</a>
</td><td width=25%>
<a href=../SYNTAX/keywords.html>                 Keywords</a>
</td><td width=25%>
<a href=../FUNCTIONS/funcref.htm>     Functions</a>
</td>
</tr>
</table>
</center>
<p>
<hr>
<address>Martin Leslie 
</address><p>