-
DebuggingWithGDB 6.8-2008下载
资源介绍
Table of Contents
Summary of gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Free Software Needs Free Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Contributors to gdb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1 A Sample gdb Session . . . . . . . . . . . . . . . . . . . . . . 7
2 Getting In and Out of gdb . . . . . . . . . . . . . . . . 11
2.1 Invoking gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.1 Choosing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.2 Choosing Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1.3 What gdb Does During Startup . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Quitting gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Shell Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Logging Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
11
12
13
15
16
16
16
gdb Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1 Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Command Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4
Running Programs Under gdb . . . . . . . . . . . . . 25
4.1 Compiling for Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Starting your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Your Program’s Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4 Your Program’s Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5 Your Program’s Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6 Your Program’s Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7 Debugging an Already-running Process . . . . . . . . . . . . . . . . . . . . . .
4.8 Killing the Child Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9 Debugging Programs with Multiple Threads . . . . . . . . . . . . . . . . . .
4.10 Debugging Programs with Multiple Processes. . . . . . . . . . . . . . . .
4.11 Setting a Bookmark to Return to Later . . . . . . . . . . . . . . . . . . . . .
4.11.1 A Non-obvious Benefit of Using Checkpoints . . . . . . . . . . . .
5
25
26
28
28
29
29
30
31
31
34
36
37
Stopping and Continuing . . . . . . . . . . . . . . . . . . 39
5.1 Breakpoints, Watchpoints, and Catchpoints . . . . . . . . . . . . . . . . . .
5.1.1 Setting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.2 Setting Watchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.3 Setting Catchpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.4 Deleting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
40
45
47
49
ii
Debugging with gdb
5.1.5 Disabling Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.6 Break Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.7 Breakpoint Command Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.8 “Cannot insert breakpoints” . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.9 “Breakpoint address adjusted...” . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Continuing and Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 Stopping and Starting Multi-thread Programs . . . . . . . . . . . . . . . .
6
Examining the Stack . . . . . . . . . . . . . . . . . . . . . . 61
6.1
6.2
6.3
6.4
7
Stack Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Backtraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Selecting a Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Information About a Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
61
62
64
65
Examining Source Files . . . . . . . . . . . . . . . . . . . 67
7.1 Printing Source Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2 Specifying a Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3 Editing Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.1 Choosing your Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4 Searching Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5 Specifying Source Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.6 Source and Machine Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
49
50
52
53
53
54
57
59
67
68
69
69
70
70
72
Examining Data . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8.1 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Ambiguous Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.3 Program Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.4 Artificial Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.5 Output Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.6 Examining Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.7 Automatic Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.8 Print Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.9 Value History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.10 Convenience Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.11 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.12 Floating Point Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.13 Vector Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.14 Operating System Auxiliary Information . . . . . . . . . . . . . . . . . . . .
8.15 Memory Region Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.15.1 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.15.1.1 Memory Access Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.15.1.2 Memory Access Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.15.1.3 Data Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.15.2 Memory Access Checking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.16 Copy Between Memory and a File . . . . . . . . . . . . . . . . . . . . . . . . . .
8.17 How to Produce a Core File from Your Program . . . . . . . . . . . . .
75
76
77
79
79
81
82
84
90
90
92
93
94
94
94
95
95
96
96
96
96
97
iii
8.18 Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
8.19 Caching Data of Remote Targets . . . . . . . . . . . . . . . . . . . . . . . . . . 100
8.20 Search Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
9 C Preprocessor Macros . . . . . . . . . . . . . . . . . . 103
10 Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.1 Commands to Set Tracepoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.1 Create and Delete Tracepoints . . . . . . . . . . . . . . . . . . . . . . . .
10.1.2 Enable and Disable Tracepoints . . . . . . . . . . . . . . . . . . . . . . .
10.1.3 Tracepoint Passcounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.4 Tracepoint Action Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.5 Listing Tracepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.6 Starting and Stopping Trace Experiments . . . . . . . . . . . . .
10.2 Using the Collected Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.1 tfind n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.2 tdump. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.3 save-tracepoints filename . . . . . . . . . . . . . . . . . . . . . . . .
10.3 Convenience Variables for Tracepoints . . . . . . . . . . . . . . . . . . . . .
11
Debugging Programs That Use Overlays
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.1
11.2
11.3
11.4
12
107
107
108
108
109
110
110
111
111
113
114
114
How Overlays Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overlay Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Automatic Overlay Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overlay Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
115
116
118
119
Using gdb with Different Languages . . . . . 121
12.1 Switching Between Source Languages . . . . . . . . . . . . . . . . . . . . . .
12.1.1 List of Filename Extensions and Languages . . . . . . . . . . . .
12.1.2 Setting the Working Language . . . . . . . . . . . . . . . . . . . . . . . .
12.1.3 Having gdb Infer the Source Language . . . . . . . . . . . . . . . .
12.2 Displaying the Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.3 Type and Range Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.3.1 An Overview of Type Checking . . . . . . . . . . . . . . . . . . . . . . .
12.3.2 An Overview of Range Checking . . . . . . . . . . . . . . . . . . . . . .
12.4 Supported Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1 C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.1 C and C++ Operators . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.2 C and C++ Constants . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.3 C++ Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.4 C and C++ Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.5 C and C++ Type and Range Checks . . . . . . . . . . . . . .
12.4.1.6 gdb and C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.7 gdb Features for C++ . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.1.8 Decimal Floating Point format . . . . . . . . . . . . . . . . . . .
12.4.2 Objective-C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
121
121
122
122
122
123
123
124
125
125
126
127
128
129
129
129
130
131
131
iv
Debugging with gdb
12.4.2.1 Method Names in Commands . . . . . . . . . . . . . . . . . . . .
12.4.2.2 The Print Command With Objective-C . . . . . . . . . . .
12.4.3 Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.3.1 Fortran Operators and Expressions . . . . . . . . . . . . . . .
12.4.3.2 Fortran Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.3.3 Special Fortran Commands . . . . . . . . . . . . . . . . . . . . . .
12.4.4 Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5 Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5.1 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5.2 Built-in Functions and Procedures . . . . . . . . . . . . . . . .
12.4.5.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5.4 Modula-2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5.5 Modula-2 Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.5.6 Deviations from Standard Modula-2 . . . . . . . . . . . . . .
12.4.5.7 Modula-2 Type and Range Checks . . . . . . . . . . . . . . .
12.4.5.8 The Scope Operators :: and . . . . . . . . . . . . . . . . . . . .
12.4.5.9 gdb and Modula-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.6 Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.6.2 Omissions from Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.6.3 Additions to Ada . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4.6.4 Stopping at the Very Beginning . . . . . . . . . . . . . . . . . .
12.4.6.5 Known Peculiarities of Ada Mode . . . . . . . . . . . . . . . .
12.5 Unsupported Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
131
132
132
132
133
133
133
133
133
135
136
136
138
138
138
139
139
139
139
140
141
143
143
143
13 Examining the Symbol Table . . . . . . . . . . . . 145
14 Altering Execution . . . . . . . . . . . . . . . . . . . . . 151
14.1
14.2
14.3
14.4
14.5
14.6
15
Assignment to Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Continuing at a Different Address . . . . . . . . . . . . . . . . . . . . . . . . .
Giving your Program a Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Returning from a Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Calling Program Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Patching Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
151
152
153
153
154
154
gdb Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.1 Commands to Specify Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.2 Debugging Information in Separate Files . . . . . . . . . . . . . . . . . . . 163
15.3 Errors Reading Symbol Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
16
Specifying a Debugging Target . . . . . . . . . . 169
16.1 Active Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
16.2 Commands for Managing Targets . . . . . . . . . . . . . . . . . . . . . . . . . . 170
16.3 Choosing Target Byte Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
v
17
Debugging Remote Programs . . . . . . . . . . . 173
17.1 Connecting to a Remote Target . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.2 Sending files to a remote system . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3 Using the gdbserver Program . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3.1 Running gdbserver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3.1.1 Attaching to a Running Program . . . . . . . . . . . . . . . . .
17.3.1.2 Multi-Process Mode for gdbserver . . . . . . . . . . . . . . .
17.3.1.3 Other Command-Line Arguments for gdbserver . .
17.3.2 Connecting to gdbserver . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3.3 Monitor Commands for gdbserver . . . . . . . . . . . . . . . . . . . .
17.4 Remote Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.5 Implementing a Remote Stub . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.5.1 What the Stub Can Do for You . . . . . . . . . . . . . . . . . . . . . . .
17.5.2 What You Must Do for the Stub . . . . . . . . . . . . . . . . . . . . . .
17.5.3 Putting it All Together. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
173
175
175
175
176
176
177
177
177
178
181
182
183
184
Configuration-Specific Information . . . . . . . 185
18.1 Native. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1.1 HP-UX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1.2 BSD libkvm Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1.3 SVR4 Process Information . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1.4 Features for Debugging djgpp Programs . . . . . . . . . . . . . .
18.1.5 Features for Debugging MS Windows PE Executables . .
18.1.5.1 Support for DLLs without Debugging Symbols . . . .
18.1.5.2 DLL Name Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.1.5.3 Working with Minimal Symbols . . . . . . . . . . . . . . . . . .
18.1.6 Commands Specific to gnu Hurd Systems . . . . . . . . . . . . .
18.1.7 QNX Neutrino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2 Embedded Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1 Using gdb with VxWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1.1 Connecting to VxWorks . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1.2 VxWorks Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1.3 Running Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3 Embedded Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.1 ARM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.2 Renesas M32R/D and M32R/SDI . . . . . . . . . . . . . . . . . . . . .
18.3.3 M68k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.4 MIPS Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.5 OpenRISC 1000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.6 PowerPC Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.7 HP PA Embedded . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.8 Tsqware Sparclet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.8.1 Setting File to Debug . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.8.2 Connecting to Sparclet . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.8.3 Sparclet Download . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.8.4 Running and Debugging . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.9 Fujitsu Sparclite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.10 Zilog Z8000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
185
185
185
185
187
189
190
190
191
192
194
194
194
195
195
196
196
196
198
199
199
201
203
204
204
204
205
205
205
205
205
vi
Debugging with gdb
18.3.11 Atmel AVR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.12 CRIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3.13 Renesas Super-H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4 Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4.1 x86 Architecture-specific Issues . . . . . . . . . . . . . . . . . . . . . . .
18.4.2 A29K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4.3 Alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4.4 MIPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4.5 HPPA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4.6 Cell Broadband Engine SPU architecture . . . . . . . . . . . . . .
18.4.7 PowerPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
Controlling gdb . . . . . . . . . . . . . . . . . . . . . . . . 211
19.1
19.2
19.3
19.4
19.5
19.6
19.7
19.8
20
206
206
207
207
207
207
207
208
209
209
210
Prompt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Command Editing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Command History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Screen Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuring the Current ABI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optional Warnings and Messages . . . . . . . . . . . . . . . . . . . . . . . . . .
Optional Messages about Internal Happenings . . . . . . . . . . . . . .
211
211
211
213
214
214
215
217
Canned Sequences of Commands . . . . . . . . 221
20.1
20.2
20.3
20.4
User-defined Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User-defined Command Hooks. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Command Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Commands for Controlled Output . . . . . . . . . . . . . . . . . . . . . . . . .
221
222
223
224
21 Command Interpreters . . . . . . . . . . . . . . . . . . 227
22 gdb Text User Interface . . . . . . . . . . . . . . . . . 229
22.1
22.2
22.3
22.4
22.5
23
TUI Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TUI Key Bindings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TUI Single Key Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TUI-specific Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TUI Configuration Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
229
230
231
231
233
Using gdb under gnu Emacs . . . . . . . . . . . . 235
vii
24
The gdb/mi Interface . . . . . . . . . . . . . . . . . . . 237
Function and Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Notation and Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3 gdb/mi Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3.1 gdb/mi Input Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3.2 gdb/mi Output Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.4 gdb/mi Compatibility with CLI . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.5 gdb/mi Development and Front Ends . . . . . . . . . . . . . . . . . . . . .
24.6 gdb/mi Output Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.1 gdb/mi Result Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.2 gdb/mi Stream Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.6.3 gdb/mi Async Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.7 Simple Examples of gdb/mi Interaction. . . . . . . . . . . . . . . . . . . .
24.8 gdb/mi Command Description Format . . . . . . . . . . . . . . . . . . . .
24.9 gdb/mi Breakpoint Commands . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.10 gdb/mi Program Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.11 gdb/mi Thread Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.12 gdb/mi Program Execution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.13 gdb/mi Stack Manipulation Commands . . . . . . . . . . . . . . . . . .
24.14 gdb/mi Variable Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.15 gdb/mi Data Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.16 gdb/mi Tracepoint Commands . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.17 gdb/mi Symbol Query Commands . . . . . . . . . . . . . . . . . . . . . . .
24.18 gdb/mi File Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.19 gdb/mi Target Manipulation Commands . . . . . . . . . . . . . . . . .
24.20 gdb/mi File Transfer Commands . . . . . . . . . . . . . . . . . . . . . . . . .
24.21 Miscellaneous gdb/mi Commands . . . . . . . . . . . . . . . . . . . . . . . .
25
gdb Annotations . . . . . . . . . . . . . . . . . . . . . . . 293
25.1
25.2
25.3
25.4
25.5
25.6
25.7
26
237
237
237
237
238
240
240
240
240
241
241
242
243
244
251
254
255
261
265
271
277
277
280
283
287
288
What is an Annotation? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Server Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Annotation for gdb Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invalidation Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Displaying Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
293
294
294
294
295
295
296
Reporting Bugs in gdb . . . . . . . . . . . . . . . . . . 297
26.1 Have You Found a Bug? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
26.2 How to Report Bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
viii
Debugging with gdb
27
Command Line Editing . . . . . . . . . . . . . . . . . 301
27.1 Introduction to Line Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2 Readline Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.1 Readline Bare Essentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.2 Readline Movement Commands . . . . . . . . . . . . . . . . . . . . . . .
27.2.3 Readline Killing Commands . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.4 Readline Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2.5 Searching for Commands in the History . . . . . . . . . . . . . . .
27.3 Readline Init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.3.1 Readline Init File Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.3.2 Conditional Init Constructs . . . . . . . . . . . . . . . . . . . . . . . . . .
27.3.3 Sample Init File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.4 Bindable Readline Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.4.1 Commands For Moving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.4.2 Commands For Manipulating The History . . . . . . . . . . . . .
27.4.3 Commands For Changing Text . . . . . . . . . . . . . . . . . . . . . . .
27.4.4 Killing And Yanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.4.5 Specifying Numeric Arguments . . . . . . . . . . . . . . . . . . . . . . .
27.4.6 Letting Readline Type For You . . . . . . . . . . . . . . . . . . . . . . .
27.4.7 Keyboard Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.4.8 Some Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . .
27.5 Readline vi Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
301
301
301
302
302
303
303
304
304
309
310
313
313
313
315
316
317
317
317
318
319
Using History Interactively . . . . . . . . . . . . . . 321
28.1 History Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.1.1 Event Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.1.2 Word Designators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28.1.3 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
321
321
321
322
Appendix A Formatting Documentation . . . . 325
Appendix B Installing gdb . . . . . . . . . . . . . . . . 327
B.1
B.2
B.3
B.4
B.5
Requirements for Building gdb . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking the gdb ‘configure’ Script . . . . . . . . . . . . . . . . . . . . . . .
Compiling gdb in Another Directory . . . . . . . . . . . . . . . . . . . . . . .
Specifying Names for Hosts and Targets . . . . . . . . . . . . . . . . . . . .
‘configure’ Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix C
327
327
329
330
330
Maintenance Commands . . . . . . 333
ix
Appendix D
gdb Remote Serial Protocol . . . 339
D.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.2 Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.3 Stop Reply Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.4 General Query Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.5 Register Packet Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.6 Tracepoint Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.7 Host I/O Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.8 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.9 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10 File-I/O Remote Protocol Extension . . . . . . . . . . . . . . . . . . . . . .
D.10.1 File-I/O Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.2 Protocol Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.3 The F Request Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.4 The F Reply Packet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.5 The ‘Ctrl-C’ Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.6 Console I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.7 List of Supported Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
lseek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
unlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
stat/fstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
gettimeofday . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
isatty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.8 Protocol-specific Representation of Datatypes . . . . . . . . .
Integral Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Pointer Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Memory Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
struct stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
struct timeval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.9 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Open Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
mode t Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Errno Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Lseek Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.10.10 File-I/O Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.11 Library List Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D.12 Memory Map Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
339
340
347
348
358
358
360
362
362
363
363
363
364
364
365
365
365
366
367
367
367
368
368
369
369
370
370
370
371
371
371
372
372
372
373
373
373
373
374
374
374
375
376
x
Debugging with gdb
Appendix E The GDB Agent Expression
Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
E.1
E.2
E.3
E.4
E.5
E.6
General Bytecode Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bytecode Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using Agent Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Varying Target Capabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tracing on Symmetrix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rationale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix F
377
379
383
384
384
386
Target Descriptions . . . . . . . . . . . 389
F.1 Retrieving Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2 Target Description Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.1 Inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.4 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.2.5 Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.3 Predefined Target Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.4 Standard Target Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.4.1 ARM Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.4.2 MIPS Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.4.3 M68K Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
F.4.4 PowerPC Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
389
390
390
390
391
391
391
392
393
393
393
394
394
Appendix G GNU GENERAL PUBLIC
LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
TERMS AND CONDITIONS FOR COPYING,
DISTRIBUTION AND MODIFICATION . . . . . . . . . . . . . . . . . . . 396
How to Apply These Terms to Your New Programs . . . . . . . . . . . . . . . 400
Appendix H GNU Free Documentation License
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
H.1 ADDENDUM: How to use this License for your documents . . 407
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
1
Summary of gdb
The purpose of a debugger such as gdb is to allow you to see what is going on “inside”
another program while it executes—or what another program was doing at the moment it
crashed.
gdb can do four main kinds of things (plus other things in support of these) to help you
catch bugs in the act:
• Start your program, specifying anything that might affect its behavior.
• Make your program stop on specified conditions.
• Examine what has happened, when your program has stopped.
• Change things in your program, so you can experiment with correcting the effects of
one bug and go on to learn about another.
You can use gdb to debug programs written in C and C++. For more information, see
Section 12.4 [Supported Languages], page 125. For more information, see Section 12.4.1 [C
and C++], page 125.
Support for Modula-2 is partial.
[Modula-2], page 133.
For information on Modula-2, see Section 12.4.5
Debugging Pascal programs which use sets, subranges, file variables, or nested functions
does not currently work. gdb does not support entering expressions, printing values, or
similar features using Pascal syntax.
gdb can be used to debug programs written in Fortran, although it may be necessary
to refer to some variables with a trailing underscore.
gdb can be used to debug programs written in Objective-C, using either the Ap-
ple/NeXT or the GNU Objective-C runtime.
Free Software
gdb is free software, protected by the gnu General Public License (GPL). The GPL gives
you the freedom to copy or adapt a licensed program—but every person getting a copy also
gets with it the freedom to modify that copy (which means that they must get access to the
source code), and the freedom to distribute further copies. Typical software companies use
copyrights to limit your freedoms; the Free Software Foundation uses the GPL to preserve
these freedoms.
Fundamentally, the General Public License is a license which says that you have these
freedoms and that you cannot take these freedoms away from anyone else.
Free Software Needs Free Documentation
The biggest deficiency in the free software community today is not in the software—it is the
lack of good free documentation that we can include with the free software. Many of our
most important programs do not come with free reference manuals and free introductory
texts. Documentation is an essential part of any software package; when an important free
software package does not come with a free manual and a free tutorial, that is a major gap.
We have many such gaps today.
2
Debugging with gdb
Consider Perl, for instance. The tutorial manuals that people normally use are non-free.
How did this come about? Because the authors of those manuals published them with
restrictive terms—no copying, no modification, source files not available—which exclude
them from the free software world.
That wasn’t the first time this sort of thing happened, and it was far from the last.
Many times we have heard a GNU user eagerly describe a manual that he is writing, his
intended contribution to the community, only to learn that he had ruined everything by
signing a publication contract to make it non-free.
Free documentation, like free software, is a matter of freedom, not price. The problem
with the non-free manual is not that publishers charge a price for printed copies—that in
itself is fine. (The Free Software Foundation sells printed copies of manuals, too.) The
problem is the restrictions on the use of the manual. Free manuals are available in source
code form, and give you permission to copy and modify. Non-free manuals do not allow
this.
The criteria of freedom for a free manual are roughly the same as for free software.
Redistribution (including the normal kinds of commercial redistribution) must be permitted,
so that the manual can accompany every copy of the program, both on-line and on paper.
Permission for modification of the technical content is crucial too. When people mod-
ify the software, adding or changing features, if they are conscientious they will change
the manual too—so they can provide accurate and clear documentation for the modified
program. A manual that leaves you no choice but to write a new manual to document a
changed version of the program is not really available to our community.
Some kinds of limits on the way modification is handled are acceptable. For example,
requirements to preserve the original author’s copyright notice, the distribution terms, or
the list of authors, are ok. It is also no problem to require modified versions to include
notice that they were modified. Even entire sections that may not be deleted or changed
are acceptable, as long as they deal with nontechnical topics (like this one). These kinds of
restrictions are acceptable because they don’t obstruct the community’s normal use of the
manual.
However, it must be possible to modify all the technical content of the manual, and then
distribute the result in all the usual media, through all the usual channels. Otherwise, the
restrictions obstruct the use of the manual, it is not free, and we need another manual to
replace it.
Please spread the word about this issue. Our community continues to lose manuals
to proprietary publishing. If we spread the word that free software needs free reference
manuals and free tutorials, perhaps the next person who wants to contribute by writing
documentation will realize, before it is too late, that only free manuals contribute to the
free software community.
If you are writing documentation, please insist on publishing it under the GNU Free
Documentation License or another free documentation license. Remember that this deci-
sion requires your approval—you don’t have to let the publisher decide. Some commercial
publishers will use a free license if you insist, but they will not propose the option; it is up
to you to raise the issue and say firmly that this is what you want. If the publisher you
are dealing with refuses, please try other publishers. If you’re not sure whether a proposed
license is free, write to licensing@gnu.org.
3
You can encourage commercial publishers to sell more free, copylefted manuals and
tutorials by buying them, and particularly by buying copies from the publishers that paid
for their writing or for major improvements. Meanwhile, try to avoid buying non-free
documentation at all. Check the distribution terms of a manual before you buy it, and
insist that whoever seeks your business must respect your freedom. Check the history of
the book, and try to reward the publishers that have paid or pay the authors to work on it.
The Free Software Foundation maintains a list of free documentation published by other
publishers, at http://www.fsf.org/doc/other-free-books.html.
Contributors to gdb
Richard Stallman was the original author of gdb, and of many other gnu programs. Many
others have contributed to its development. This section attempts to credit major contrib-
utors. One of the virtues of free software is that everyone is free to contribute to it; with
regret, we cannot actually acknowledge everyone here. The file ‘ChangeLog’ in the gdb
distribution approximates a blow-by-blow account.
Changes much prior to version 2.0 are lost in the mists of time.
Plea: Additions to this section are particularly welcome. If you or your friends
(or enemies, to be evenhanded) have been unfairly omitted from this list, we
would like to add your names!
So that they may not regard their many labors as thankless, we particularly thank those
who shepherded gdb through major releases: Andrew Cagney (releases 6.3, 6.2, 6.1, 6.0,
5.3, 5.2, 5.1 and 5.0); Jim Blandy (release 4.18); Jason Molenda (release 4.17); Stan Shebs
(release 4.14); Fred Fish (releases 4.16, 4.15, 4.13, 4.12, 4.11, 4.10, and 4.9); Stu Grossman
and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and 4.4); John Gilmore (releases 4.3, 4.2, 4.1,
4.0, and 3.9); Jim Kingdon (releases 3.5, 3.4, and 3.3); and Randy Smith (releases 3.2, 3.1,
and 3.0).
Richard Stallman, assisted at various times by Peter TerMaat, Chris Hanson, and
Richard Mlynarik, handled releases through 2.8.
Michael Tiemann is the author of most of the gnu C++ support in gdb, with significant
additional contributions from Per Bothner and Daniel Berlin. James Clark wrote the gnu
C++ demangler. Early work on C++ was by Peter TerMaat (who also did much general
update work leading to release 3.0).
gdb uses the BFD subroutine library to examine multiple object-file formats; BFD was
a joint project of David V. Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John
Gilmore.
David Johnson wrote the original COFF support; Pace Willison did the original support
for encapsulated COFF.
Brent Benson of Harris Computer Systems contributed DWARF 2 support.
Adam de Boor and Bradley Davis contributed the ISI Optimum V support. Per Bothner,
Noboyuki Hikichi, and Alessandro Forin contributed MIPS support. Jean-Daniel Fekete
contributed Sun 386i support. Chris Hanson improved the HP9000 support. Noboyuki
Hikichi and Tomoyuki Hasei contributed Sony/News OS 3 support. David Johnson con-
tributed Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support. Jeff
Law contributed HP PA and SOM support. Keith Packard contributed NS32K support.
4
Debugging with gdb
Doug Rabson contributed Acorn Risc Machine support. Bob Rusk contributed Harris
Nighthawk CX-UX support. Chris Smith contributed Convex support (and Fortran de-
bugging). Jonathan Stone contributed Pyramid support. Michael Tiemann contributed
SPARC support. Tim Tucker contributed support for the Gould NP1 and Gould Powern-
ode. Pace Willison contributed Intel 386 support. Jay Vosburgh contributed Symmetry
support. Marko Mlinar contributed OpenRISC 1000 support.
Andreas Schwab contributed M68K gnu/Linux support.
Rich Schaefer and Peter Schauer helped with support of SunOS shared libraries.
Jay Fenlason and Roland McGrath ensured that gdb and GAS agree about several
machine instruction sets.
Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped develop remote
debugging. Intel Corporation, Wind River Systems, AMD, and ARM contributed remote
debugging modules for the i960, VxWorks, A29K UDI, and RDI targets, respectively.
Brian Fox is the author of the readline libraries providing command-line editing and
command history.
Andrew Beers of SUNY Buffalo wrote the language-switching code, the Modula-2 sup-
port, and contributed the Languages chapter of this manual.
Fred Fish wrote most of the support for Unix System Vr4. He also enhanced the
command-completion support to cover C++ overloaded symbols.
Hitachi America (now Renesas America), Ltd.
H8/500, and Super-H processors.
sponsored the support for H8/300,
NEC sponsored the support for the v850, Vr4xxx, and Vr5xxx processors.
Mitsubishi (now Renesas) sponsored the support for D10V, D30V, and M32R/D proces-
sors.
Toshiba sponsored the support for the TX39 Mips processor.
Matsushita sponsored the support for the MN10200 and MN10300 processors.
Fujitsu sponsored the support for SPARClite and FR30 processors.
Kung Hsu, Jeff Law, and Rick Sladkey added support for hardware watchpoints.
Michael Snyder added support for tracepoints.
Stu Grossman wrote gdbserver.
Jim Kingdon, Peter Schauer, Ian Taylor, and Stu Grossman made nearly innumerable
bug fixes and cleanups throughout gdb.
The following people at the Hewlett-Packard Company contributed support for the PA-
RISC 2.0 architecture, HP-UX 10.20, 10.30, and 11.0 (narrow mode), HP’s implementation
of kernel threads, HP’s aC++ compiler, and the Text User Interface (nee Terminal User
Interface): Ben Krepp, Richard Title, John Bishop, Susan Macchia, Kathy Mann, Satish
Pai, India Paul, Steve Rehrauer, and Elena Zannoni. Kim Haase provided HP-specific
information in this manual.
DJ Delorie ported gdb to MS-DOS, for the DJGPP project. Robert Hoehne made
significant contributions to the DJGPP port.
Cygnus Solutions has sponsored gdb maintenance and much of its development since
1991. Cygnus engineers who have worked on gdb fulltime include Mark Alexander, Jim
5
Blandy, Per Bothner, Kevin Buettner, Edith Epstein, Chris Faylor, Fred Fish, Martin
Hunt, Jim Ingham, John Gilmore, Stu Grossman, Kung Hsu, Jim Kingdon, John Metzler,
Fernando Nasser, Geoffrey Noer, Dawn Perchik, Rich Pixley, Zdenek Radouch, Keith Seitz,
Stan Shebs, David Taylor, and Elena Zannoni. In addition, Dave Brolley, Ian Carmichael,
Steve Chamberlain, Nick Clifton, JT Conklin, Stan Cox, DJ Delorie, Ulrich Drepper, Frank
Eigler, Doug Evans, Sean Fagan, David Henkel-Wallace, Richard Henderson, Jeff Holcomb,
Jeff Law, Jim Lemke, Tom Lord, Bob Manson, Michael Meissner, Jason Merrill, Catherine
Moore, Drew Moseley, Ken Raeburn, Gavin Romig-Koch, Rob Savoye, Jamie Smith, Mike
Stump, Ian Taylor, Angela Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim
Wilson, and David Zuhn have made contributions both large and small.
Andrew Cagney, Fernando Nasser, and Elena Zannoni, while working for Cygnus Solu-
tions, implemented the original gdb/mi interface.
Jim Blandy added support for preprocessor macros, while working for Red Hat.
Andrew Cagney designed gdb’s architecture vector. Many people including Andrew
Cagney, Stephane Carrez, Randolph Chung, Nick Duffek, Richard Henderson, Mark Ket-
tenis, Grace Sainsbury, Kei Sakamoto, Yoshinori Sato, Michael Snyder, Andreas Schwab,
Jason Thorpe, Corinna Vinschen, Ulrich Weigand, and Elena Zannoni, helped with the
migration of old architectures to this new framework.
Andrew Cagney completely re-designed and re-implemented gdb’s unwinder framework,
this consisting of a fresh new design featuring frame IDs, independent frame sniffers, and
the sentinel frame. Mark Kettenis implemented the dwarf 2 unwinder, Jeff Johnston the
libunwind unwinder, and Andrew Cagney the dummy, sentinel, tramp, and trad unwinders.
The architecture-specific changes, each involving a complete rewrite of the architecture’s
frame code, were carried out by Jim Blandy, Joel Brobecker, Kevin Buettner, Andrew
Cagney, Stephane Carrez, Randolph Chung, Orjan Friberg, Richard Henderson, Daniel
Jacobowitz, Jeff Johnston, Mark Kettenis, Theodore A. Roth, Kei Sakamoto, Yoshinori
Sato, Michael Snyder, Corinna Vinschen, and Ulrich Weigand.
Christian Zankel, Ross Morley, Bob Wilson, and Maxim Grigoriev from Tensilica, Inc.
contributed support for Xtensa processors. Others who have worked on the Xtensa port of
gdb in the past include Steve Tjiang, John Newlin, and Scott Foehner.