1 |
578 |
markom |
This is ./gdb.info, produced by makeinfo version 4.0 from gdb.texinfo.
|
2 |
|
|
|
3 |
|
|
INFO-DIR-SECTION Programming & development tools.
|
4 |
|
|
START-INFO-DIR-ENTRY
|
5 |
|
|
* Gdb: (gdb). The GNU debugger.
|
6 |
|
|
END-INFO-DIR-ENTRY
|
7 |
|
|
|
8 |
|
|
This file documents the GNU debugger GDB.
|
9 |
|
|
|
10 |
|
|
This is the Ninth Edition, April 2001, of `Debugging with GDB: the
|
11 |
|
|
GNU Source-Level Debugger' for GDB Version 20010707.
|
12 |
|
|
|
13 |
|
|
Copyright (C)
|
14 |
|
|
1988,1989,1990,1991,1992,1993,1994,1995,1996,1998,1999,2000,2001
|
15 |
|
|
Free Software Foundation, Inc.
|
16 |
|
|
|
17 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
18 |
|
|
under the terms of the GNU Free Documentation License, Version 1.1 or
|
19 |
|
|
any later version published by the Free Software Foundation; with the
|
20 |
|
|
Invariant Sections being "A Sample GDB Session" and "Free Software",
|
21 |
|
|
with the Front-Cover texts being "A GNU Manual," and with the
|
22 |
|
|
Back-Cover Texts as in (a) below.
|
23 |
|
|
|
24 |
|
|
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
|
25 |
|
|
modify this GNU Manual, like GNU software. Copies published by the Free
|
26 |
|
|
Software Foundation raise funds for GNU development."
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
File: gdb.info, Node: GDB/MI Stack Manipulation, Next: GDB/MI Symbol Query, Prev: GDB/MI Miscellaneous Commands, Up: GDB/MI
|
30 |
|
|
|
31 |
|
|
GDB/MI Stack Manipulation Commands
|
32 |
|
|
==================================
|
33 |
|
|
|
34 |
|
|
The `-stack-info-frame' Command
|
35 |
|
|
-------------------------------
|
36 |
|
|
|
37 |
|
|
Synopsis
|
38 |
|
|
........
|
39 |
|
|
|
40 |
|
|
-stack-info-frame
|
41 |
|
|
|
42 |
|
|
Get info on the current frame.
|
43 |
|
|
|
44 |
|
|
GDB Command
|
45 |
|
|
...........
|
46 |
|
|
|
47 |
|
|
The corresponding GDB command is `info frame' or `frame' (without
|
48 |
|
|
arguments).
|
49 |
|
|
|
50 |
|
|
Example
|
51 |
|
|
.......
|
52 |
|
|
|
53 |
|
|
N.A.
|
54 |
|
|
|
55 |
|
|
The `-stack-info-depth' Command
|
56 |
|
|
-------------------------------
|
57 |
|
|
|
58 |
|
|
Synopsis
|
59 |
|
|
........
|
60 |
|
|
|
61 |
|
|
-stack-info-depth [ MAX-DEPTH ]
|
62 |
|
|
|
63 |
|
|
Return the depth of the stack. If the integer argument MAX-DEPTH is
|
64 |
|
|
specified, do not count beyond MAX-DEPTH frames.
|
65 |
|
|
|
66 |
|
|
GDB Command
|
67 |
|
|
...........
|
68 |
|
|
|
69 |
|
|
There's no equivalent GDB command.
|
70 |
|
|
|
71 |
|
|
Example
|
72 |
|
|
.......
|
73 |
|
|
|
74 |
|
|
For a stack with frame levels 0 through 11:
|
75 |
|
|
|
76 |
|
|
(gdb)
|
77 |
|
|
-stack-info-depth
|
78 |
|
|
^done,depth="12"
|
79 |
|
|
(gdb)
|
80 |
|
|
-stack-info-depth 4
|
81 |
|
|
^done,depth="4"
|
82 |
|
|
(gdb)
|
83 |
|
|
-stack-info-depth 12
|
84 |
|
|
^done,depth="12"
|
85 |
|
|
(gdb)
|
86 |
|
|
-stack-info-depth 11
|
87 |
|
|
^done,depth="11"
|
88 |
|
|
(gdb)
|
89 |
|
|
-stack-info-depth 13
|
90 |
|
|
^done,depth="12"
|
91 |
|
|
(gdb)
|
92 |
|
|
|
93 |
|
|
The `-stack-list-arguments' Command
|
94 |
|
|
-----------------------------------
|
95 |
|
|
|
96 |
|
|
Synopsis
|
97 |
|
|
........
|
98 |
|
|
|
99 |
|
|
-stack-list-arguments SHOW-VALUES
|
100 |
|
|
[ LOW-FRAME HIGH-FRAME ]
|
101 |
|
|
|
102 |
|
|
Display a list of the arguments for the frames between LOW-FRAME and
|
103 |
|
|
HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
|
104 |
|
|
list the arguments for the whole call stack.
|
105 |
|
|
|
106 |
|
|
The SHOW-VALUES argument must have a value of 0 or 1. A value of 0
|
107 |
|
|
means that only the names of the arguments are listed, a value of 1
|
108 |
|
|
means that both names and values of the arguments are printed.
|
109 |
|
|
|
110 |
|
|
GDB Command
|
111 |
|
|
...........
|
112 |
|
|
|
113 |
|
|
GDB does not have an equivalent command. `gdbtk' has a
|
114 |
|
|
`gdb_get_args' command which partially overlaps with the functionality
|
115 |
|
|
of `-stack-list-arguments'.
|
116 |
|
|
|
117 |
|
|
Example
|
118 |
|
|
.......
|
119 |
|
|
|
120 |
|
|
(gdb)
|
121 |
|
|
-stack-list-frames
|
122 |
|
|
^done,
|
123 |
|
|
stack=[
|
124 |
|
|
frame={level="0 ",addr="0x00010734",func="callee4",
|
125 |
|
|
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
|
126 |
|
|
frame={level="1 ",addr="0x0001076c",func="callee3",
|
127 |
|
|
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="17"},
|
128 |
|
|
frame={level="2 ",addr="0x0001078c",func="callee2",
|
129 |
|
|
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="22"},
|
130 |
|
|
frame={level="3 ",addr="0x000107b4",func="callee1",
|
131 |
|
|
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="27"},
|
132 |
|
|
frame={level="4 ",addr="0x000107e0",func="main",
|
133 |
|
|
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="32"}]
|
134 |
|
|
(gdb)
|
135 |
|
|
-stack-list-arguments 0
|
136 |
|
|
^done,
|
137 |
|
|
stack-args=[
|
138 |
|
|
frame={level="0",args=[]},
|
139 |
|
|
frame={level="1",args=[name="strarg"]},
|
140 |
|
|
frame={level="2",args=[name="intarg",name="strarg"]},
|
141 |
|
|
frame={level="3",args=[name="intarg",name="strarg",name="fltarg"]},
|
142 |
|
|
frame={level="4",args=[]}]
|
143 |
|
|
(gdb)
|
144 |
|
|
-stack-list-arguments 1
|
145 |
|
|
^done,
|
146 |
|
|
stack-args=[
|
147 |
|
|
frame={level="0",args=[]},
|
148 |
|
|
frame={level="1",
|
149 |
|
|
args=[{name="strarg",value="0x11940 \"A string argument.\""}]},
|
150 |
|
|
frame={level="2",args=[
|
151 |
|
|
{name="intarg",value="2"},
|
152 |
|
|
{name="strarg",value="0x11940 \"A string argument.\""}]},
|
153 |
|
|
{frame={level="3",args=[
|
154 |
|
|
{name="intarg",value="2"},
|
155 |
|
|
{name="strarg",value="0x11940 \"A string argument.\""},
|
156 |
|
|
{name="fltarg",value="3.5"}]},
|
157 |
|
|
frame={level="4",args=[]}]
|
158 |
|
|
(gdb)
|
159 |
|
|
-stack-list-arguments 0 2 2
|
160 |
|
|
^done,stack-args=[frame={level="2",args=[name="intarg",name="strarg"]}]
|
161 |
|
|
(gdb)
|
162 |
|
|
-stack-list-arguments 1 2 2
|
163 |
|
|
^done,stack-args=[frame={level="2",
|
164 |
|
|
args=[{name="intarg",value="2"},
|
165 |
|
|
{name="strarg",value="0x11940 \"A string argument.\""}]}]
|
166 |
|
|
(gdb)
|
167 |
|
|
|
168 |
|
|
The `-stack-list-frames' Command
|
169 |
|
|
--------------------------------
|
170 |
|
|
|
171 |
|
|
Synopsis
|
172 |
|
|
........
|
173 |
|
|
|
174 |
|
|
-stack-list-frames [ LOW-FRAME HIGH-FRAME ]
|
175 |
|
|
|
176 |
|
|
List the frames currently on the stack. For each frame it displays
|
177 |
|
|
the following info:
|
178 |
|
|
|
179 |
|
|
`LEVEL'
|
180 |
|
|
The frame number, 0 being the topmost frame, i.e. the innermost
|
181 |
|
|
function.
|
182 |
|
|
|
183 |
|
|
`ADDR'
|
184 |
|
|
The `$pc' value for that frame.
|
185 |
|
|
|
186 |
|
|
`FUNC'
|
187 |
|
|
Function name.
|
188 |
|
|
|
189 |
|
|
`FILE'
|
190 |
|
|
File name of the source file where the function lives.
|
191 |
|
|
|
192 |
|
|
`LINE'
|
193 |
|
|
Line number corresponding to the `$pc'.
|
194 |
|
|
|
195 |
|
|
If invoked without arguments, this command prints a backtrace for the
|
196 |
|
|
whole stack. If given two integer arguments, it shows the frames whose
|
197 |
|
|
levels are between the two arguments (inclusive). If the two arguments
|
198 |
|
|
are equal, it shows the single frame at the corresponding level.
|
199 |
|
|
|
200 |
|
|
GDB Command
|
201 |
|
|
...........
|
202 |
|
|
|
203 |
|
|
The corresponding GDB commands are `backtrace' and `where'.
|
204 |
|
|
|
205 |
|
|
Example
|
206 |
|
|
.......
|
207 |
|
|
|
208 |
|
|
Full stack backtrace:
|
209 |
|
|
|
210 |
|
|
(gdb)
|
211 |
|
|
-stack-list-frames
|
212 |
|
|
^done,stack=
|
213 |
|
|
[frame={level="0 ",addr="0x0001076c",func="foo",
|
214 |
|
|
file="recursive2.c",line="11"},
|
215 |
|
|
frame={level="1 ",addr="0x000107a4",func="foo",
|
216 |
|
|
file="recursive2.c",line="14"},
|
217 |
|
|
frame={level="2 ",addr="0x000107a4",func="foo",
|
218 |
|
|
file="recursive2.c",line="14"},
|
219 |
|
|
frame={level="3 ",addr="0x000107a4",func="foo",
|
220 |
|
|
file="recursive2.c",line="14"},
|
221 |
|
|
frame={level="4 ",addr="0x000107a4",func="foo",
|
222 |
|
|
file="recursive2.c",line="14"},
|
223 |
|
|
frame={level="5 ",addr="0x000107a4",func="foo",
|
224 |
|
|
file="recursive2.c",line="14"},
|
225 |
|
|
frame={level="6 ",addr="0x000107a4",func="foo",
|
226 |
|
|
file="recursive2.c",line="14"},
|
227 |
|
|
frame={level="7 ",addr="0x000107a4",func="foo",
|
228 |
|
|
file="recursive2.c",line="14"},
|
229 |
|
|
frame={level="8 ",addr="0x000107a4",func="foo",
|
230 |
|
|
file="recursive2.c",line="14"},
|
231 |
|
|
frame={level="9 ",addr="0x000107a4",func="foo",
|
232 |
|
|
file="recursive2.c",line="14"},
|
233 |
|
|
frame={level="10",addr="0x000107a4",func="foo",
|
234 |
|
|
file="recursive2.c",line="14"},
|
235 |
|
|
frame={level="11",addr="0x00010738",func="main",
|
236 |
|
|
file="recursive2.c",line="4"}]
|
237 |
|
|
(gdb)
|
238 |
|
|
|
239 |
|
|
Show frames between LOW_FRAME and HIGH_FRAME:
|
240 |
|
|
|
241 |
|
|
(gdb)
|
242 |
|
|
-stack-list-frames 3 5
|
243 |
|
|
^done,stack=
|
244 |
|
|
[frame={level="3 ",addr="0x000107a4",func="foo",
|
245 |
|
|
file="recursive2.c",line="14"},
|
246 |
|
|
frame={level="4 ",addr="0x000107a4",func="foo",
|
247 |
|
|
file="recursive2.c",line="14"},
|
248 |
|
|
frame={level="5 ",addr="0x000107a4",func="foo",
|
249 |
|
|
file="recursive2.c",line="14"}]
|
250 |
|
|
(gdb)
|
251 |
|
|
|
252 |
|
|
Show a single frame:
|
253 |
|
|
|
254 |
|
|
(gdb)
|
255 |
|
|
-stack-list-frames 3 3
|
256 |
|
|
^done,stack=
|
257 |
|
|
[frame={level="3 ",addr="0x000107a4",func="foo",
|
258 |
|
|
file="recursive2.c",line="14"}]
|
259 |
|
|
(gdb)
|
260 |
|
|
|
261 |
|
|
The `-stack-list-locals' Command
|
262 |
|
|
--------------------------------
|
263 |
|
|
|
264 |
|
|
Synopsis
|
265 |
|
|
........
|
266 |
|
|
|
267 |
|
|
-stack-list-locals PRINT-VALUES
|
268 |
|
|
|
269 |
|
|
Display the local variable names for the current frame. With an
|
270 |
|
|
argument of 0 prints only the names of the variables, with argument of 1
|
271 |
|
|
prints also their values.
|
272 |
|
|
|
273 |
|
|
GDB Command
|
274 |
|
|
...........
|
275 |
|
|
|
276 |
|
|
`info locals' in GDB, `gdb_get_locals' in `gdbtk'.
|
277 |
|
|
|
278 |
|
|
Example
|
279 |
|
|
.......
|
280 |
|
|
|
281 |
|
|
(gdb)
|
282 |
|
|
-stack-list-locals 0
|
283 |
|
|
^done,locals=[name="A",name="B",name="C"]
|
284 |
|
|
(gdb)
|
285 |
|
|
-stack-list-locals 1
|
286 |
|
|
^done,locals=[{name="A",value="1"},{name="B",value="2"},
|
287 |
|
|
{name="C",value="3"}]
|
288 |
|
|
(gdb)
|
289 |
|
|
|
290 |
|
|
The `-stack-select-frame' Command
|
291 |
|
|
---------------------------------
|
292 |
|
|
|
293 |
|
|
Synopsis
|
294 |
|
|
........
|
295 |
|
|
|
296 |
|
|
-stack-select-frame FRAMENUM
|
297 |
|
|
|
298 |
|
|
Change the current frame. Select a different frame FRAMENUM on the
|
299 |
|
|
stack.
|
300 |
|
|
|
301 |
|
|
GDB Command
|
302 |
|
|
...........
|
303 |
|
|
|
304 |
|
|
The corresponding GDB commands are `frame', `up', `down',
|
305 |
|
|
`select-frame', `up-silent', and `down-silent'.
|
306 |
|
|
|
307 |
|
|
Example
|
308 |
|
|
.......
|
309 |
|
|
|
310 |
|
|
(gdb)
|
311 |
|
|
-stack-select-frame 2
|
312 |
|
|
^done
|
313 |
|
|
(gdb)
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
File: gdb.info, Node: GDB/MI Symbol Query, Next: GDB/MI Target Manipulation, Prev: GDB/MI Stack Manipulation, Up: GDB/MI
|
317 |
|
|
|
318 |
|
|
GDB/MI Symbol Query Commands
|
319 |
|
|
============================
|
320 |
|
|
|
321 |
|
|
The `-symbol-info-address' Command
|
322 |
|
|
----------------------------------
|
323 |
|
|
|
324 |
|
|
Synopsis
|
325 |
|
|
........
|
326 |
|
|
|
327 |
|
|
-symbol-info-address SYMBOL
|
328 |
|
|
|
329 |
|
|
Describe where SYMBOL is stored.
|
330 |
|
|
|
331 |
|
|
GDB Command
|
332 |
|
|
...........
|
333 |
|
|
|
334 |
|
|
The corresponding GDB command is `info address'.
|
335 |
|
|
|
336 |
|
|
Example
|
337 |
|
|
.......
|
338 |
|
|
|
339 |
|
|
N.A.
|
340 |
|
|
|
341 |
|
|
The `-symbol-info-file' Command
|
342 |
|
|
-------------------------------
|
343 |
|
|
|
344 |
|
|
Synopsis
|
345 |
|
|
........
|
346 |
|
|
|
347 |
|
|
-symbol-info-file
|
348 |
|
|
|
349 |
|
|
Show the file for the symbol.
|
350 |
|
|
|
351 |
|
|
GDB Command
|
352 |
|
|
...........
|
353 |
|
|
|
354 |
|
|
There's no equivalent GDB command. `gdbtk' has `gdb_find_file'.
|
355 |
|
|
|
356 |
|
|
Example
|
357 |
|
|
.......
|
358 |
|
|
|
359 |
|
|
N.A.
|
360 |
|
|
|
361 |
|
|
The `-symbol-info-function' Command
|
362 |
|
|
-----------------------------------
|
363 |
|
|
|
364 |
|
|
Synopsis
|
365 |
|
|
........
|
366 |
|
|
|
367 |
|
|
-symbol-info-function
|
368 |
|
|
|
369 |
|
|
Show which function the symbol lives in.
|
370 |
|
|
|
371 |
|
|
GDB Command
|
372 |
|
|
...........
|
373 |
|
|
|
374 |
|
|
`gdb_get_function' in `gdbtk'.
|
375 |
|
|
|
376 |
|
|
Example
|
377 |
|
|
.......
|
378 |
|
|
|
379 |
|
|
N.A.
|
380 |
|
|
|
381 |
|
|
The `-symbol-info-line' Command
|
382 |
|
|
-------------------------------
|
383 |
|
|
|
384 |
|
|
Synopsis
|
385 |
|
|
........
|
386 |
|
|
|
387 |
|
|
-symbol-info-line
|
388 |
|
|
|
389 |
|
|
Show the core addresses of the code for a source line.
|
390 |
|
|
|
391 |
|
|
GDB Command
|
392 |
|
|
...........
|
393 |
|
|
|
394 |
|
|
The corresponding GDB comamnd is `info line'. `gdbtk' has the
|
395 |
|
|
`gdb_get_line' and `gdb_get_file' commands.
|
396 |
|
|
|
397 |
|
|
Example
|
398 |
|
|
.......
|
399 |
|
|
|
400 |
|
|
N.A.
|
401 |
|
|
|
402 |
|
|
The `-symbol-info-symbol' Command
|
403 |
|
|
---------------------------------
|
404 |
|
|
|
405 |
|
|
Synopsis
|
406 |
|
|
........
|
407 |
|
|
|
408 |
|
|
-symbol-info-symbol ADDR
|
409 |
|
|
|
410 |
|
|
Describe what symbol is at location ADDR.
|
411 |
|
|
|
412 |
|
|
GDB Command
|
413 |
|
|
...........
|
414 |
|
|
|
415 |
|
|
The corresponding GDB command is `info symbol'.
|
416 |
|
|
|
417 |
|
|
Example
|
418 |
|
|
.......
|
419 |
|
|
|
420 |
|
|
N.A.
|
421 |
|
|
|
422 |
|
|
The `-symbol-list-functions' Command
|
423 |
|
|
------------------------------------
|
424 |
|
|
|
425 |
|
|
Synopsis
|
426 |
|
|
........
|
427 |
|
|
|
428 |
|
|
-symbol-list-functions
|
429 |
|
|
|
430 |
|
|
List the functions in the executable.
|
431 |
|
|
|
432 |
|
|
GDB Command
|
433 |
|
|
...........
|
434 |
|
|
|
435 |
|
|
`info functions' in GDB, `gdb_listfunc' and `gdb_search' in `gdbtk'.
|
436 |
|
|
|
437 |
|
|
Example
|
438 |
|
|
.......
|
439 |
|
|
|
440 |
|
|
N.A.
|
441 |
|
|
|
442 |
|
|
The `-symbol-list-types' Command
|
443 |
|
|
--------------------------------
|
444 |
|
|
|
445 |
|
|
Synopsis
|
446 |
|
|
........
|
447 |
|
|
|
448 |
|
|
-symbol-list-types
|
449 |
|
|
|
450 |
|
|
List all the type names.
|
451 |
|
|
|
452 |
|
|
GDB Command
|
453 |
|
|
...........
|
454 |
|
|
|
455 |
|
|
The corresponding commands are `info types' in GDB, `gdb_search' in
|
456 |
|
|
`gdbtk'.
|
457 |
|
|
|
458 |
|
|
Example
|
459 |
|
|
.......
|
460 |
|
|
|
461 |
|
|
N.A.
|
462 |
|
|
|
463 |
|
|
The `-symbol-list-variables' Command
|
464 |
|
|
------------------------------------
|
465 |
|
|
|
466 |
|
|
Synopsis
|
467 |
|
|
........
|
468 |
|
|
|
469 |
|
|
-symbol-list-variables
|
470 |
|
|
|
471 |
|
|
List all the global and static variable names.
|
472 |
|
|
|
473 |
|
|
GDB Command
|
474 |
|
|
...........
|
475 |
|
|
|
476 |
|
|
`info variables' in GDB, `gdb_search' in `gdbtk'.
|
477 |
|
|
|
478 |
|
|
Example
|
479 |
|
|
.......
|
480 |
|
|
|
481 |
|
|
N.A.
|
482 |
|
|
|
483 |
|
|
The `-symbol-locate' Command
|
484 |
|
|
----------------------------
|
485 |
|
|
|
486 |
|
|
Synopsis
|
487 |
|
|
........
|
488 |
|
|
|
489 |
|
|
-symbol-locate
|
490 |
|
|
|
491 |
|
|
GDB Command
|
492 |
|
|
...........
|
493 |
|
|
|
494 |
|
|
`gdb_loc' in `gdbtk'.
|
495 |
|
|
|
496 |
|
|
Example
|
497 |
|
|
.......
|
498 |
|
|
|
499 |
|
|
N.A.
|
500 |
|
|
|
501 |
|
|
The `-symbol-type' Command
|
502 |
|
|
--------------------------
|
503 |
|
|
|
504 |
|
|
Synopsis
|
505 |
|
|
........
|
506 |
|
|
|
507 |
|
|
-symbol-type VARIABLE
|
508 |
|
|
|
509 |
|
|
Show type of VARIABLE.
|
510 |
|
|
|
511 |
|
|
GDB Command
|
512 |
|
|
...........
|
513 |
|
|
|
514 |
|
|
The corresponding GDB command is `ptype', `gdbtk' has
|
515 |
|
|
`gdb_obj_variable'.
|
516 |
|
|
|
517 |
|
|
Example
|
518 |
|
|
.......
|
519 |
|
|
|
520 |
|
|
N.A.
|
521 |
|
|
|
522 |
|
|
|
523 |
|
|
File: gdb.info, Node: GDB/MI Target Manipulation, Next: GDB/MI Thread Commands, Prev: GDB/MI Symbol Query, Up: GDB/MI
|
524 |
|
|
|
525 |
|
|
GDB/MI Target Manipulation Commands
|
526 |
|
|
===================================
|
527 |
|
|
|
528 |
|
|
The `-target-attach' Command
|
529 |
|
|
----------------------------
|
530 |
|
|
|
531 |
|
|
Synopsis
|
532 |
|
|
........
|
533 |
|
|
|
534 |
|
|
-target-attach PID | FILE
|
535 |
|
|
|
536 |
|
|
Attach to a process PID or a file FILE outside of GDB.
|
537 |
|
|
|
538 |
|
|
GDB command
|
539 |
|
|
...........
|
540 |
|
|
|
541 |
|
|
The corresponding GDB command is `attach'.
|
542 |
|
|
|
543 |
|
|
Example
|
544 |
|
|
.......
|
545 |
|
|
|
546 |
|
|
N.A.
|
547 |
|
|
|
548 |
|
|
The `-target-compare-sections' Command
|
549 |
|
|
--------------------------------------
|
550 |
|
|
|
551 |
|
|
Synopsis
|
552 |
|
|
........
|
553 |
|
|
|
554 |
|
|
-target-compare-sections [ SECTION ]
|
555 |
|
|
|
556 |
|
|
Compare data of section SECTION on target to the exec file. Without
|
557 |
|
|
the argument, all sections are compared.
|
558 |
|
|
|
559 |
|
|
GDB Command
|
560 |
|
|
...........
|
561 |
|
|
|
562 |
|
|
The GDB equivalent is `compare-sections'.
|
563 |
|
|
|
564 |
|
|
Example
|
565 |
|
|
.......
|
566 |
|
|
|
567 |
|
|
N.A.
|
568 |
|
|
|
569 |
|
|
The `-target-detach' Command
|
570 |
|
|
----------------------------
|
571 |
|
|
|
572 |
|
|
Synopsis
|
573 |
|
|
........
|
574 |
|
|
|
575 |
|
|
-target-detach
|
576 |
|
|
|
577 |
|
|
Disconnect from the remote target. There's no output.
|
578 |
|
|
|
579 |
|
|
GDB command
|
580 |
|
|
...........
|
581 |
|
|
|
582 |
|
|
The corresponding GDB command is `detach'.
|
583 |
|
|
|
584 |
|
|
Example
|
585 |
|
|
.......
|
586 |
|
|
|
587 |
|
|
(gdb)
|
588 |
|
|
-target-detach
|
589 |
|
|
^done
|
590 |
|
|
(gdb)
|
591 |
|
|
|
592 |
|
|
The `-target-download' Command
|
593 |
|
|
------------------------------
|
594 |
|
|
|
595 |
|
|
Synopsis
|
596 |
|
|
........
|
597 |
|
|
|
598 |
|
|
-target-download
|
599 |
|
|
|
600 |
|
|
Loads the executable onto the remote target. It prints out an
|
601 |
|
|
update message every half second, which includes the fields:
|
602 |
|
|
|
603 |
|
|
`section'
|
604 |
|
|
The name of the section.
|
605 |
|
|
|
606 |
|
|
`section-sent'
|
607 |
|
|
The size of what has been sent so far for that section.
|
608 |
|
|
|
609 |
|
|
`section-size'
|
610 |
|
|
The size of the section.
|
611 |
|
|
|
612 |
|
|
`total-sent'
|
613 |
|
|
The total size of what was sent so far (the current and the
|
614 |
|
|
previous sections).
|
615 |
|
|
|
616 |
|
|
`total-size'
|
617 |
|
|
The size of the overall executable to download.
|
618 |
|
|
|
619 |
|
|
Each message is sent as status record (*note GDB/MI Output Syntax:
|
620 |
|
|
GDB/MI Output Syntax.).
|
621 |
|
|
|
622 |
|
|
In addition, it prints the name and size of the sections, as they are
|
623 |
|
|
downloaded. These messages include the following fields:
|
624 |
|
|
|
625 |
|
|
`section'
|
626 |
|
|
The name of the section.
|
627 |
|
|
|
628 |
|
|
`section-size'
|
629 |
|
|
The size of the section.
|
630 |
|
|
|
631 |
|
|
`total-size'
|
632 |
|
|
The size of the overall executable to download.
|
633 |
|
|
|
634 |
|
|
At the end, a summary is printed.
|
635 |
|
|
|
636 |
|
|
GDB Command
|
637 |
|
|
...........
|
638 |
|
|
|
639 |
|
|
The corresponding GDB command is `load'.
|
640 |
|
|
|
641 |
|
|
Example
|
642 |
|
|
.......
|
643 |
|
|
|
644 |
|
|
Note: each status message appears on a single line. Here the
|
645 |
|
|
messages have been broken down so that they can fit onto a page.
|
646 |
|
|
|
647 |
|
|
(gdb)
|
648 |
|
|
-target-download
|
649 |
|
|
+download,{section=".text",section-size="6668",total-size="9880"}
|
650 |
|
|
+download,{section=".text",section-sent="512",section-size="6668",
|
651 |
|
|
total-sent="512",total-size="9880"}
|
652 |
|
|
+download,{section=".text",section-sent="1024",section-size="6668",
|
653 |
|
|
total-sent="1024",total-size="9880"}
|
654 |
|
|
+download,{section=".text",section-sent="1536",section-size="6668",
|
655 |
|
|
total-sent="1536",total-size="9880"}
|
656 |
|
|
+download,{section=".text",section-sent="2048",section-size="6668",
|
657 |
|
|
total-sent="2048",total-size="9880"}
|
658 |
|
|
+download,{section=".text",section-sent="2560",section-size="6668",
|
659 |
|
|
total-sent="2560",total-size="9880"}
|
660 |
|
|
+download,{section=".text",section-sent="3072",section-size="6668",
|
661 |
|
|
total-sent="3072",total-size="9880"}
|
662 |
|
|
+download,{section=".text",section-sent="3584",section-size="6668",
|
663 |
|
|
total-sent="3584",total-size="9880"}
|
664 |
|
|
+download,{section=".text",section-sent="4096",section-size="6668",
|
665 |
|
|
total-sent="4096",total-size="9880"}
|
666 |
|
|
+download,{section=".text",section-sent="4608",section-size="6668",
|
667 |
|
|
total-sent="4608",total-size="9880"}
|
668 |
|
|
+download,{section=".text",section-sent="5120",section-size="6668",
|
669 |
|
|
total-sent="5120",total-size="9880"}
|
670 |
|
|
+download,{section=".text",section-sent="5632",section-size="6668",
|
671 |
|
|
total-sent="5632",total-size="9880"}
|
672 |
|
|
+download,{section=".text",section-sent="6144",section-size="6668",
|
673 |
|
|
total-sent="6144",total-size="9880"}
|
674 |
|
|
+download,{section=".text",section-sent="6656",section-size="6668",
|
675 |
|
|
total-sent="6656",total-size="9880"}
|
676 |
|
|
+download,{section=".init",section-size="28",total-size="9880"}
|
677 |
|
|
+download,{section=".fini",section-size="28",total-size="9880"}
|
678 |
|
|
+download,{section=".data",section-size="3156",total-size="9880"}
|
679 |
|
|
+download,{section=".data",section-sent="512",section-size="3156",
|
680 |
|
|
total-sent="7236",total-size="9880"}
|
681 |
|
|
+download,{section=".data",section-sent="1024",section-size="3156",
|
682 |
|
|
total-sent="7748",total-size="9880"}
|
683 |
|
|
+download,{section=".data",section-sent="1536",section-size="3156",
|
684 |
|
|
total-sent="8260",total-size="9880"}
|
685 |
|
|
+download,{section=".data",section-sent="2048",section-size="3156",
|
686 |
|
|
total-sent="8772",total-size="9880"}
|
687 |
|
|
+download,{section=".data",section-sent="2560",section-size="3156",
|
688 |
|
|
total-sent="9284",total-size="9880"}
|
689 |
|
|
+download,{section=".data",section-sent="3072",section-size="3156",
|
690 |
|
|
total-sent="9796",total-size="9880"}
|
691 |
|
|
^done,address="0x10004",load-size="9880",transfer-rate="6586",
|
692 |
|
|
write-rate="429"
|
693 |
|
|
(gdb)
|
694 |
|
|
|
695 |
|
|
The `-target-exec-status' Command
|
696 |
|
|
---------------------------------
|
697 |
|
|
|
698 |
|
|
Synopsis
|
699 |
|
|
........
|
700 |
|
|
|
701 |
|
|
-target-exec-status
|
702 |
|
|
|
703 |
|
|
Provide information on the state of the target (whether it is
|
704 |
|
|
running or not, for instance).
|
705 |
|
|
|
706 |
|
|
GDB Command
|
707 |
|
|
...........
|
708 |
|
|
|
709 |
|
|
There's no equivalent GDB command.
|
710 |
|
|
|
711 |
|
|
Example
|
712 |
|
|
.......
|
713 |
|
|
|
714 |
|
|
N.A.
|
715 |
|
|
|
716 |
|
|
The `-target-list-available-targets' Command
|
717 |
|
|
--------------------------------------------
|
718 |
|
|
|
719 |
|
|
Synopsis
|
720 |
|
|
........
|
721 |
|
|
|
722 |
|
|
-target-list-available-targets
|
723 |
|
|
|
724 |
|
|
List the possible targets to connect to.
|
725 |
|
|
|
726 |
|
|
GDB Command
|
727 |
|
|
...........
|
728 |
|
|
|
729 |
|
|
The corresponding GDB command is `help target'.
|
730 |
|
|
|
731 |
|
|
Example
|
732 |
|
|
.......
|
733 |
|
|
|
734 |
|
|
N.A.
|
735 |
|
|
|
736 |
|
|
The `-target-list-current-targets' Command
|
737 |
|
|
------------------------------------------
|
738 |
|
|
|
739 |
|
|
Synopsis
|
740 |
|
|
........
|
741 |
|
|
|
742 |
|
|
-target-list-current-targets
|
743 |
|
|
|
744 |
|
|
Describe the current target.
|
745 |
|
|
|
746 |
|
|
GDB Command
|
747 |
|
|
...........
|
748 |
|
|
|
749 |
|
|
The corresponding information is printed by `info file' (among other
|
750 |
|
|
things).
|
751 |
|
|
|
752 |
|
|
Example
|
753 |
|
|
.......
|
754 |
|
|
|
755 |
|
|
N.A.
|
756 |
|
|
|
757 |
|
|
The `-target-list-parameters' Command
|
758 |
|
|
-------------------------------------
|
759 |
|
|
|
760 |
|
|
Synopsis
|
761 |
|
|
........
|
762 |
|
|
|
763 |
|
|
-target-list-parameters
|
764 |
|
|
|
765 |
|
|
GDB Command
|
766 |
|
|
...........
|
767 |
|
|
|
768 |
|
|
No equivalent.
|
769 |
|
|
|
770 |
|
|
Example
|
771 |
|
|
.......
|
772 |
|
|
|
773 |
|
|
N.A.
|
774 |
|
|
|
775 |
|
|
The `-target-select' Command
|
776 |
|
|
----------------------------
|
777 |
|
|
|
778 |
|
|
Synopsis
|
779 |
|
|
........
|
780 |
|
|
|
781 |
|
|
-target-select TYPE PARAMETERS ...
|
782 |
|
|
|
783 |
|
|
Connect GDB to the remote target. This command takes two args:
|
784 |
|
|
|
785 |
|
|
`TYPE'
|
786 |
|
|
The type of target, for instance `async', `remote', etc.
|
787 |
|
|
|
788 |
|
|
`PARAMETERS'
|
789 |
|
|
Device names, host names and the like. *Note Commands for
|
790 |
|
|
managing targets: Target Commands, for more details.
|
791 |
|
|
|
792 |
|
|
The output is a connection notification, followed by the address at
|
793 |
|
|
which the target program is, in the following form:
|
794 |
|
|
|
795 |
|
|
^connected,addr="ADDRESS",func="FUNCTION NAME",
|
796 |
|
|
args=[ARG LIST]
|
797 |
|
|
|
798 |
|
|
GDB Command
|
799 |
|
|
...........
|
800 |
|
|
|
801 |
|
|
The corresponding GDB command is `target'.
|
802 |
|
|
|
803 |
|
|
Example
|
804 |
|
|
.......
|
805 |
|
|
|
806 |
|
|
(gdb)
|
807 |
|
|
-target-select async /dev/ttya
|
808 |
|
|
^connected,addr="0xfe00a300",func="??",args=[]
|
809 |
|
|
(gdb)
|
810 |
|
|
|
811 |
|
|
|
812 |
|
|
File: gdb.info, Node: GDB/MI Thread Commands, Next: GDB/MI Tracepoint Commands, Prev: GDB/MI Target Manipulation, Up: GDB/MI
|
813 |
|
|
|
814 |
|
|
GDB/MI Thread Commands
|
815 |
|
|
======================
|
816 |
|
|
|
817 |
|
|
The `-thread-info' Command
|
818 |
|
|
--------------------------
|
819 |
|
|
|
820 |
|
|
Synopsis
|
821 |
|
|
........
|
822 |
|
|
|
823 |
|
|
-thread-info
|
824 |
|
|
|
825 |
|
|
GDB command
|
826 |
|
|
...........
|
827 |
|
|
|
828 |
|
|
No equivalent.
|
829 |
|
|
|
830 |
|
|
Example
|
831 |
|
|
.......
|
832 |
|
|
|
833 |
|
|
N.A.
|
834 |
|
|
|
835 |
|
|
The `-thread-list-all-threads' Command
|
836 |
|
|
--------------------------------------
|
837 |
|
|
|
838 |
|
|
Synopsis
|
839 |
|
|
........
|
840 |
|
|
|
841 |
|
|
-thread-list-all-threads
|
842 |
|
|
|
843 |
|
|
GDB Command
|
844 |
|
|
...........
|
845 |
|
|
|
846 |
|
|
The equivalent GDB command is `info threads'.
|
847 |
|
|
|
848 |
|
|
Example
|
849 |
|
|
.......
|
850 |
|
|
|
851 |
|
|
N.A.
|
852 |
|
|
|
853 |
|
|
The `-thread-list-ids' Command
|
854 |
|
|
------------------------------
|
855 |
|
|
|
856 |
|
|
Synopsis
|
857 |
|
|
........
|
858 |
|
|
|
859 |
|
|
-thread-list-ids
|
860 |
|
|
|
861 |
|
|
Produces a list of the currently known GDB thread ids. At the end
|
862 |
|
|
of the list it also prints the total number of such threads.
|
863 |
|
|
|
864 |
|
|
GDB Command
|
865 |
|
|
...........
|
866 |
|
|
|
867 |
|
|
Part of `info threads' supplies the same information.
|
868 |
|
|
|
869 |
|
|
Example
|
870 |
|
|
.......
|
871 |
|
|
|
872 |
|
|
No threads present, besides the main process:
|
873 |
|
|
|
874 |
|
|
(gdb)
|
875 |
|
|
-thread-list-ids
|
876 |
|
|
^done,thread-ids={},number-of-threads="0"
|
877 |
|
|
(gdb)
|
878 |
|
|
|
879 |
|
|
Several threads:
|
880 |
|
|
|
881 |
|
|
(gdb)
|
882 |
|
|
-thread-list-ids
|
883 |
|
|
^done,thread-ids={thread-id="3",thread-id="2",thread-id="1"},
|
884 |
|
|
number-of-threads="3"
|
885 |
|
|
(gdb)
|
886 |
|
|
|
887 |
|
|
The `-thread-select' Command
|
888 |
|
|
----------------------------
|
889 |
|
|
|
890 |
|
|
Synopsis
|
891 |
|
|
........
|
892 |
|
|
|
893 |
|
|
-thread-select THREADNUM
|
894 |
|
|
|
895 |
|
|
Make THREADNUM the current thread. It prints the number of the new
|
896 |
|
|
current thread, and the topmost frame for that thread.
|
897 |
|
|
|
898 |
|
|
GDB Command
|
899 |
|
|
...........
|
900 |
|
|
|
901 |
|
|
The corresponding GDB command is `thread'.
|
902 |
|
|
|
903 |
|
|
Example
|
904 |
|
|
.......
|
905 |
|
|
|
906 |
|
|
(gdb)
|
907 |
|
|
-exec-next
|
908 |
|
|
^running
|
909 |
|
|
(gdb)
|
910 |
|
|
*stopped,reason="end-stepping-range",thread-id="2",line="187",
|
911 |
|
|
file="../../../devo/gdb/testsuite/gdb.threads/linux-dp.c"
|
912 |
|
|
(gdb)
|
913 |
|
|
-thread-list-ids
|
914 |
|
|
^done,
|
915 |
|
|
thread-ids={thread-id="3",thread-id="2",thread-id="1"},
|
916 |
|
|
number-of-threads="3"
|
917 |
|
|
(gdb)
|
918 |
|
|
-thread-select 3
|
919 |
|
|
^done,new-thread-id="3",
|
920 |
|
|
frame={level="0 ",func="vprintf",
|
921 |
|
|
args=[{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""},
|
922 |
|
|
{name="arg",value="0x2"}],file="vprintf.c",line="31"}
|
923 |
|
|
(gdb)
|
924 |
|
|
|
925 |
|
|
|
926 |
|
|
File: gdb.info, Node: GDB/MI Tracepoint Commands, Next: GDB/MI Variable Objects, Prev: GDB/MI Thread Commands, Up: GDB/MI
|
927 |
|
|
|
928 |
|
|
GDB/MI Tracepoint Commands
|
929 |
|
|
==========================
|
930 |
|
|
|
931 |
|
|
The tracepoint commands are not yet implemented.
|
932 |
|
|
|
933 |
|
|
|
934 |
|
|
File: gdb.info, Node: GDB/MI Variable Objects, Prev: GDB/MI Tracepoint Commands, Up: GDB/MI
|
935 |
|
|
|
936 |
|
|
GDB/MI Variable Objects
|
937 |
|
|
=======================
|
938 |
|
|
|
939 |
|
|
Motivation for Variable Objects in GDB/MI
|
940 |
|
|
-----------------------------------------
|
941 |
|
|
|
942 |
|
|
For the implementation of a variable debugger window (locals, watched
|
943 |
|
|
expressions, etc.), we are proposing the adaptation of the existing code
|
944 |
|
|
used by `Insight'.
|
945 |
|
|
|
946 |
|
|
The two main reasons for that are:
|
947 |
|
|
|
948 |
|
|
1. It has been proven in practice (it is already on its second
|
949 |
|
|
generation).
|
950 |
|
|
|
951 |
|
|
2. It will shorten development time (needless to say how important it
|
952 |
|
|
is now).
|
953 |
|
|
|
954 |
|
|
The original interface was designed to be used by Tcl code, so it was
|
955 |
|
|
slightly changed so it could be used through GDB/MI. This section
|
956 |
|
|
describes the GDB/MI operations that will be available and gives some
|
957 |
|
|
hints about their use.
|
958 |
|
|
|
959 |
|
|
_Note_: In addition to the set of operations described here, we
|
960 |
|
|
expect the GUI implementation of a variable window to require, at
|
961 |
|
|
least, the following operations:
|
962 |
|
|
|
963 |
|
|
* `-gdb-show' `output-radix'
|
964 |
|
|
|
965 |
|
|
* `-stack-list-arguments'
|
966 |
|
|
|
967 |
|
|
* `-stack-list-locals'
|
968 |
|
|
|
969 |
|
|
* `-stack-select-frame'
|
970 |
|
|
|
971 |
|
|
Introduction to Variable Objects in GDB/MI
|
972 |
|
|
------------------------------------------
|
973 |
|
|
|
974 |
|
|
The basic idea behind variable objects is the creation of a named
|
975 |
|
|
object to represent a variable, an expression, a memory location or
|
976 |
|
|
even a CPU register. For each object created, a set of operations is
|
977 |
|
|
available for examining or changing its properties.
|
978 |
|
|
|
979 |
|
|
Furthermore, complex data types, such as C structures, are
|
980 |
|
|
represented in a tree format. For instance, the `struct' type variable
|
981 |
|
|
is the root and the children will represent the struct members. If a
|
982 |
|
|
child is itself of a complex type, it will also have children of its
|
983 |
|
|
own. Appropriate language differences are handled for C, C++ and Java.
|
984 |
|
|
|
985 |
|
|
When returning the actual values of the objects, this facility allows
|
986 |
|
|
for the individual selection of the display format used in the result
|
987 |
|
|
creation. It can be chosen among: binary, decimal, hexadecimal, octal
|
988 |
|
|
and natural. Natural refers to a default format automatically chosen
|
989 |
|
|
based on the variable type (like decimal for an `int', hex for
|
990 |
|
|
pointers, etc.).
|
991 |
|
|
|
992 |
|
|
The following is the complete set of GDB/MI operations defined to
|
993 |
|
|
access this functionality:
|
994 |
|
|
|
995 |
|
|
*Operation* *Description*
|
996 |
|
|
`-var-create' create a variable object
|
997 |
|
|
`-var-delete' delete the variable object and its children
|
998 |
|
|
`-var-set-format' set the display format of this variable
|
999 |
|
|
`-var-show-format' show the display format of this variable
|
1000 |
|
|
`-var-info-num-children' tells how many children this object has
|
1001 |
|
|
`-var-list-children' return a list of the object's children
|
1002 |
|
|
`-var-info-type' show the type of this variable object
|
1003 |
|
|
`-var-info-expression' print what this variable object represents
|
1004 |
|
|
`-var-show-attributes' is this variable editable? does it exist
|
1005 |
|
|
here?
|
1006 |
|
|
`-var-evaluate-expression' get the value of this variable
|
1007 |
|
|
`-var-assign' set the value of this variable
|
1008 |
|
|
`-var-update' update the variable and its children
|
1009 |
|
|
|
1010 |
|
|
In the next subsection we describe each operation in detail and
|
1011 |
|
|
suggest how it can be used.
|
1012 |
|
|
|
1013 |
|
|
Description And Use of Operations on Variable Objects
|
1014 |
|
|
-----------------------------------------------------
|
1015 |
|
|
|
1016 |
|
|
The `-var-create' Command
|
1017 |
|
|
-------------------------
|
1018 |
|
|
|
1019 |
|
|
Synopsis
|
1020 |
|
|
........
|
1021 |
|
|
|
1022 |
|
|
-var-create {NAME | "-"}
|
1023 |
|
|
{FRAME-ADDR | "*"} EXPRESSION
|
1024 |
|
|
|
1025 |
|
|
This operation creates a variable object, which allows the
|
1026 |
|
|
monitoring of a variable, the result of an expression, a memory cell or
|
1027 |
|
|
a CPU register.
|
1028 |
|
|
|
1029 |
|
|
The NAME parameter is the string by which the object can be
|
1030 |
|
|
referenced. It must be unique. If `-' is specified, the varobj system
|
1031 |
|
|
will generate a string "varNNNNNN" automatically. It will be unique
|
1032 |
|
|
provided that one does not specify NAME on that format. The command
|
1033 |
|
|
fails if a duplicate name is found.
|
1034 |
|
|
|
1035 |
|
|
The frame under which the expression should be evaluated can be
|
1036 |
|
|
specified by FRAME-ADDR. A `*' indicates that the current frame should
|
1037 |
|
|
be used.
|
1038 |
|
|
|
1039 |
|
|
EXPRESSION is any expression valid on the current language set (must
|
1040 |
|
|
not begin with a `*'), or one of the following:
|
1041 |
|
|
|
1042 |
|
|
* `*ADDR', where ADDR is the address of a memory cell
|
1043 |
|
|
|
1044 |
|
|
* `*ADDR-ADDR' -- a memory address range (TBD)
|
1045 |
|
|
|
1046 |
|
|
* `$REGNAME' -- a CPU register name
|
1047 |
|
|
|
1048 |
|
|
Result
|
1049 |
|
|
......
|
1050 |
|
|
|
1051 |
|
|
This operation returns the name, number of children and the type of
|
1052 |
|
|
the object created. Type is returned as a string as the ones generated
|
1053 |
|
|
by the GDB CLI:
|
1054 |
|
|
|
1055 |
|
|
name="NAME",numchild="N",type="TYPE"
|
1056 |
|
|
|
1057 |
|
|
The `-var-delete' Command
|
1058 |
|
|
-------------------------
|
1059 |
|
|
|
1060 |
|
|
Synopsis
|
1061 |
|
|
........
|
1062 |
|
|
|
1063 |
|
|
-var-delete NAME
|
1064 |
|
|
|
1065 |
|
|
Deletes a previously created variable object and all of its children.
|
1066 |
|
|
|
1067 |
|
|
Returns an error if the object NAME is not found.
|
1068 |
|
|
|
1069 |
|
|
The `-var-set-format' Command
|
1070 |
|
|
-----------------------------
|
1071 |
|
|
|
1072 |
|
|
Synopsis
|
1073 |
|
|
........
|
1074 |
|
|
|
1075 |
|
|
-var-set-format NAME FORMAT-SPEC
|
1076 |
|
|
|
1077 |
|
|
Sets the output format for the value of the object NAME to be
|
1078 |
|
|
FORMAT-SPEC.
|
1079 |
|
|
|
1080 |
|
|
The syntax for the FORMAT-SPEC is as follows:
|
1081 |
|
|
|
1082 |
|
|
FORMAT-SPEC ==>
|
1083 |
|
|
{binary | decimal | hexadecimal | octal | natural}
|
1084 |
|
|
|
1085 |
|
|
The `-var-show-format' Command
|
1086 |
|
|
------------------------------
|
1087 |
|
|
|
1088 |
|
|
Synopsis
|
1089 |
|
|
........
|
1090 |
|
|
|
1091 |
|
|
-var-show-format NAME
|
1092 |
|
|
|
1093 |
|
|
Returns the format used to display the value of the object NAME.
|
1094 |
|
|
|
1095 |
|
|
FORMAT ==>
|
1096 |
|
|
FORMAT-SPEC
|
1097 |
|
|
|
1098 |
|
|
The `-var-info-num-children' Command
|
1099 |
|
|
------------------------------------
|
1100 |
|
|
|
1101 |
|
|
Synopsis
|
1102 |
|
|
........
|
1103 |
|
|
|
1104 |
|
|
-var-info-num-children NAME
|
1105 |
|
|
|
1106 |
|
|
Returns the number of children of a variable object NAME:
|
1107 |
|
|
|
1108 |
|
|
numchild=N
|
1109 |
|
|
|
1110 |
|
|
The `-var-list-children' Command
|
1111 |
|
|
--------------------------------
|
1112 |
|
|
|
1113 |
|
|
Synopsis
|
1114 |
|
|
........
|
1115 |
|
|
|
1116 |
|
|
-var-list-children NAME
|
1117 |
|
|
|
1118 |
|
|
Returns a list of the children of the specified variable object:
|
1119 |
|
|
|
1120 |
|
|
numchild=N,children={{name=NAME,
|
1121 |
|
|
numchild=N,type=TYPE},(repeats N times)}
|
1122 |
|
|
|
1123 |
|
|
The `-var-info-type' Command
|
1124 |
|
|
----------------------------
|
1125 |
|
|
|
1126 |
|
|
Synopsis
|
1127 |
|
|
........
|
1128 |
|
|
|
1129 |
|
|
-var-info-type NAME
|
1130 |
|
|
|
1131 |
|
|
Returns the type of the specified variable NAME. The type is
|
1132 |
|
|
returned as a string in the same format as it is output by the GDB CLI:
|
1133 |
|
|
|
1134 |
|
|
type=TYPENAME
|
1135 |
|
|
|
1136 |
|
|
The `-var-info-expression' Command
|
1137 |
|
|
----------------------------------
|
1138 |
|
|
|
1139 |
|
|
Synopsis
|
1140 |
|
|
........
|
1141 |
|
|
|
1142 |
|
|
-var-info-expression NAME
|
1143 |
|
|
|
1144 |
|
|
Returns what is represented by the variable object NAME:
|
1145 |
|
|
|
1146 |
|
|
lang=LANG-SPEC,exp=EXPRESSION
|
1147 |
|
|
|
1148 |
|
|
where LANG-SPEC is `{"C" | "C++" | "Java"}'.
|
1149 |
|
|
|
1150 |
|
|
The `-var-show-attributes' Command
|
1151 |
|
|
----------------------------------
|
1152 |
|
|
|
1153 |
|
|
Synopsis
|
1154 |
|
|
........
|
1155 |
|
|
|
1156 |
|
|
-var-show-attributes NAME
|
1157 |
|
|
|
1158 |
|
|
List attributes of the specified variable object NAME:
|
1159 |
|
|
|
1160 |
|
|
status=ATTR [ ( ,ATTR )* ]
|
1161 |
|
|
|
1162 |
|
|
where ATTR is `{ { editable | noneditable } | TBD }'.
|
1163 |
|
|
|
1164 |
|
|
The `-var-evaluate-expression' Command
|
1165 |
|
|
--------------------------------------
|
1166 |
|
|
|
1167 |
|
|
Synopsis
|
1168 |
|
|
........
|
1169 |
|
|
|
1170 |
|
|
-var-evaluate-expression NAME
|
1171 |
|
|
|
1172 |
|
|
Evaluates the expression that is represented by the specified
|
1173 |
|
|
variable object and returns its value as a string in the current format
|
1174 |
|
|
specified for the object:
|
1175 |
|
|
|
1176 |
|
|
value=VALUE
|
1177 |
|
|
|
1178 |
|
|
The `-var-assign' Command
|
1179 |
|
|
-------------------------
|
1180 |
|
|
|
1181 |
|
|
Synopsis
|
1182 |
|
|
........
|
1183 |
|
|
|
1184 |
|
|
-var-assign NAME EXPRESSION
|
1185 |
|
|
|
1186 |
|
|
Assigns the value of EXPRESSION to the variable object specified by
|
1187 |
|
|
NAME. The object must be `editable'.
|
1188 |
|
|
|
1189 |
|
|
The `-var-update' Command
|
1190 |
|
|
-------------------------
|
1191 |
|
|
|
1192 |
|
|
Synopsis
|
1193 |
|
|
........
|
1194 |
|
|
|
1195 |
|
|
-var-update {NAME | "*"}
|
1196 |
|
|
|
1197 |
|
|
Update the value of the variable object NAME by evaluating its
|
1198 |
|
|
expression after fetching all the new values from memory or registers.
|
1199 |
|
|
A `*' causes all existing variable objects to be updated.
|
1200 |
|
|
|
1201 |
|
|
|
1202 |
|
|
File: gdb.info, Node: GDB Bugs, Next: Formatting Documentation, Prev: GDB/MI, Up: Top
|
1203 |
|
|
|
1204 |
|
|
Reporting Bugs in GDB
|
1205 |
|
|
*********************
|
1206 |
|
|
|
1207 |
|
|
Your bug reports play an essential role in making GDB reliable.
|
1208 |
|
|
|
1209 |
|
|
Reporting a bug may help you by bringing a solution to your problem,
|
1210 |
|
|
or it may not. But in any case the principal function of a bug report
|
1211 |
|
|
is to help the entire community by making the next version of GDB work
|
1212 |
|
|
better. Bug reports are your contribution to the maintenance of GDB.
|
1213 |
|
|
|
1214 |
|
|
In order for a bug report to serve its purpose, you must include the
|
1215 |
|
|
information that enables us to fix the bug.
|
1216 |
|
|
|
1217 |
|
|
* Menu:
|
1218 |
|
|
|
1219 |
|
|
* Bug Criteria:: Have you found a bug?
|
1220 |
|
|
* Bug Reporting:: How to report bugs
|
1221 |
|
|
|
1222 |
|
|
|
1223 |
|
|
File: gdb.info, Node: Bug Criteria, Next: Bug Reporting, Up: GDB Bugs
|
1224 |
|
|
|
1225 |
|
|
Have you found a bug?
|
1226 |
|
|
=====================
|
1227 |
|
|
|
1228 |
|
|
If you are not sure whether you have found a bug, here are some
|
1229 |
|
|
guidelines:
|
1230 |
|
|
|
1231 |
|
|
* If the debugger gets a fatal signal, for any input whatever, that
|
1232 |
|
|
is a GDB bug. Reliable debuggers never crash.
|
1233 |
|
|
|
1234 |
|
|
* If GDB produces an error message for valid input, that is a bug.
|
1235 |
|
|
(Note that if you're cross debugging, the problem may also be
|
1236 |
|
|
somewhere in the connection to the target.)
|
1237 |
|
|
|
1238 |
|
|
* If GDB does not produce an error message for invalid input, that
|
1239 |
|
|
is a bug. However, you should note that your idea of "invalid
|
1240 |
|
|
input" might be our idea of "an extension" or "support for
|
1241 |
|
|
traditional practice".
|
1242 |
|
|
|
1243 |
|
|
* If you are an experienced user of debugging tools, your suggestions
|
1244 |
|
|
for improvement of GDB are welcome in any case.
|
1245 |
|
|
|
1246 |
|
|
|
1247 |
|
|
File: gdb.info, Node: Bug Reporting, Prev: Bug Criteria, Up: GDB Bugs
|
1248 |
|
|
|
1249 |
|
|
How to report bugs
|
1250 |
|
|
==================
|
1251 |
|
|
|
1252 |
|
|
A number of companies and individuals offer support for GNU products.
|
1253 |
|
|
If you obtained GDB from a support organization, we recommend you
|
1254 |
|
|
contact that organization first.
|
1255 |
|
|
|
1256 |
|
|
You can find contact information for many support companies and
|
1257 |
|
|
individuals in the file `etc/SERVICE' in the GNU Emacs distribution.
|
1258 |
|
|
|
1259 |
|
|
In any event, we also recommend that you send bug reports for GDB to
|
1260 |
|
|
this addresses:
|
1261 |
|
|
|
1262 |
|
|
bug-gdb@gnu.org
|
1263 |
|
|
|
1264 |
|
|
*Do not send bug reports to `info-gdb', or to `help-gdb', or to any
|
1265 |
|
|
newsgroups.* Most users of GDB do not want to receive bug reports.
|
1266 |
|
|
Those that do have arranged to receive `bug-gdb'.
|
1267 |
|
|
|
1268 |
|
|
The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
|
1269 |
|
|
serves as a repeater. The mailing list and the newsgroup carry exactly
|
1270 |
|
|
the same messages. Often people think of posting bug reports to the
|
1271 |
|
|
newsgroup instead of mailing them. This appears to work, but it has one
|
1272 |
|
|
problem which can be crucial: a newsgroup posting often lacks a mail
|
1273 |
|
|
path back to the sender. Thus, if we need to ask for more information,
|
1274 |
|
|
we may be unable to reach you. For this reason, it is better to send
|
1275 |
|
|
bug reports to the mailing list.
|
1276 |
|
|
|
1277 |
|
|
As a last resort, send bug reports on paper to:
|
1278 |
|
|
|
1279 |
|
|
GNU Debugger Bugs
|
1280 |
|
|
Free Software Foundation Inc.
|
1281 |
|
|
59 Temple Place - Suite 330
|
1282 |
|
|
Boston, MA 02111-1307
|
1283 |
|
|
USA
|
1284 |
|
|
|
1285 |
|
|
The fundamental principle of reporting bugs usefully is this:
|
1286 |
|
|
*report all the facts*. If you are not sure whether to state a fact or
|
1287 |
|
|
leave it out, state it!
|
1288 |
|
|
|
1289 |
|
|
Often people omit facts because they think they know what causes the
|
1290 |
|
|
problem and assume that some details do not matter. Thus, you might
|
1291 |
|
|
assume that the name of the variable you use in an example does not
|
1292 |
|
|
matter. Well, probably it does not, but one cannot be sure. Perhaps
|
1293 |
|
|
the bug is a stray memory reference which happens to fetch from the
|
1294 |
|
|
location where that name is stored in memory; perhaps, if the name were
|
1295 |
|
|
different, the contents of that location would fool the debugger into
|
1296 |
|
|
doing the right thing despite the bug. Play it safe and give a
|
1297 |
|
|
specific, complete example. That is the easiest thing for you to do,
|
1298 |
|
|
and the most helpful.
|
1299 |
|
|
|
1300 |
|
|
Keep in mind that the purpose of a bug report is to enable us to fix
|
1301 |
|
|
the bug. It may be that the bug has been reported previously, but
|
1302 |
|
|
neither you nor we can know that unless your bug report is complete and
|
1303 |
|
|
self-contained.
|
1304 |
|
|
|
1305 |
|
|
Sometimes people give a few sketchy facts and ask, "Does this ring a
|
1306 |
|
|
bell?" Those bug reports are useless, and we urge everyone to _refuse
|
1307 |
|
|
to respond to them_ except to chide the sender to report bugs properly.
|
1308 |
|
|
|
1309 |
|
|
To enable us to fix the bug, you should include all these things:
|
1310 |
|
|
|
1311 |
|
|
* The version of GDB. GDB announces it if you start with no
|
1312 |
|
|
arguments; you can also print it at any time using `show version'.
|
1313 |
|
|
|
1314 |
|
|
Without this, we will not know whether there is any point in
|
1315 |
|
|
looking for the bug in the current version of GDB.
|
1316 |
|
|
|
1317 |
|
|
* The type of machine you are using, and the operating system name
|
1318 |
|
|
and version number.
|
1319 |
|
|
|
1320 |
|
|
* What compiler (and its version) was used to compile GDB--e.g.
|
1321 |
|
|
"gcc-2.8.1".
|
1322 |
|
|
|
1323 |
|
|
* What compiler (and its version) was used to compile the program
|
1324 |
|
|
you are debugging--e.g. "gcc-2.8.1", or "HP92453-01 A.10.32.03 HP
|
1325 |
|
|
C Compiler". For GCC, you can say `gcc --version' to get this
|
1326 |
|
|
information; for other compilers, see the documentation for those
|
1327 |
|
|
compilers.
|
1328 |
|
|
|
1329 |
|
|
* The command arguments you gave the compiler to compile your
|
1330 |
|
|
example and observe the bug. For example, did you use `-O'? To
|
1331 |
|
|
guarantee you will not omit something important, list them all. A
|
1332 |
|
|
copy of the Makefile (or the output from make) is sufficient.
|
1333 |
|
|
|
1334 |
|
|
If we were to try to guess the arguments, we would probably guess
|
1335 |
|
|
wrong and then we might not encounter the bug.
|
1336 |
|
|
|
1337 |
|
|
* A complete input script, and all necessary source files, that will
|
1338 |
|
|
reproduce the bug.
|
1339 |
|
|
|
1340 |
|
|
* A description of what behavior you observe that you believe is
|
1341 |
|
|
incorrect. For example, "It gets a fatal signal."
|
1342 |
|
|
|
1343 |
|
|
Of course, if the bug is that GDB gets a fatal signal, then we
|
1344 |
|
|
will certainly notice it. But if the bug is incorrect output, we
|
1345 |
|
|
might not notice unless it is glaringly wrong. You might as well
|
1346 |
|
|
not give us a chance to make a mistake.
|
1347 |
|
|
|
1348 |
|
|
Even if the problem you experience is a fatal signal, you should
|
1349 |
|
|
still say so explicitly. Suppose something strange is going on,
|
1350 |
|
|
such as, your copy of GDB is out of synch, or you have encountered
|
1351 |
|
|
a bug in the C library on your system. (This has happened!) Your
|
1352 |
|
|
copy might crash and ours would not. If you told us to expect a
|
1353 |
|
|
crash, then when ours fails to crash, we would know that the bug
|
1354 |
|
|
was not happening for us. If you had not told us to expect a
|
1355 |
|
|
crash, then we would not be able to draw any conclusion from our
|
1356 |
|
|
observations.
|
1357 |
|
|
|
1358 |
|
|
* If you wish to suggest changes to the GDB source, send us context
|
1359 |
|
|
diffs. If you even discuss something in the GDB source, refer to
|
1360 |
|
|
it by context, not by line number.
|
1361 |
|
|
|
1362 |
|
|
The line numbers in our development sources will not match those
|
1363 |
|
|
in your sources. Your line numbers would convey no useful
|
1364 |
|
|
information to us.
|
1365 |
|
|
|
1366 |
|
|
|
1367 |
|
|
Here are some things that are not necessary:
|
1368 |
|
|
|
1369 |
|
|
* A description of the envelope of the bug.
|
1370 |
|
|
|
1371 |
|
|
Often people who encounter a bug spend a lot of time investigating
|
1372 |
|
|
which changes to the input file will make the bug go away and which
|
1373 |
|
|
changes will not affect it.
|
1374 |
|
|
|
1375 |
|
|
This is often time consuming and not very useful, because the way
|
1376 |
|
|
we will find the bug is by running a single example under the
|
1377 |
|
|
debugger with breakpoints, not by pure deduction from a series of
|
1378 |
|
|
examples. We recommend that you save your time for something else.
|
1379 |
|
|
|
1380 |
|
|
Of course, if you can find a simpler example to report _instead_
|
1381 |
|
|
of the original one, that is a convenience for us. Errors in the
|
1382 |
|
|
output will be easier to spot, running under the debugger will take
|
1383 |
|
|
less time, and so on.
|
1384 |
|
|
|
1385 |
|
|
However, simplification is not vital; if you do not want to do
|
1386 |
|
|
this, report the bug anyway and send us the entire test case you
|
1387 |
|
|
used.
|
1388 |
|
|
|
1389 |
|
|
* A patch for the bug.
|
1390 |
|
|
|
1391 |
|
|
A patch for the bug does help us if it is a good one. But do not
|
1392 |
|
|
omit the necessary information, such as the test case, on the
|
1393 |
|
|
assumption that a patch is all we need. We might see problems
|
1394 |
|
|
with your patch and decide to fix the problem another way, or we
|
1395 |
|
|
might not understand it at all.
|
1396 |
|
|
|
1397 |
|
|
Sometimes with a program as complicated as GDB it is very hard to
|
1398 |
|
|
construct an example that will make the program follow a certain
|
1399 |
|
|
path through the code. If you do not send us the example, we will
|
1400 |
|
|
not be able to construct one, so we will not be able to verify
|
1401 |
|
|
that the bug is fixed.
|
1402 |
|
|
|
1403 |
|
|
And if we cannot understand what bug you are trying to fix, or why
|
1404 |
|
|
your patch should be an improvement, we will not install it. A
|
1405 |
|
|
test case will help us to understand.
|
1406 |
|
|
|
1407 |
|
|
* A guess about what the bug is or what it depends on.
|
1408 |
|
|
|
1409 |
|
|
Such guesses are usually wrong. Even we cannot guess right about
|
1410 |
|
|
such things without first using the debugger to find the facts.
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
|
|
File: gdb.info, Node: Command Line Editing, Next: Using History Interactively, Prev: Formatting Documentation, Up: Top
|
1414 |
|
|
|
1415 |
|
|
Command Line Editing
|
1416 |
|
|
********************
|
1417 |
|
|
|
1418 |
|
|
This chapter describes the basic features of the GNU command line
|
1419 |
|
|
editing interface.
|
1420 |
|
|
|
1421 |
|
|
* Menu:
|
1422 |
|
|
|
1423 |
|
|
* Introduction and Notation:: Notation used in this text.
|
1424 |
|
|
* Readline Interaction:: The minimum set of commands for editing a line.
|
1425 |
|
|
* Readline Init File:: Customizing Readline from a user's view.
|
1426 |
|
|
* Bindable Readline Commands:: A description of most of the Readline commands
|
1427 |
|
|
available for binding
|
1428 |
|
|
* Readline vi Mode:: A short description of how to make Readline
|
1429 |
|
|
behave like the vi editor.
|
1430 |
|
|
|
1431 |
|
|
|
1432 |
|
|
File: gdb.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
|
1433 |
|
|
|
1434 |
|
|
Introduction to Line Editing
|
1435 |
|
|
============================
|
1436 |
|
|
|
1437 |
|
|
The following paragraphs describe the notation used to represent
|
1438 |
|
|
keystrokes.
|
1439 |
|
|
|
1440 |
|
|
The text is read as `Control-K' and describes the character
|
1441 |
|
|
produced when the key is pressed while the Control key is depressed.
|
1442 |
|
|
|
1443 |
|
|
The text is read as `Meta-K' and describes the character
|
1444 |
|
|
produced when the Meta key (if you have one) is depressed, and the
|
1445 |
|
|
key is pressed. The Meta key is labeled on many keyboards. On
|
1446 |
|
|
keyboards with two keys labeled (usually to either side of the
|
1447 |
|
|
space bar), the on the left side is generally set to work as a
|
1448 |
|
|
Meta key. The key on the right may also be configured to work as
|
1449 |
|
|
a Meta key or may be configured as some other modifier, such as a
|
1450 |
|
|
Compose key for typing accented characters.
|
1451 |
|
|
|
1452 |
|
|
If you do not have a Meta or key, or another key working as a
|
1453 |
|
|
Meta key, the identical keystroke can be generated by typing
|
1454 |
|
|
first, and then typing . Either process is known as "metafying" the
|
1455 |
|
|
key.
|
1456 |
|
|
|
1457 |
|
|
The text is read as `Meta-Control-k' and describes the
|
1458 |
|
|
character produced by "metafying" .
|
1459 |
|
|
|
1460 |
|
|
In addition, several keys have their own names. Specifically,
|
1461 |
|
|
, , , , , and all stand for themselves
|
1462 |
|
|
when seen in this text, or in an init file (*note Readline Init File::).
|
1463 |
|
|
If your keyboard lacks a key, typing will produce the
|
1464 |
|
|
desired character. The key may be labeled or on
|
1465 |
|
|
some keyboards.
|
1466 |
|
|
|
1467 |
|
|
|
1468 |
|
|
File: gdb.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
|
1469 |
|
|
|
1470 |
|
|
Readline Interaction
|
1471 |
|
|
====================
|
1472 |
|
|
|
1473 |
|
|
Often during an interactive session you type in a long line of text,
|
1474 |
|
|
only to notice that the first word on the line is misspelled. The
|
1475 |
|
|
Readline library gives you a set of commands for manipulating the text
|
1476 |
|
|
as you type it in, allowing you to just fix your typo, and not forcing
|
1477 |
|
|
you to retype the majority of the line. Using these editing commands,
|
1478 |
|
|
you move the cursor to the place that needs correction, and delete or
|
1479 |
|
|
insert the text of the corrections. Then, when you are satisfied with
|
1480 |
|
|
the line, you simply press . You do not have to be at the end
|
1481 |
|
|
of the line to press ; the entire line is accepted regardless
|
1482 |
|
|
of the location of the cursor within the line.
|
1483 |
|
|
|
1484 |
|
|
* Menu:
|
1485 |
|
|
|
1486 |
|
|
* Readline Bare Essentials:: The least you need to know about Readline.
|
1487 |
|
|
* Readline Movement Commands:: Moving about the input line.
|
1488 |
|
|
* Readline Killing Commands:: How to delete text, and how to get it back!
|
1489 |
|
|
* Readline Arguments:: Giving numeric arguments to commands.
|
1490 |
|
|
* Searching:: Searching through previous lines.
|
1491 |
|
|
|
1492 |
|
|
|
1493 |
|
|
File: gdb.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
|
1494 |
|
|
|
1495 |
|
|
Readline Bare Essentials
|
1496 |
|
|
------------------------
|
1497 |
|
|
|
1498 |
|
|
In order to enter characters into the line, simply type them. The
|
1499 |
|
|
typed character appears where the cursor was, and then the cursor moves
|
1500 |
|
|
one space to the right. If you mistype a character, you can use your
|
1501 |
|
|
erase character to back up and delete the mistyped character.
|
1502 |
|
|
|
1503 |
|
|
Sometimes you may mistype a character, and not notice the error
|
1504 |
|
|
until you have typed several other characters. In that case, you can
|
1505 |
|
|
type to move the cursor to the left, and then correct your
|
1506 |
|
|
mistake. Afterwards, you can move the cursor to the right with .
|
1507 |
|
|
|
1508 |
|
|
When you add text in the middle of a line, you will notice that
|
1509 |
|
|
characters to the right of the cursor are `pushed over' to make room
|
1510 |
|
|
for the text that you have inserted. Likewise, when you delete text
|
1511 |
|
|
behind the cursor, characters to the right of the cursor are `pulled
|
1512 |
|
|
back' to fill in the blank space created by the removal of the text. A
|
1513 |
|
|
list of the bare essentials for editing the text of an input line
|
1514 |
|
|
follows.
|
1515 |
|
|
|
1516 |
|
|
|
1517 |
|
|
Move back one character.
|
1518 |
|
|
|
1519 |
|
|
|
1520 |
|
|
Move forward one character.
|
1521 |
|
|
|
1522 |
|
|
or
|
1523 |
|
|
Delete the character to the left of the cursor.
|
1524 |
|
|
|
1525 |
|
|
|
1526 |
|
|
Delete the character underneath the cursor.
|
1527 |
|
|
|
1528 |
|
|
Printing characters
|
1529 |
|
|
Insert the character into the line at the cursor.
|
1530 |
|
|
|
1531 |
|
|
or
|
1532 |
|
|
Undo the last editing command. You can undo all the way back to an
|
1533 |
|
|
empty line.
|
1534 |
|
|
|
1535 |
|
|
(Depending on your configuration, the key be set to delete
|
1536 |
|
|
the character to the left of the cursor and the key set to delete
|
1537 |
|
|
the character underneath the cursor, like , rather than the
|
1538 |
|
|
character to the left of the cursor.)
|
1539 |
|
|
|
1540 |
|
|
|
1541 |
|
|
File: gdb.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
|
1542 |
|
|
|
1543 |
|
|
Readline Movement Commands
|
1544 |
|
|
--------------------------
|
1545 |
|
|
|
1546 |
|
|
The above table describes the most basic keystrokes that you need in
|
1547 |
|
|
order to do editing of the input line. For your convenience, many
|
1548 |
|
|
other commands have been added in addition to , , , and
|
1549 |
|
|
. Here are some commands for moving more rapidly about the line.
|
1550 |
|
|
|
1551 |
|
|
|
1552 |
|
|
Move to the start of the line.
|
1553 |
|
|
|
1554 |
|
|
|
1555 |
|
|
Move to the end of the line.
|
1556 |
|
|
|
1557 |
|
|
|
1558 |
|
|
Move forward a word, where a word is composed of letters and
|
1559 |
|
|
digits.
|
1560 |
|
|
|
1561 |
|
|
|
1562 |
|
|
Move backward a word.
|
1563 |
|
|
|
1564 |
|
|
|
1565 |
|
|
Clear the screen, reprinting the current line at the top.
|
1566 |
|
|
|
1567 |
|
|
Notice how moves forward a character, while moves
|
1568 |
|
|
forward a word. It is a loose convention that control keystrokes
|
1569 |
|
|
operate on characters while meta keystrokes operate on words.
|
1570 |
|
|
|
1571 |
|
|
|
1572 |
|
|
File: gdb.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
|
1573 |
|
|
|
1574 |
|
|
Readline Killing Commands
|
1575 |
|
|
-------------------------
|
1576 |
|
|
|
1577 |
|
|
"Killing" text means to delete the text from the line, but to save
|
1578 |
|
|
it away for later use, usually by "yanking" (re-inserting) it back into
|
1579 |
|
|
the line. (`Cut' and `paste' are more recent jargon for `kill' and
|
1580 |
|
|
`yank'.)
|
1581 |
|
|
|
1582 |
|
|
If the description for a command says that it `kills' text, then you
|
1583 |
|
|
can be sure that you can get the text back in a different (or the same)
|
1584 |
|
|
place later.
|
1585 |
|
|
|
1586 |
|
|
When you use a kill command, the text is saved in a "kill-ring".
|
1587 |
|
|
Any number of consecutive kills save all of the killed text together, so
|
1588 |
|
|
that when you yank it back, you get it all. The kill ring is not line
|
1589 |
|
|
specific; the text that you killed on a previously typed line is
|
1590 |
|
|
available to be yanked back later, when you are typing another line.
|
1591 |
|
|
|
1592 |
|
|
Here is the list of commands for killing text.
|
1593 |
|
|
|
1594 |
|
|
|
1595 |
|
|
Kill the text from the current cursor position to the end of the
|
1596 |
|
|
line.
|
1597 |
|
|
|
1598 |
|
|
|
1599 |
|
|
Kill from the cursor to the end of the current word, or, if between
|
1600 |
|
|
words, to the end of the next word. Word boundaries are the same
|
1601 |
|
|
as those used by .
|
1602 |
|
|
|
1603 |
|
|
|
1604 |
|
|
Kill from the cursor the start of the previous word, or, if between
|
1605 |
|
|
words, to the start of the previous word. Word boundaries are the
|
1606 |
|
|
same as those used by .
|
1607 |
|
|
|
1608 |
|
|
|
1609 |
|
|
Kill from the cursor to the previous whitespace. This is
|
1610 |
|
|
different than because the word boundaries differ.
|
1611 |
|
|
|
1612 |
|
|
Here is how to "yank" the text back into the line. Yanking means to
|
1613 |
|
|
copy the most-recently-killed text from the kill buffer.
|
1614 |
|
|
|
1615 |
|
|
|
1616 |
|
|
Yank the most recently killed text back into the buffer at the
|
1617 |
|
|
cursor.
|
1618 |
|
|
|
1619 |
|
|
|
1620 |
|
|
Rotate the kill-ring, and yank the new top. You can only do this
|
1621 |
|
|
if the prior command is or .
|
1622 |
|
|
|
1623 |
|
|
|
1624 |
|
|
File: gdb.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
|
1625 |
|
|
|
1626 |
|
|
Readline Arguments
|
1627 |
|
|
------------------
|
1628 |
|
|
|
1629 |
|
|
You can pass numeric arguments to Readline commands. Sometimes the
|
1630 |
|
|
argument acts as a repeat count, other times it is the sign of the
|
1631 |
|
|
argument that is significant. If you pass a negative argument to a
|
1632 |
|
|
command which normally acts in a forward direction, that command will
|
1633 |
|
|
act in a backward direction. For example, to kill text back to the
|
1634 |
|
|
start of the line, you might type `M-- C-k'.
|
1635 |
|
|
|
1636 |
|
|
The general way to pass numeric arguments to a command is to type
|
1637 |
|
|
meta digits before the command. If the first `digit' typed is a minus
|
1638 |
|
|
sign (`-'), then the sign of the argument will be negative. Once you
|
1639 |
|
|
have typed one meta digit to get the argument started, you can type the
|
1640 |
|
|
remainder of the digits, and then the command. For example, to give
|
1641 |
|
|
the command an argument of 10, you could type `M-1 0 C-d'.
|
1642 |
|
|
|
1643 |
|
|
|
1644 |
|
|
File: gdb.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
|
1645 |
|
|
|
1646 |
|
|
Searching for Commands in the History
|
1647 |
|
|
-------------------------------------
|
1648 |
|
|
|
1649 |
|
|
Readline provides commands for searching through the command history
|
1650 |
|
|
for lines containing a specified string. There are two search modes:
|
1651 |
|
|
INCREMENTAL and NON-INCREMENTAL.
|
1652 |
|
|
|
1653 |
|
|
Incremental searches begin before the user has finished typing the
|
1654 |
|
|
search string. As each character of the search string is typed,
|
1655 |
|
|
Readline displays the next entry from the history matching the string
|
1656 |
|
|
typed so far. An incremental search requires only as many characters
|
1657 |
|
|
as needed to find the desired history entry. To search backward in the
|
1658 |
|
|
history for a particular string, type . Typing searches
|
1659 |
|
|
forward through the history. The characters present in the value of
|
1660 |
|
|
the `isearch-terminators' variable are used to terminate an incremental
|
1661 |
|
|
search. If that variable has not been assigned a value, the and
|
1662 |
|
|
characters will terminate an incremental search. will
|
1663 |
|
|
abort an incremental search and restore the original line. When the
|
1664 |
|
|
search is terminated, the history entry containing the search string
|
1665 |
|
|
becomes the current line.
|
1666 |
|
|
|
1667 |
|
|
To find other matching entries in the history list, type or
|
1668 |
|
|
as appropriate. This will search backward or forward in the
|
1669 |
|
|
history for the next entry matching the search string typed so far.
|
1670 |
|
|
Any other key sequence bound to a Readline command will terminate the
|
1671 |
|
|
search and execute that command. For instance, a will terminate
|
1672 |
|
|
the search and accept the line, thereby executing the command from the
|
1673 |
|
|
history list.
|
1674 |
|
|
|
1675 |
|
|
Non-incremental searches read the entire search string before
|
1676 |
|
|
starting to search for matching history lines. The search string may be
|
1677 |
|
|
typed by the user or be part of the contents of the current line.
|
1678 |
|
|
|
1679 |
|
|
|
1680 |
|
|
File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
|
1681 |
|
|
|
1682 |
|
|
Readline Init File
|
1683 |
|
|
==================
|
1684 |
|
|
|
1685 |
|
|
Although the Readline library comes with a set of Emacs-like
|
1686 |
|
|
keybindings installed by default, it is possible to use a different set
|
1687 |
|
|
of keybindings. Any user can customize programs that use Readline by
|
1688 |
|
|
putting commands in an "inputrc" file, conventionally in his home
|
1689 |
|
|
directory. The name of this file is taken from the value of the
|
1690 |
|
|
environment variable `INPUTRC'. If that variable is unset, the default
|
1691 |
|
|
is `~/.inputrc'.
|
1692 |
|
|
|
1693 |
|
|
When a program which uses the Readline library starts up, the init
|
1694 |
|
|
file is read, and the key bindings are set.
|
1695 |
|
|
|
1696 |
|
|
In addition, the `C-x C-r' command re-reads this init file, thus
|
1697 |
|
|
incorporating any changes that you might have made to it.
|
1698 |
|
|
|
1699 |
|
|
* Menu:
|
1700 |
|
|
|
1701 |
|
|
* Readline Init File Syntax:: Syntax for the commands in the inputrc file.
|
1702 |
|
|
|
1703 |
|
|
* Conditional Init Constructs:: Conditional key bindings in the inputrc file.
|
1704 |
|
|
|
1705 |
|
|
* Sample Init File:: An example inputrc file.
|
1706 |
|
|
|