1 |
362 |
markom |
This is ./gdb.info, produced by makeinfo version 4.0 from gdb.texinfo.
|
2 |
106 |
markom |
|
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 Eighth Edition, March 2000, of `Debugging with GDB: the
|
11 |
|
|
GNU Source-Level Debugger' for GDB Version 5.0.
|
12 |
|
|
|
13 |
|
|
Copyright (C) 1988-2000 Free Software Foundation, Inc.
|
14 |
|
|
|
15 |
|
|
Permission is granted to make and distribute verbatim copies of this
|
16 |
|
|
manual provided the copyright notice and this permission notice are
|
17 |
|
|
preserved on all copies.
|
18 |
|
|
|
19 |
|
|
Permission is granted to copy and distribute modified versions of
|
20 |
|
|
this manual under the conditions for verbatim copying, provided also
|
21 |
|
|
that the entire resulting derived work is distributed under the terms
|
22 |
|
|
of a permission notice identical to this one.
|
23 |
|
|
|
24 |
|
|
Permission is granted to copy and distribute translations of this
|
25 |
|
|
manual into another language, under the above conditions for modified
|
26 |
|
|
versions.
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
File: gdb.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
|
30 |
|
|
|
31 |
|
|
Readline Init File
|
32 |
|
|
==================
|
33 |
|
|
|
34 |
|
|
Although the Readline library comes with a set of `emacs'-like
|
35 |
|
|
keybindings installed by default, it is possible to use a different set
|
36 |
|
|
of keybindings. Any user can customize programs that use Readline by
|
37 |
|
|
putting commands in an "inputrc" file in his home directory. The name
|
38 |
|
|
of this file is taken from the value of the environment variable
|
39 |
|
|
`INPUTRC'. If that variable is unset, the default is `~/.inputrc'.
|
40 |
|
|
|
41 |
|
|
When a program which uses the Readline library starts up, the init
|
42 |
|
|
file is read, and the key bindings are set.
|
43 |
|
|
|
44 |
|
|
In addition, the `C-x C-r' command re-reads this init file, thus
|
45 |
|
|
incorporating any changes that you might have made to it.
|
46 |
|
|
|
47 |
|
|
* Menu:
|
48 |
|
|
|
49 |
|
|
* Readline Init File Syntax:: Syntax for the commands in the inputrc file.
|
50 |
|
|
|
51 |
|
|
* Conditional Init Constructs:: Conditional key bindings in the inputrc file.
|
52 |
|
|
|
53 |
|
|
* Sample Init File:: An example inputrc file.
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
|
57 |
|
|
|
58 |
|
|
Readline Init File Syntax
|
59 |
|
|
-------------------------
|
60 |
|
|
|
61 |
|
|
There are only a few basic constructs allowed in the Readline init
|
62 |
|
|
file. Blank lines are ignored. Lines beginning with a `#' are
|
63 |
|
|
comments. Lines beginning with a `$' indicate conditional constructs
|
64 |
362 |
markom |
(*note Conditional Init Constructs::). Other lines denote variable
|
65 |
106 |
markom |
settings and key bindings.
|
66 |
|
|
|
67 |
|
|
Variable Settings
|
68 |
|
|
You can modify the run-time behavior of Readline by altering the
|
69 |
|
|
values of variables in Readline using the `set' command within the
|
70 |
|
|
init file. Here is how to change from the default Emacs-like key
|
71 |
|
|
binding to use `vi' line editing commands:
|
72 |
|
|
|
73 |
|
|
set editing-mode vi
|
74 |
|
|
|
75 |
|
|
A great deal of run-time behavior is changeable with the following
|
76 |
|
|
variables.
|
77 |
|
|
|
78 |
|
|
`bell-style'
|
79 |
|
|
Controls what happens when Readline wants to ring the
|
80 |
|
|
terminal bell. If set to `none', Readline never rings the
|
81 |
|
|
bell. If set to `visible', Readline uses a visible bell if
|
82 |
|
|
one is available. If set to `audible' (the default),
|
83 |
|
|
Readline attempts to ring the terminal's bell.
|
84 |
|
|
|
85 |
|
|
`comment-begin'
|
86 |
|
|
The string to insert at the beginning of the line when the
|
87 |
|
|
`insert-comment' command is executed. The default value is
|
88 |
|
|
`"#"'.
|
89 |
|
|
|
90 |
|
|
`completion-ignore-case'
|
91 |
|
|
If set to `on', Readline performs filename matching and
|
92 |
|
|
completion in a case-insensitive fashion. The default value
|
93 |
|
|
is `off'.
|
94 |
|
|
|
95 |
|
|
`completion-query-items'
|
96 |
|
|
The number of possible completions that determines when the
|
97 |
|
|
user is asked whether he wants to see the list of
|
98 |
|
|
possibilities. If the number of possible completions is
|
99 |
|
|
greater than this value, Readline will ask the user whether
|
100 |
|
|
or not he wishes to view them; otherwise, they are simply
|
101 |
|
|
listed. The default limit is `100'.
|
102 |
|
|
|
103 |
|
|
`convert-meta'
|
104 |
|
|
If set to `on', Readline will convert characters with the
|
105 |
|
|
eighth bit set to an ASCII key sequence by stripping the
|
106 |
|
|
eighth bit and prepending an character, converting them
|
107 |
|
|
to a meta-prefixed key sequence. The default value is `on'.
|
108 |
|
|
|
109 |
|
|
`disable-completion'
|
110 |
|
|
If set to `On', Readline will inhibit word completion.
|
111 |
|
|
Completion characters will be inserted into the line as if
|
112 |
|
|
they had been mapped to `self-insert'. The default is `off'.
|
113 |
|
|
|
114 |
|
|
`editing-mode'
|
115 |
|
|
The `editing-mode' variable controls which default set of key
|
116 |
|
|
bindings is used. By default, Readline starts up in Emacs
|
117 |
|
|
editing mode, where the keystrokes are most similar to Emacs.
|
118 |
|
|
This variable can be set to either `emacs' or `vi'.
|
119 |
|
|
|
120 |
|
|
`enable-keypad'
|
121 |
|
|
When set to `on', Readline will try to enable the application
|
122 |
|
|
keypad when it is called. Some systems need this to enable
|
123 |
|
|
the arrow keys. The default is `off'.
|
124 |
|
|
|
125 |
|
|
`expand-tilde'
|
126 |
|
|
If set to `on', tilde expansion is performed when Readline
|
127 |
|
|
attempts word completion. The default is `off'.
|
128 |
|
|
|
129 |
|
|
`horizontal-scroll-mode'
|
130 |
|
|
This variable can be set to either `on' or `off'. Setting it
|
131 |
|
|
to `on' means that the text of the lines being edited will
|
132 |
|
|
scroll horizontally on a single screen line when they are
|
133 |
|
|
longer than the width of the screen, instead of wrapping onto
|
134 |
|
|
a new screen line. By default, this variable is set to `off'.
|
135 |
|
|
|
136 |
|
|
`input-meta'
|
137 |
|
|
If set to `on', Readline will enable eight-bit input (it will
|
138 |
|
|
not strip the eighth bit from the characters it reads),
|
139 |
|
|
regardless of what the terminal claims it can support. The
|
140 |
|
|
default value is `off'. The name `meta-flag' is a synonym
|
141 |
|
|
for this variable.
|
142 |
|
|
|
143 |
|
|
`isearch-terminators'
|
144 |
|
|
The string of characters that should terminate an incremental
|
145 |
|
|
search without subsequently executing the character as a
|
146 |
362 |
markom |
command (*note Searching::). If this variable has not been
|
147 |
106 |
markom |
given a value, the characters and will terminate
|
148 |
|
|
an incremental search.
|
149 |
|
|
|
150 |
|
|
`keymap'
|
151 |
|
|
Sets Readline's idea of the current keymap for key binding
|
152 |
|
|
commands. Acceptable `keymap' names are `emacs',
|
153 |
|
|
`emacs-standard', `emacs-meta', `emacs-ctlx', `vi',
|
154 |
|
|
`vi-command', and `vi-insert'. `vi' is equivalent to
|
155 |
|
|
`vi-command'; `emacs' is equivalent to `emacs-standard'. The
|
156 |
|
|
default value is `emacs'. The value of the `editing-mode'
|
157 |
|
|
variable also affects the default keymap.
|
158 |
|
|
|
159 |
|
|
`mark-directories'
|
160 |
|
|
If set to `on', completed directory names have a slash
|
161 |
|
|
appended. The default is `on'.
|
162 |
|
|
|
163 |
|
|
`mark-modified-lines'
|
164 |
|
|
This variable, when set to `on', causes Readline to display an
|
165 |
|
|
asterisk (`*') at the start of history lines which have been
|
166 |
|
|
modified. This variable is `off' by default.
|
167 |
|
|
|
168 |
|
|
`output-meta'
|
169 |
|
|
If set to `on', Readline will display characters with the
|
170 |
|
|
eighth bit set directly rather than as a meta-prefixed escape
|
171 |
|
|
sequence. The default is `off'.
|
172 |
|
|
|
173 |
|
|
`print-completions-horizontally'
|
174 |
|
|
If set to `on', Readline will display completions with matches
|
175 |
|
|
sorted horizontally in alphabetical order, rather than down
|
176 |
|
|
the screen. The default is `off'.
|
177 |
|
|
|
178 |
|
|
`show-all-if-ambiguous'
|
179 |
|
|
This alters the default behavior of the completion functions.
|
180 |
|
|
If set to `on', words which have more than one possible
|
181 |
|
|
completion cause the matches to be listed immediately instead
|
182 |
|
|
of ringing the bell. The default value is `off'.
|
183 |
|
|
|
184 |
|
|
`visible-stats'
|
185 |
|
|
If set to `on', a character denoting a file's type is
|
186 |
|
|
appended to the filename when listing possible completions.
|
187 |
|
|
The default is `off'.
|
188 |
|
|
|
189 |
|
|
Key Bindings
|
190 |
|
|
The syntax for controlling key bindings in the init file is
|
191 |
|
|
simple. First you have to know the name of the command that you
|
192 |
|
|
want to change. The following sections contain tables of the
|
193 |
|
|
command name, the default keybinding, if any, and a short
|
194 |
|
|
description of what the command does.
|
195 |
|
|
|
196 |
|
|
Once you know the name of the command, simply place the name of
|
197 |
|
|
the key you wish to bind the command to, a colon, and then the
|
198 |
|
|
name of the command on a line in the init file. The name of the
|
199 |
|
|
key can be expressed in different ways, depending on which is most
|
200 |
|
|
comfortable for you.
|
201 |
|
|
|
202 |
|
|
KEYNAME: FUNCTION-NAME or MACRO
|
203 |
|
|
KEYNAME is the name of a key spelled out in English. For
|
204 |
|
|
example:
|
205 |
|
|
Control-u: universal-argument
|
206 |
|
|
Meta-Rubout: backward-kill-word
|
207 |
|
|
Control-o: "> output"
|
208 |
|
|
|
209 |
|
|
In the above example, is bound to the function
|
210 |
|
|
`universal-argument', and is bound to run the macro
|
211 |
|
|
expressed on the right hand side (that is, to insert the text
|
212 |
|
|
`> output' into the line).
|
213 |
|
|
|
214 |
|
|
"KEYSEQ": FUNCTION-NAME or MACRO
|
215 |
|
|
KEYSEQ differs from KEYNAME above in that strings denoting an
|
216 |
|
|
entire key sequence can be specified, by placing the key
|
217 |
|
|
sequence in double quotes. Some GNU Emacs style key escapes
|
218 |
|
|
can be used, as in the following example, but the special
|
219 |
|
|
character names are not recognized.
|
220 |
|
|
|
221 |
|
|
"\C-u": universal-argument
|
222 |
|
|
"\C-x\C-r": re-read-init-file
|
223 |
|
|
"\e[11~": "Function Key 1"
|
224 |
|
|
|
225 |
|
|
In the above example, is bound to the function
|
226 |
|
|
`universal-argument' (just as it was in the first example),
|
227 |
|
|
` ' is bound to the function `re-read-init-file',
|
228 |
|
|
and ` <[> <1> <1> <~>' is bound to insert the text
|
229 |
|
|
`Function Key 1'.
|
230 |
|
|
|
231 |
|
|
The following GNU Emacs style escape sequences are available when
|
232 |
|
|
specifying key sequences:
|
233 |
|
|
|
234 |
|
|
`\C-'
|
235 |
|
|
control prefix
|
236 |
|
|
|
237 |
|
|
`\M-'
|
238 |
|
|
meta prefix
|
239 |
|
|
|
240 |
|
|
`\e'
|
241 |
|
|
an escape character
|
242 |
|
|
|
243 |
|
|
`\\'
|
244 |
|
|
backslash
|
245 |
|
|
|
246 |
|
|
`\"'
|
247 |
|
|
<">
|
248 |
|
|
|
249 |
|
|
`\''
|
250 |
|
|
<'>
|
251 |
|
|
|
252 |
|
|
In addition to the GNU Emacs style escape sequences, a second set
|
253 |
|
|
of backslash escapes is available:
|
254 |
|
|
|
255 |
|
|
`\a'
|
256 |
|
|
alert (bell)
|
257 |
|
|
|
258 |
|
|
`\b'
|
259 |
|
|
backspace
|
260 |
|
|
|
261 |
|
|
`\d'
|
262 |
|
|
delete
|
263 |
|
|
|
264 |
|
|
`\f'
|
265 |
|
|
form feed
|
266 |
|
|
|
267 |
|
|
`\n'
|
268 |
|
|
newline
|
269 |
|
|
|
270 |
|
|
`\r'
|
271 |
|
|
carriage return
|
272 |
|
|
|
273 |
|
|
`\t'
|
274 |
|
|
horizontal tab
|
275 |
|
|
|
276 |
|
|
`\v'
|
277 |
|
|
vertical tab
|
278 |
|
|
|
279 |
|
|
`\NNN'
|
280 |
|
|
the character whose ASCII code is the octal value NNN (one to
|
281 |
|
|
three digits)
|
282 |
|
|
|
283 |
|
|
`\xNNN'
|
284 |
|
|
the character whose ASCII code is the hexadecimal value NNN
|
285 |
|
|
(one to three digits)
|
286 |
|
|
|
287 |
|
|
When entering the text of a macro, single or double quotes must be
|
288 |
|
|
used to indicate a macro definition. Unquoted text is assumed to
|
289 |
|
|
be a function name. In the macro body, the backslash escapes
|
290 |
|
|
described above are expanded. Backslash will quote any other
|
291 |
|
|
character in the macro text, including `"' and `''. For example,
|
292 |
|
|
the following binding will make `C-x \' insert a single `\' into
|
293 |
|
|
the line:
|
294 |
|
|
"\C-x\\": "\\"
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
|
298 |
|
|
|
299 |
|
|
Conditional Init Constructs
|
300 |
|
|
---------------------------
|
301 |
|
|
|
302 |
|
|
Readline implements a facility similar in spirit to the conditional
|
303 |
|
|
compilation features of the C preprocessor which allows key bindings
|
304 |
|
|
and variable settings to be performed as the result of tests. There
|
305 |
|
|
are four parser directives used.
|
306 |
|
|
|
307 |
|
|
`$if'
|
308 |
|
|
The `$if' construct allows bindings to be made based on the
|
309 |
|
|
editing mode, the terminal being used, or the application using
|
310 |
|
|
Readline. The text of the test extends to the end of the line; no
|
311 |
|
|
characters are required to isolate it.
|
312 |
|
|
|
313 |
|
|
`mode'
|
314 |
|
|
The `mode=' form of the `$if' directive is used to test
|
315 |
|
|
whether Readline is in `emacs' or `vi' mode. This may be
|
316 |
|
|
used in conjunction with the `set keymap' command, for
|
317 |
|
|
instance, to set bindings in the `emacs-standard' and
|
318 |
|
|
`emacs-ctlx' keymaps only if Readline is starting out in
|
319 |
|
|
`emacs' mode.
|
320 |
|
|
|
321 |
|
|
`term'
|
322 |
|
|
The `term=' form may be used to include terminal-specific key
|
323 |
|
|
bindings, perhaps to bind the key sequences output by the
|
324 |
|
|
terminal's function keys. The word on the right side of the
|
325 |
|
|
`=' is tested against both the full name of the terminal and
|
326 |
|
|
the portion of the terminal name before the first `-'. This
|
327 |
|
|
allows `sun' to match both `sun' and `sun-cmd', for instance.
|
328 |
|
|
|
329 |
|
|
`application'
|
330 |
|
|
The APPLICATION construct is used to include
|
331 |
|
|
application-specific settings. Each program using the
|
332 |
|
|
Readline library sets the APPLICATION NAME, and you can test
|
333 |
|
|
for it. This could be used to bind key sequences to
|
334 |
|
|
functions useful for a specific program. For instance, the
|
335 |
|
|
following command adds a key sequence that quotes the current
|
336 |
|
|
or previous word in Bash:
|
337 |
|
|
$if Bash
|
338 |
|
|
# Quote the current or previous word
|
339 |
|
|
"\C-xq": "\eb\"\ef\""
|
340 |
|
|
$endif
|
341 |
|
|
|
342 |
|
|
`$endif'
|
343 |
|
|
This command, as seen in the previous example, terminates an `$if'
|
344 |
|
|
command.
|
345 |
|
|
|
346 |
|
|
`$else'
|
347 |
|
|
Commands in this branch of the `$if' directive are executed if the
|
348 |
|
|
test fails.
|
349 |
|
|
|
350 |
|
|
`$include'
|
351 |
|
|
This directive takes a single filename as an argument and reads
|
352 |
|
|
commands and bindings from that file.
|
353 |
|
|
$include /etc/inputrc
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
File: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
|
357 |
|
|
|
358 |
|
|
Sample Init File
|
359 |
|
|
----------------
|
360 |
|
|
|
361 |
|
|
Here is an example of an inputrc file. This illustrates key
|
362 |
|
|
binding, variable assignment, and conditional syntax.
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
# This file controls the behaviour of line input editing for
|
366 |
|
|
# programs that use the Gnu Readline library. Existing programs
|
367 |
|
|
# include FTP, Bash, and Gdb.
|
368 |
|
|
#
|
369 |
|
|
# You can re-read the inputrc file with C-x C-r.
|
370 |
|
|
# Lines beginning with '#' are comments.
|
371 |
|
|
#
|
372 |
|
|
# First, include any systemwide bindings and variable assignments from
|
373 |
|
|
# /etc/Inputrc
|
374 |
|
|
$include /etc/Inputrc
|
375 |
|
|
|
376 |
|
|
#
|
377 |
|
|
# Set various bindings for emacs mode.
|
378 |
|
|
|
379 |
|
|
set editing-mode emacs
|
380 |
|
|
|
381 |
|
|
$if mode=emacs
|
382 |
|
|
|
383 |
|
|
Meta-Control-h: backward-kill-word Text after the function name is ignored
|
384 |
|
|
|
385 |
|
|
#
|
386 |
|
|
# Arrow keys in keypad mode
|
387 |
|
|
#
|
388 |
|
|
#"\M-OD": backward-char
|
389 |
|
|
#"\M-OC": forward-char
|
390 |
|
|
#"\M-OA": previous-history
|
391 |
|
|
#"\M-OB": next-history
|
392 |
|
|
#
|
393 |
|
|
# Arrow keys in ANSI mode
|
394 |
|
|
#
|
395 |
|
|
"\M-[D": backward-char
|
396 |
|
|
"\M-[C": forward-char
|
397 |
|
|
"\M-[A": previous-history
|
398 |
|
|
"\M-[B": next-history
|
399 |
|
|
#
|
400 |
|
|
# Arrow keys in 8 bit keypad mode
|
401 |
|
|
#
|
402 |
|
|
#"\M-\C-OD": backward-char
|
403 |
|
|
#"\M-\C-OC": forward-char
|
404 |
|
|
#"\M-\C-OA": previous-history
|
405 |
|
|
#"\M-\C-OB": next-history
|
406 |
|
|
#
|
407 |
|
|
# Arrow keys in 8 bit ANSI mode
|
408 |
|
|
#
|
409 |
|
|
#"\M-\C-[D": backward-char
|
410 |
|
|
#"\M-\C-[C": forward-char
|
411 |
|
|
#"\M-\C-[A": previous-history
|
412 |
|
|
#"\M-\C-[B": next-history
|
413 |
|
|
|
414 |
|
|
C-q: quoted-insert
|
415 |
|
|
|
416 |
|
|
$endif
|
417 |
|
|
|
418 |
|
|
# An old-style binding. This happens to be the default.
|
419 |
|
|
TAB: complete
|
420 |
|
|
|
421 |
|
|
# Macros that are convenient for shell interaction
|
422 |
|
|
$if Bash
|
423 |
|
|
# edit the path
|
424 |
|
|
"\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
|
425 |
|
|
# prepare to type a quoted word -- insert open and close double quotes
|
426 |
|
|
# and move to just after the open quote
|
427 |
|
|
"\C-x\"": "\"\"\C-b"
|
428 |
|
|
# insert a backslash (testing backslash escapes in sequences and macros)
|
429 |
|
|
"\C-x\\": "\\"
|
430 |
|
|
# Quote the current or previous word
|
431 |
|
|
"\C-xq": "\eb\"\ef\""
|
432 |
|
|
# Add a binding to refresh the line, which is unbound
|
433 |
|
|
"\C-xr": redraw-current-line
|
434 |
|
|
# Edit variable on current line.
|
435 |
|
|
"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
|
436 |
|
|
$endif
|
437 |
|
|
|
438 |
|
|
# use a visible bell if one is available
|
439 |
|
|
set bell-style visible
|
440 |
|
|
|
441 |
|
|
# don't strip characters to 7 bits when reading
|
442 |
|
|
set input-meta on
|
443 |
|
|
|
444 |
|
|
# allow iso-latin1 characters to be inserted rather than converted to
|
445 |
|
|
# prefix-meta sequences
|
446 |
|
|
set convert-meta off
|
447 |
|
|
|
448 |
|
|
# display characters with the eighth bit set directly rather than
|
449 |
|
|
# as meta-prefixed characters
|
450 |
|
|
set output-meta on
|
451 |
|
|
|
452 |
|
|
# if there are more than 150 possible completions for a word, ask the
|
453 |
|
|
# user if he wants to see all of them
|
454 |
|
|
set completion-query-items 150
|
455 |
|
|
|
456 |
|
|
# For FTP
|
457 |
|
|
$if Ftp
|
458 |
|
|
"\C-xg": "get \M-?"
|
459 |
|
|
"\C-xt": "put \M-?"
|
460 |
|
|
"\M-.": yank-last-arg
|
461 |
|
|
$endif
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
File: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
|
465 |
|
|
|
466 |
|
|
Bindable Readline Commands
|
467 |
|
|
==========================
|
468 |
|
|
|
469 |
|
|
* Menu:
|
470 |
|
|
|
471 |
|
|
* Commands For Moving:: Moving about the line.
|
472 |
|
|
* Commands For History:: Getting at previous lines.
|
473 |
|
|
* Commands For Text:: Commands for changing text.
|
474 |
|
|
* Commands For Killing:: Commands for killing and yanking.
|
475 |
|
|
* Numeric Arguments:: Specifying numeric arguments, repeat counts.
|
476 |
|
|
* Commands For Completion:: Getting Readline to do the typing for you.
|
477 |
|
|
* Keyboard Macros:: Saving and re-executing typed characters
|
478 |
|
|
* Miscellaneous Commands:: Other miscellaneous commands.
|
479 |
|
|
|
480 |
|
|
This section describes Readline commands that may be bound to key
|
481 |
|
|
sequences.
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
|
485 |
|
|
|
486 |
|
|
Commands For Moving
|
487 |
|
|
-------------------
|
488 |
|
|
|
489 |
|
|
`beginning-of-line (C-a)'
|
490 |
|
|
Move to the start of the current line.
|
491 |
|
|
|
492 |
|
|
`end-of-line (C-e)'
|
493 |
|
|
Move to the end of the line.
|
494 |
|
|
|
495 |
|
|
`forward-char (C-f)'
|
496 |
|
|
Move forward a character.
|
497 |
|
|
|
498 |
|
|
`backward-char (C-b)'
|
499 |
|
|
Move back a character.
|
500 |
|
|
|
501 |
|
|
`forward-word (M-f)'
|
502 |
|
|
Move forward to the end of the next word. Words are composed of
|
503 |
|
|
letters and digits.
|
504 |
|
|
|
505 |
|
|
`backward-word (M-b)'
|
506 |
|
|
Move back to the start of this, or the previous, word. Words are
|
507 |
|
|
composed of letters and digits.
|
508 |
|
|
|
509 |
|
|
`clear-screen (C-l)'
|
510 |
|
|
Clear the screen and redraw the current line, leaving the current
|
511 |
|
|
line at the top of the screen.
|
512 |
|
|
|
513 |
|
|
`redraw-current-line ()'
|
514 |
|
|
Refresh the current line. By default, this is unbound.
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
|
518 |
|
|
|
519 |
|
|
Commands For Manipulating The History
|
520 |
|
|
-------------------------------------
|
521 |
|
|
|
522 |
|
|
`accept-line (Newline, Return)'
|
523 |
|
|
Accept the line regardless of where the cursor is. If this line is
|
524 |
|
|
non-empty, add it to the history list. If this line was a history
|
525 |
|
|
line, then restore the history line to its original state.
|
526 |
|
|
|
527 |
|
|
`previous-history (C-p)'
|
528 |
|
|
Move `up' through the history list.
|
529 |
|
|
|
530 |
|
|
`next-history (C-n)'
|
531 |
|
|
Move `down' through the history list.
|
532 |
|
|
|
533 |
|
|
`beginning-of-history (M-<)'
|
534 |
|
|
Move to the first line in the history.
|
535 |
|
|
|
536 |
|
|
`end-of-history (M->)'
|
537 |
|
|
Move to the end of the input history, i.e., the line currently
|
538 |
|
|
being entered.
|
539 |
|
|
|
540 |
|
|
`reverse-search-history (C-r)'
|
541 |
|
|
Search backward starting at the current line and moving `up'
|
542 |
|
|
through the history as necessary. This is an incremental search.
|
543 |
|
|
|
544 |
|
|
`forward-search-history (C-s)'
|
545 |
|
|
Search forward starting at the current line and moving `down'
|
546 |
|
|
through the the history as necessary. This is an incremental
|
547 |
|
|
search.
|
548 |
|
|
|
549 |
|
|
`non-incremental-reverse-search-history (M-p)'
|
550 |
|
|
Search backward starting at the current line and moving `up'
|
551 |
|
|
through the history as necessary using a non-incremental search
|
552 |
|
|
for a string supplied by the user.
|
553 |
|
|
|
554 |
|
|
`non-incremental-forward-search-history (M-n)'
|
555 |
|
|
Search forward starting at the current line and moving `down'
|
556 |
|
|
through the the history as necessary using a non-incremental search
|
557 |
|
|
for a string supplied by the user.
|
558 |
|
|
|
559 |
|
|
`history-search-forward ()'
|
560 |
|
|
Search forward through the history for the string of characters
|
561 |
|
|
between the start of the current line and the current cursor
|
562 |
|
|
position (the POINT). This is a non-incremental search. By
|
563 |
|
|
default, this command is unbound.
|
564 |
|
|
|
565 |
|
|
`history-search-backward ()'
|
566 |
|
|
Search backward through the history for the string of characters
|
567 |
|
|
between the start of the current line and the point. This is a
|
568 |
|
|
non-incremental search. By default, this command is unbound.
|
569 |
|
|
|
570 |
|
|
`yank-nth-arg (M-C-y)'
|
571 |
|
|
Insert the first argument to the previous command (usually the
|
572 |
|
|
second word on the previous line). With an argument N, insert the
|
573 |
|
|
Nth word from the previous command (the words in the previous
|
574 |
|
|
command begin with word 0). A negative argument inserts the Nth
|
575 |
|
|
word from the end of the previous command.
|
576 |
|
|
|
577 |
|
|
`yank-last-arg (M-., M-_)'
|
578 |
|
|
Insert last argument to the previous command (the last word of the
|
579 |
|
|
previous history entry). With an argument, behave exactly like
|
580 |
|
|
`yank-nth-arg'. Successive calls to `yank-last-arg' move back
|
581 |
|
|
through the history list, inserting the last argument of each line
|
582 |
|
|
in turn.
|
583 |
|
|
|
584 |
|
|
|
585 |
|
|
File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
|
586 |
|
|
|
587 |
|
|
Commands For Changing Text
|
588 |
|
|
--------------------------
|
589 |
|
|
|
590 |
|
|
`delete-char (C-d)'
|
591 |
|
|
Delete the character under the cursor. If the cursor is at the
|
592 |
|
|
beginning of the line, there are no characters in the line, and
|
593 |
|
|
the last character typed was not bound to `delete-char', then
|
594 |
|
|
return `EOF'.
|
595 |
|
|
|
596 |
|
|
`backward-delete-char (Rubout)'
|
597 |
|
|
Delete the character behind the cursor. A numeric argument means
|
598 |
|
|
to kill the characters instead of deleting them.
|
599 |
|
|
|
600 |
|
|
`forward-backward-delete-char ()'
|
601 |
|
|
Delete the character under the cursor, unless the cursor is at the
|
602 |
|
|
end of the line, in which case the character behind the cursor is
|
603 |
|
|
deleted. By default, this is not bound to a key.
|
604 |
|
|
|
605 |
|
|
`quoted-insert (C-q, C-v)'
|
606 |
|
|
Add the next character typed to the line verbatim. This is how to
|
607 |
|
|
insert key sequences like , for example.
|
608 |
|
|
|
609 |
|
|
`tab-insert (M-TAB)'
|
610 |
|
|
Insert a tab character.
|
611 |
|
|
|
612 |
|
|
`self-insert (a, b, A, 1, !, ...)'
|
613 |
|
|
Insert yourself.
|
614 |
|
|
|
615 |
|
|
`transpose-chars (C-t)'
|
616 |
|
|
Drag the character before the cursor forward over the character at
|
617 |
|
|
the cursor, moving the cursor forward as well. If the insertion
|
618 |
|
|
point is at the end of the line, then this transposes the last two
|
619 |
|
|
characters of the line. Negative arguments don't work.
|
620 |
|
|
|
621 |
|
|
`transpose-words (M-t)'
|
622 |
|
|
Drag the word behind the cursor past the word in front of the
|
623 |
|
|
cursor moving the cursor over that word as well.
|
624 |
|
|
|
625 |
|
|
`upcase-word (M-u)'
|
626 |
|
|
Uppercase the current (or following) word. With a negative
|
627 |
|
|
argument, uppercase the previous word, but do not move the cursor.
|
628 |
|
|
|
629 |
|
|
`downcase-word (M-l)'
|
630 |
|
|
Lowercase the current (or following) word. With a negative
|
631 |
|
|
argument, lowercase the previous word, but do not move the cursor.
|
632 |
|
|
|
633 |
|
|
`capitalize-word (M-c)'
|
634 |
|
|
Capitalize the current (or following) word. With a negative
|
635 |
|
|
argument, capitalize the previous word, but do not move the cursor.
|
636 |
|
|
|
637 |
|
|
|
638 |
|
|
File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
|
639 |
|
|
|
640 |
|
|
Killing And Yanking
|
641 |
|
|
-------------------
|
642 |
|
|
|
643 |
|
|
`kill-line (C-k)'
|
644 |
|
|
Kill the text from the current cursor position to the end of the
|
645 |
|
|
line.
|
646 |
|
|
|
647 |
|
|
`backward-kill-line (C-x Rubout)'
|
648 |
|
|
Kill backward to the beginning of the line.
|
649 |
|
|
|
650 |
|
|
`unix-line-discard (C-u)'
|
651 |
|
|
Kill backward from the cursor to the beginning of the current line.
|
652 |
|
|
The killed text is saved on the kill-ring.
|
653 |
|
|
|
654 |
|
|
`kill-whole-line ()'
|
655 |
|
|
Kill all characters on the current line, no matter where the
|
656 |
|
|
cursor is. By default, this is unbound.
|
657 |
|
|
|
658 |
|
|
`kill-word (M-d)'
|
659 |
|
|
Kill from the cursor to the end of the current word, or if between
|
660 |
|
|
words, to the end of the next word. Word boundaries are the same
|
661 |
|
|
as `forward-word'.
|
662 |
|
|
|
663 |
|
|
`backward-kill-word (M-DEL)'
|
664 |
|
|
Kill the word behind the cursor. Word boundaries are the same as
|
665 |
|
|
`backward-word'.
|
666 |
|
|
|
667 |
|
|
`unix-word-rubout (C-w)'
|
668 |
|
|
Kill the word behind the cursor, using white space as a word
|
669 |
|
|
boundary. The killed text is saved on the kill-ring.
|
670 |
|
|
|
671 |
|
|
`delete-horizontal-space ()'
|
672 |
|
|
Delete all spaces and tabs around point. By default, this is
|
673 |
|
|
unbound.
|
674 |
|
|
|
675 |
|
|
`kill-region ()'
|
676 |
|
|
Kill the text between the point and the _mark_ (saved cursor
|
677 |
|
|
position). This text is referred to as the REGION. By default,
|
678 |
|
|
this command is unbound.
|
679 |
|
|
|
680 |
|
|
`copy-region-as-kill ()'
|
681 |
|
|
Copy the text in the region to the kill buffer, so it can be yanked
|
682 |
|
|
right away. By default, this command is unbound.
|
683 |
|
|
|
684 |
|
|
`copy-backward-word ()'
|
685 |
|
|
Copy the word before point to the kill buffer. The word
|
686 |
|
|
boundaries are the same as `backward-word'. By default, this
|
687 |
|
|
command is unbound.
|
688 |
|
|
|
689 |
|
|
`copy-forward-word ()'
|
690 |
|
|
Copy the word following point to the kill buffer. The word
|
691 |
|
|
boundaries are the same as `forward-word'. By default, this
|
692 |
|
|
command is unbound.
|
693 |
|
|
|
694 |
|
|
`yank (C-y)'
|
695 |
|
|
Yank the top of the kill ring into the buffer at the current
|
696 |
|
|
cursor position.
|
697 |
|
|
|
698 |
|
|
`yank-pop (M-y)'
|
699 |
|
|
Rotate the kill-ring, and yank the new top. You can only do this
|
700 |
|
|
if the prior command is yank or yank-pop.
|
701 |
|
|
|
702 |
|
|
|
703 |
|
|
File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
|
704 |
|
|
|
705 |
|
|
Specifying Numeric Arguments
|
706 |
|
|
----------------------------
|
707 |
|
|
|
708 |
|
|
`digit-argument (M-0, M-1, ... M--)'
|
709 |
|
|
Add this digit to the argument already accumulating, or start a new
|
710 |
|
|
argument. starts a negative argument.
|
711 |
|
|
|
712 |
|
|
`universal-argument ()'
|
713 |
|
|
This is another way to specify an argument. If this command is
|
714 |
|
|
followed by one or more digits, optionally with a leading minus
|
715 |
|
|
sign, those digits define the argument. If the command is
|
716 |
|
|
followed by digits, executing `universal-argument' again ends the
|
717 |
|
|
numeric argument, but is otherwise ignored. As a special case, if
|
718 |
|
|
this command is immediately followed by a character that is
|
719 |
|
|
neither a digit or minus sign, the argument count for the next
|
720 |
|
|
command is multiplied by four. The argument count is initially
|
721 |
|
|
one, so executing this function the first time makes the argument
|
722 |
|
|
count four, a second time makes the argument count sixteen, and so
|
723 |
|
|
on. By default, this is not bound to a key.
|
724 |
|
|
|
725 |
|
|
|
726 |
|
|
File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
|
727 |
|
|
|
728 |
|
|
Letting Readline Type For You
|
729 |
|
|
-----------------------------
|
730 |
|
|
|
731 |
|
|
`complete (TAB)'
|
732 |
|
|
Attempt to do completion on the text before the cursor. This is
|
733 |
|
|
application-specific. Generally, if you are typing a filename
|
734 |
|
|
argument, you can do filename completion; if you are typing a
|
735 |
|
|
command, you can do command completion; if you are typing in a
|
736 |
|
|
symbol to GDB, you can do symbol name completion; if you are
|
737 |
|
|
typing in a variable to Bash, you can do variable name completion,
|
738 |
|
|
and so on.
|
739 |
|
|
|
740 |
|
|
`possible-completions (M-?)'
|
741 |
|
|
List the possible completions of the text before the cursor.
|
742 |
|
|
|
743 |
|
|
`insert-completions (M-*)'
|
744 |
|
|
Insert all completions of the text before point that would have
|
745 |
|
|
been generated by `possible-completions'.
|
746 |
|
|
|
747 |
|
|
`menu-complete ()'
|
748 |
|
|
Similar to `complete', but replaces the word to be completed with
|
749 |
|
|
a single match from the list of possible completions. Repeated
|
750 |
|
|
execution of `menu-complete' steps through the list of possible
|
751 |
|
|
completions, inserting each match in turn. At the end of the list
|
752 |
|
|
of completions, the bell is rung and the original text is restored.
|
753 |
|
|
An argument of N moves N positions forward in the list of matches;
|
754 |
|
|
a negative argument may be used to move backward through the list.
|
755 |
|
|
This command is intended to be bound to `TAB', but is unbound by
|
756 |
|
|
default.
|
757 |
|
|
|
758 |
|
|
`delete-char-or-list ()'
|
759 |
|
|
Deletes the character under the cursor if not at the beginning or
|
760 |
|
|
end of the line (like `delete-char'). If at the end of the line,
|
761 |
|
|
behaves identically to `possible-completions'. This command is
|
762 |
|
|
unbound by default.
|
763 |
|
|
|
764 |
|
|
|
765 |
|
|
File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
|
766 |
|
|
|
767 |
|
|
Keyboard Macros
|
768 |
|
|
---------------
|
769 |
|
|
|
770 |
|
|
`start-kbd-macro (C-x ()'
|
771 |
|
|
Begin saving the characters typed into the current keyboard macro.
|
772 |
|
|
|
773 |
|
|
`end-kbd-macro (C-x ))'
|
774 |
|
|
Stop saving the characters typed into the current keyboard macro
|
775 |
|
|
and save the definition.
|
776 |
|
|
|
777 |
|
|
`call-last-kbd-macro (C-x e)'
|
778 |
|
|
Re-execute the last keyboard macro defined, by making the
|
779 |
|
|
characters in the macro appear as if typed at the keyboard.
|
780 |
|
|
|
781 |
|
|
|
782 |
|
|
File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
|
783 |
|
|
|
784 |
|
|
Some Miscellaneous Commands
|
785 |
|
|
---------------------------
|
786 |
|
|
|
787 |
|
|
`re-read-init-file (C-x C-r)'
|
788 |
|
|
Read in the contents of the inputrc file, and incorporate any
|
789 |
|
|
bindings or variable assignments found there.
|
790 |
|
|
|
791 |
|
|
`abort (C-g)'
|
792 |
|
|
Abort the current editing command and ring the terminal's bell
|
793 |
|
|
(subject to the setting of `bell-style').
|
794 |
|
|
|
795 |
|
|
`do-uppercase-version (M-a, M-b, M-X, ...)'
|
796 |
|
|
If the metafied character X is lowercase, run the command that is
|
797 |
|
|
bound to the corresponding uppercase character.
|
798 |
|
|
|
799 |
|
|
`prefix-meta (ESC)'
|
800 |
|
|
Make the next character typed be metafied. This is for keyboards
|
801 |
|
|
without a meta key. Typing `ESC f' is equivalent to typing `M-f'.
|
802 |
|
|
|
803 |
|
|
`undo (C-_, C-x C-u)'
|
804 |
|
|
Incremental undo, separately remembered for each line.
|
805 |
|
|
|
806 |
|
|
`revert-line (M-r)'
|
807 |
|
|
Undo all changes made to this line. This is like executing the
|
808 |
|
|
`undo' command enough times to get back to the beginning.
|
809 |
|
|
|
810 |
|
|
`tilde-expand (M-~)'
|
811 |
|
|
Perform tilde expansion on the current word.
|
812 |
|
|
|
813 |
|
|
`set-mark (C-@)'
|
814 |
|
|
Set the mark to the current point. If a numeric argument is
|
815 |
|
|
supplied, the mark is set to that position.
|
816 |
|
|
|
817 |
|
|
`exchange-point-and-mark (C-x C-x)'
|
818 |
|
|
Swap the point with the mark. The current cursor position is set
|
819 |
|
|
to the saved position, and the old cursor position is saved as the
|
820 |
|
|
mark.
|
821 |
|
|
|
822 |
|
|
`character-search (C-])'
|
823 |
|
|
A character is read and point is moved to the next occurrence of
|
824 |
|
|
that character. A negative count searches for previous
|
825 |
|
|
occurrences.
|
826 |
|
|
|
827 |
|
|
`character-search-backward (M-C-])'
|
828 |
|
|
A character is read and point is moved to the previous occurrence
|
829 |
|
|
of that character. A negative count searches for subsequent
|
830 |
|
|
occurrences.
|
831 |
|
|
|
832 |
|
|
`insert-comment (M-#)'
|
833 |
|
|
The value of the `comment-begin' variable is inserted at the
|
834 |
|
|
beginning of the current line, and the line is accepted as if a
|
835 |
|
|
newline had been typed.
|
836 |
|
|
|
837 |
|
|
`dump-functions ()'
|
838 |
|
|
Print all of the functions and their key bindings to the Readline
|
839 |
|
|
output stream. If a numeric argument is supplied, the output is
|
840 |
|
|
formatted in such a way that it can be made part of an INPUTRC
|
841 |
|
|
file. This command is unbound by default.
|
842 |
|
|
|
843 |
|
|
`dump-variables ()'
|
844 |
|
|
Print all of the settable variables and their values to the
|
845 |
|
|
Readline output stream. If a numeric argument is supplied, the
|
846 |
|
|
output is formatted in such a way that it can be made part of an
|
847 |
|
|
INPUTRC file. This command is unbound by default.
|
848 |
|
|
|
849 |
|
|
`dump-macros ()'
|
850 |
|
|
Print all of the Readline key sequences bound to macros and the
|
851 |
|
|
strings they ouput. If a numeric argument is supplied, the output
|
852 |
|
|
is formatted in such a way that it can be made part of an INPUTRC
|
853 |
|
|
file. This command is unbound by default.
|
854 |
|
|
|
855 |
|
|
|
856 |
|
|
File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
|
857 |
|
|
|
858 |
|
|
Readline vi Mode
|
859 |
|
|
================
|
860 |
|
|
|
861 |
|
|
While the Readline library does not have a full set of `vi' editing
|
862 |
|
|
functions, it does contain enough to allow simple editing of the line.
|
863 |
|
|
The Readline `vi' mode behaves as specified in the POSIX 1003.2
|
864 |
|
|
standard.
|
865 |
|
|
|
866 |
|
|
In order to switch interactively between `emacs' and `vi' editing
|
867 |
|
|
modes, use the command M-C-j (toggle-editing-mode). The Readline
|
868 |
|
|
default is `emacs' mode.
|
869 |
|
|
|
870 |
|
|
When you enter a line in `vi' mode, you are already placed in
|
871 |
|
|
`insertion' mode, as if you had typed an `i'. Pressing switches
|
872 |
|
|
you into `command' mode, where you can edit the text of the line with
|
873 |
|
|
the standard `vi' movement keys, move to previous history lines with
|
874 |
|
|
`k' and subsequent lines with `j', and so forth.
|
875 |
|
|
|
876 |
|
|
|
877 |
|
|
File: gdb.info, Node: Using History Interactively, Next: Installing GDB, Prev: Command Line Editing, Up: Top
|
878 |
|
|
|
879 |
|
|
Using History Interactively
|
880 |
|
|
***************************
|
881 |
|
|
|
882 |
|
|
This chapter describes how to use the GNU History Library
|
883 |
|
|
interactively, from a user's standpoint. It should be considered a
|
884 |
|
|
user's guide.
|
885 |
|
|
|
886 |
|
|
* Menu:
|
887 |
|
|
|
888 |
|
|
* History Interaction:: What it feels like using History as a user.
|
889 |
|
|
|
890 |
|
|
|
891 |
|
|
File: gdb.info, Node: History Interaction, Up: Using History Interactively
|
892 |
|
|
|
893 |
|
|
History Expansion
|
894 |
|
|
=================
|
895 |
|
|
|
896 |
|
|
The History library provides a history expansion feature that is
|
897 |
|
|
similar to the history expansion provided by `csh'. This section
|
898 |
|
|
describes the syntax used to manipulate the history information.
|
899 |
|
|
|
900 |
|
|
History expansions introduce words from the history list into the
|
901 |
|
|
input stream, making it easy to repeat commands, insert the arguments
|
902 |
|
|
to a previous command into the current input line, or fix errors in
|
903 |
|
|
previous commands quickly.
|
904 |
|
|
|
905 |
|
|
History expansion takes place in two parts. The first is to
|
906 |
|
|
determine which line from the history list should be used during
|
907 |
|
|
substitution. The second is to select portions of that line for
|
908 |
|
|
inclusion into the current one. The line selected from the history is
|
909 |
|
|
called the "event", and the portions of that line that are acted upon
|
910 |
|
|
are called "words". Various "modifiers" are available to manipulate
|
911 |
|
|
the selected words. The line is broken into words in the same fashion
|
912 |
|
|
that Bash does, so that several words surrounded by quotes are
|
913 |
|
|
considered one word. History expansions are introduced by the
|
914 |
|
|
appearance of the history expansion character, which is `!' by default.
|
915 |
|
|
|
916 |
|
|
* Menu:
|
917 |
|
|
|
918 |
|
|
* Event Designators:: How to specify which history line to use.
|
919 |
|
|
* Word Designators:: Specifying which words are of interest.
|
920 |
|
|
* Modifiers:: Modifying the results of substitution.
|
921 |
|
|
|
922 |
|
|
|
923 |
|
|
File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
|
924 |
|
|
|
925 |
|
|
Event Designators
|
926 |
|
|
-----------------
|
927 |
|
|
|
928 |
|
|
An event designator is a reference to a command line entry in the
|
929 |
|
|
history list.
|
930 |
|
|
|
931 |
|
|
`!'
|
932 |
|
|
Start a history substitution, except when followed by a space, tab,
|
933 |
|
|
the end of the line, `=' or `('.
|
934 |
|
|
|
935 |
|
|
`!N'
|
936 |
|
|
Refer to command line N.
|
937 |
|
|
|
938 |
|
|
`!-N'
|
939 |
|
|
Refer to the command N lines back.
|
940 |
|
|
|
941 |
|
|
`!!'
|
942 |
|
|
Refer to the previous command. This is a synonym for `!-1'.
|
943 |
|
|
|
944 |
|
|
`!STRING'
|
945 |
|
|
Refer to the most recent command starting with STRING.
|
946 |
|
|
|
947 |
|
|
`!?STRING[?]'
|
948 |
|
|
Refer to the most recent command containing STRING. The trailing
|
949 |
|
|
`?' may be omitted if the STRING is followed immediately by a
|
950 |
|
|
newline.
|
951 |
|
|
|
952 |
|
|
`^STRING1^STRING2^'
|
953 |
|
|
Quick Substitution. Repeat the last command, replacing STRING1
|
954 |
|
|
with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.
|
955 |
|
|
|
956 |
|
|
`!#'
|
957 |
|
|
The entire command line typed so far.
|
958 |
|
|
|
959 |
|
|
|
960 |
|
|
File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
|
961 |
|
|
|
962 |
|
|
Word Designators
|
963 |
|
|
----------------
|
964 |
|
|
|
965 |
|
|
Word designators are used to select desired words from the event. A
|
966 |
|
|
`:' separates the event specification from the word designator. It may
|
967 |
|
|
be omitted if the word designator begins with a `^', `$', `*', `-', or
|
968 |
|
|
`%'. Words are numbered from the beginning of the line, with the first
|
969 |
|
|
word being denoted by 0 (zero). Words are inserted into the current
|
970 |
|
|
line separated by single spaces.
|
971 |
|
|
|
972 |
|
|
`0 (zero)'
|
973 |
|
|
The `0'th word. For many applications, this is the command word.
|
974 |
|
|
|
975 |
|
|
`N'
|
976 |
|
|
The Nth word.
|
977 |
|
|
|
978 |
|
|
`^'
|
979 |
|
|
The first argument; that is, word 1.
|
980 |
|
|
|
981 |
|
|
`$'
|
982 |
|
|
The last argument.
|
983 |
|
|
|
984 |
|
|
`%'
|
985 |
|
|
The word matched by the most recent `?STRING?' search.
|
986 |
|
|
|
987 |
|
|
`X-Y'
|
988 |
|
|
A range of words; `-Y' abbreviates `0-Y'.
|
989 |
|
|
|
990 |
|
|
`*'
|
991 |
|
|
All of the words, except the `0'th. This is a synonym for `1-$'.
|
992 |
|
|
It is not an error to use `*' if there is just one word in the
|
993 |
|
|
event; the empty string is returned in that case.
|
994 |
|
|
|
995 |
|
|
`X*'
|
996 |
|
|
Abbreviates `X-$'
|
997 |
|
|
|
998 |
|
|
`X-'
|
999 |
|
|
Abbreviates `X-$' like `X*', but omits the last word.
|
1000 |
|
|
|
1001 |
|
|
If a word designator is supplied without an event specification, the
|
1002 |
|
|
previous command is used as the event.
|
1003 |
|
|
|
1004 |
|
|
|
1005 |
|
|
File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
|
1006 |
|
|
|
1007 |
|
|
Modifiers
|
1008 |
|
|
---------
|
1009 |
|
|
|
1010 |
|
|
After the optional word designator, you can add a sequence of one or
|
1011 |
|
|
more of the following modifiers, each preceded by a `:'.
|
1012 |
|
|
|
1013 |
|
|
`h'
|
1014 |
|
|
Remove a trailing pathname component, leaving only the head.
|
1015 |
|
|
|
1016 |
|
|
`t'
|
1017 |
|
|
Remove all leading pathname components, leaving the tail.
|
1018 |
|
|
|
1019 |
|
|
`r'
|
1020 |
|
|
Remove a trailing suffix of the form `.SUFFIX', leaving the
|
1021 |
|
|
basename.
|
1022 |
|
|
|
1023 |
|
|
`e'
|
1024 |
|
|
Remove all but the trailing suffix.
|
1025 |
|
|
|
1026 |
|
|
`p'
|
1027 |
|
|
Print the new command but do not execute it.
|
1028 |
|
|
|
1029 |
|
|
`s/OLD/NEW/'
|
1030 |
|
|
Substitute NEW for the first occurrence of OLD in the event line.
|
1031 |
|
|
Any delimiter may be used in place of `/'. The delimiter may be
|
1032 |
|
|
quoted in OLD and NEW with a single backslash. If `&' appears in
|
1033 |
|
|
NEW, it is replaced by OLD. A single backslash will quote the
|
1034 |
|
|
`&'. The final delimiter is optional if it is the last character
|
1035 |
|
|
on the input line.
|
1036 |
|
|
|
1037 |
|
|
`&'
|
1038 |
|
|
Repeat the previous substitution.
|
1039 |
|
|
|
1040 |
|
|
`g'
|
1041 |
|
|
Cause changes to be applied over the entire event line. Used in
|
1042 |
|
|
conjunction with `s', as in `gs/OLD/NEW/', or with `&'.
|
1043 |
|
|
|
1044 |
|
|
|
1045 |
|
|
File: gdb.info, Node: Formatting Documentation, Next: Command Line Editing, Prev: GDB Bugs, Up: Top
|
1046 |
|
|
|
1047 |
|
|
Formatting Documentation
|
1048 |
|
|
************************
|
1049 |
|
|
|
1050 |
|
|
The GDB 4 release includes an already-formatted reference card, ready
|
1051 |
|
|
for printing with PostScript or Ghostscript, in the `gdb' subdirectory
|
1052 |
|
|
of the main source directory(1). If you can use PostScript or
|
1053 |
|
|
Ghostscript with your printer, you can print the reference card
|
1054 |
|
|
immediately with `refcard.ps'.
|
1055 |
|
|
|
1056 |
|
|
The release also includes the source for the reference card. You
|
1057 |
|
|
can format it, using TeX, by typing:
|
1058 |
|
|
|
1059 |
|
|
make refcard.dvi
|
1060 |
|
|
|
1061 |
|
|
The GDB reference card is designed to print in "landscape" mode on
|
1062 |
|
|
US "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
|
1063 |
|
|
high. You will need to specify this form of printing as an option to
|
1064 |
|
|
your DVI output program.
|
1065 |
|
|
|
1066 |
|
|
All the documentation for GDB comes as part of the machine-readable
|
1067 |
|
|
distribution. The documentation is written in Texinfo format, which is
|
1068 |
|
|
a documentation system that uses a single source file to produce both
|
1069 |
|
|
on-line information and a printed manual. You can use one of the Info
|
1070 |
|
|
formatting commands to create the on-line version of the documentation
|
1071 |
|
|
and TeX (or `texi2roff') to typeset the printed version.
|
1072 |
|
|
|
1073 |
|
|
GDB includes an already formatted copy of the on-line Info version
|
1074 |
|
|
of this manual in the `gdb' subdirectory. The main Info file is
|
1075 |
|
|
`gdb-5.0/gdb/gdb.info', and it refers to subordinate files matching
|
1076 |
|
|
`gdb.info*' in the same directory. If necessary, you can print out
|
1077 |
|
|
these files, or read them with any editor; but they are easier to read
|
1078 |
|
|
using the `info' subsystem in GNU Emacs or the standalone `info'
|
1079 |
|
|
program, available as part of the GNU Texinfo distribution.
|
1080 |
|
|
|
1081 |
|
|
If you want to format these Info files yourself, you need one of the
|
1082 |
|
|
Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
|
1083 |
|
|
|
1084 |
|
|
If you have `makeinfo' installed, and are in the top level GDB
|
1085 |
|
|
source directory (`gdb-5.0', in the case of version 5.0), you can make
|
1086 |
|
|
the Info file by typing:
|
1087 |
|
|
|
1088 |
|
|
cd gdb
|
1089 |
|
|
make gdb.info
|
1090 |
|
|
|
1091 |
|
|
If you want to typeset and print copies of this manual, you need TeX,
|
1092 |
|
|
a program to print its DVI output files, and `texinfo.tex', the Texinfo
|
1093 |
|
|
definitions file.
|
1094 |
|
|
|
1095 |
|
|
TeX is a typesetting program; it does not print files directly, but
|
1096 |
|
|
produces output files called DVI files. To print a typeset document,
|
1097 |
|
|
you need a program to print DVI files. If your system has TeX
|
1098 |
|
|
installed, chances are it has such a program. The precise command to
|
1099 |
|
|
use depends on your system; `lpr -d' is common; another (for PostScript
|
1100 |
|
|
devices) is `dvips'. The DVI print command may require a file name
|
1101 |
|
|
without any extension or a `.dvi' extension.
|
1102 |
|
|
|
1103 |
|
|
TeX also requires a macro definitions file called `texinfo.tex'.
|
1104 |
|
|
This file tells TeX how to typeset a document written in Texinfo
|
1105 |
|
|
format. On its own, TeX cannot either read or typeset a Texinfo file.
|
1106 |
|
|
`texinfo.tex' is distributed with GDB and is located in the
|
1107 |
|
|
`gdb-VERSION-NUMBER/texinfo' directory.
|
1108 |
|
|
|
1109 |
|
|
If you have TeX and a DVI printer program installed, you can typeset
|
1110 |
|
|
and print this manual. First switch to the the `gdb' subdirectory of
|
1111 |
|
|
the main source directory (for example, to `gdb-5.0/gdb') and type:
|
1112 |
|
|
|
1113 |
|
|
make gdb.dvi
|
1114 |
|
|
|
1115 |
|
|
Then give `gdb.dvi' to your DVI printing program.
|
1116 |
|
|
|
1117 |
|
|
---------- Footnotes ----------
|
1118 |
|
|
|
1119 |
|
|
(1) In `gdb-5.0/gdb/refcard.ps' of the version 5.0 release.
|
1120 |
|
|
|
1121 |
|
|
|
1122 |
|
|
File: gdb.info, Node: Installing GDB, Next: Index, Prev: Using History Interactively, Up: Top
|
1123 |
|
|
|
1124 |
|
|
Installing GDB
|
1125 |
|
|
**************
|
1126 |
|
|
|
1127 |
|
|
GDB comes with a `configure' script that automates the process of
|
1128 |
|
|
preparing GDB for installation; you can then use `make' to build the
|
1129 |
|
|
`gdb' program.
|
1130 |
|
|
|
1131 |
|
|
The GDB distribution includes all the source code you need for GDB
|
1132 |
|
|
in a single directory, whose name is usually composed by appending the
|
1133 |
|
|
version number to `gdb'.
|
1134 |
|
|
|
1135 |
|
|
For example, the GDB version 5.0 distribution is in the `gdb-5.0'
|
1136 |
|
|
directory. That directory contains:
|
1137 |
|
|
|
1138 |
|
|
`gdb-5.0/configure (and supporting files)'
|
1139 |
|
|
script for configuring GDB and all its supporting libraries
|
1140 |
|
|
|
1141 |
|
|
`gdb-5.0/gdb'
|
1142 |
|
|
the source specific to GDB itself
|
1143 |
|
|
|
1144 |
|
|
`gdb-5.0/bfd'
|
1145 |
|
|
source for the Binary File Descriptor library
|
1146 |
|
|
|
1147 |
|
|
`gdb-5.0/include'
|
1148 |
|
|
GNU include files
|
1149 |
|
|
|
1150 |
|
|
`gdb-5.0/libiberty'
|
1151 |
|
|
source for the `-liberty' free software library
|
1152 |
|
|
|
1153 |
|
|
`gdb-5.0/opcodes'
|
1154 |
|
|
source for the library of opcode tables and disassemblers
|
1155 |
|
|
|
1156 |
|
|
`gdb-5.0/readline'
|
1157 |
|
|
source for the GNU command-line interface
|
1158 |
|
|
|
1159 |
|
|
`gdb-5.0/glob'
|
1160 |
|
|
source for the GNU filename pattern-matching subroutine
|
1161 |
|
|
|
1162 |
|
|
`gdb-5.0/mmalloc'
|
1163 |
|
|
source for the GNU memory-mapped malloc package
|
1164 |
|
|
|
1165 |
|
|
The simplest way to configure and build GDB is to run `configure'
|
1166 |
|
|
from the `gdb-VERSION-NUMBER' source directory, which in this example
|
1167 |
|
|
is the `gdb-5.0' directory.
|
1168 |
|
|
|
1169 |
|
|
First switch to the `gdb-VERSION-NUMBER' source directory if you are
|
1170 |
|
|
not already in it; then run `configure'. Pass the identifier for the
|
1171 |
|
|
platform on which GDB will run as an argument.
|
1172 |
|
|
|
1173 |
|
|
For example:
|
1174 |
|
|
|
1175 |
|
|
cd gdb-5.0
|
1176 |
|
|
./configure HOST
|
1177 |
|
|
make
|
1178 |
|
|
|
1179 |
|
|
where HOST is an identifier such as `sun4' or `decstation', that
|
1180 |
|
|
identifies the platform where GDB will run. (You can often leave off
|
1181 |
|
|
HOST; `configure' tries to guess the correct value by examining your
|
1182 |
|
|
system.)
|
1183 |
|
|
|
1184 |
|
|
Running `configure HOST' and then running `make' builds the `bfd',
|
1185 |
|
|
`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
|
1186 |
|
|
The configured source files, and the binaries, are left in the
|
1187 |
|
|
corresponding source directories.
|
1188 |
|
|
|
1189 |
|
|
`configure' is a Bourne-shell (`/bin/sh') script; if your system
|
1190 |
|
|
does not recognize this automatically when you run a different shell,
|
1191 |
|
|
you may need to run `sh' on it explicitly:
|
1192 |
|
|
|
1193 |
|
|
sh configure HOST
|
1194 |
|
|
|
1195 |
|
|
If you run `configure' from a directory that contains source
|
1196 |
|
|
directories for multiple libraries or programs, such as the `gdb-5.0'
|
1197 |
|
|
source directory for version 5.0, `configure' creates configuration
|
1198 |
|
|
files for every directory level underneath (unless you tell it not to,
|
1199 |
|
|
with the `--norecursion' option).
|
1200 |
|
|
|
1201 |
|
|
You can run the `configure' script from any of the subordinate
|
1202 |
|
|
directories in the GDB distribution if you only want to configure that
|
1203 |
|
|
subdirectory, but be sure to specify a path to it.
|
1204 |
|
|
|
1205 |
|
|
For example, with version 5.0, type the following to configure only
|
1206 |
|
|
the `bfd' subdirectory:
|
1207 |
|
|
|
1208 |
|
|
cd gdb-5.0/bfd
|
1209 |
|
|
../configure HOST
|
1210 |
|
|
|
1211 |
|
|
You can install `gdb' anywhere; it has no hardwired paths. However,
|
1212 |
|
|
you should make sure that the shell on your path (named by the `SHELL'
|
1213 |
|
|
environment variable) is publicly readable. Remember that GDB uses the
|
1214 |
|
|
shell to start your program--some systems refuse to let GDB debug child
|
1215 |
|
|
processes whose programs are not readable.
|
1216 |
|
|
|
1217 |
|
|
* Menu:
|
1218 |
|
|
|
1219 |
|
|
* Separate Objdir:: Compiling GDB in another directory
|
1220 |
|
|
* Config Names:: Specifying names for hosts and targets
|
1221 |
|
|
* Configure Options:: Summary of options for configure
|
1222 |
|
|
|
1223 |
|
|
|
1224 |
|
|
File: gdb.info, Node: Separate Objdir, Next: Config Names, Up: Installing GDB
|
1225 |
|
|
|
1226 |
|
|
Compiling GDB in another directory
|
1227 |
|
|
==================================
|
1228 |
|
|
|
1229 |
|
|
If you want to run GDB versions for several host or target machines,
|
1230 |
|
|
you need a different `gdb' compiled for each combination of host and
|
1231 |
|
|
target. `configure' is designed to make this easy by allowing you to
|
1232 |
|
|
generate each configuration in a separate subdirectory, rather than in
|
1233 |
|
|
the source directory. If your `make' program handles the `VPATH'
|
1234 |
|
|
feature (GNU `make' does), running `make' in each of these directories
|
1235 |
|
|
builds the `gdb' program specified there.
|
1236 |
|
|
|
1237 |
|
|
To build `gdb' in a separate directory, run `configure' with the
|
1238 |
|
|
`--srcdir' option to specify where to find the source. (You also need
|
1239 |
|
|
to specify a path to find `configure' itself from your working
|
1240 |
|
|
directory. If the path to `configure' would be the same as the
|
1241 |
|
|
argument to `--srcdir', you can leave out the `--srcdir' option; it is
|
1242 |
|
|
assumed.)
|
1243 |
|
|
|
1244 |
|
|
For example, with version 5.0, you can build GDB in a separate
|
1245 |
|
|
directory for a Sun 4 like this:
|
1246 |
|
|
|
1247 |
|
|
cd gdb-5.0
|
1248 |
|
|
mkdir ../gdb-sun4
|
1249 |
|
|
cd ../gdb-sun4
|
1250 |
|
|
../gdb-5.0/configure sun4
|
1251 |
|
|
make
|
1252 |
|
|
|
1253 |
|
|
When `configure' builds a configuration using a remote source
|
1254 |
|
|
directory, it creates a tree for the binaries with the same structure
|
1255 |
|
|
(and using the same names) as the tree under the source directory. In
|
1256 |
|
|
the example, you'd find the Sun 4 library `libiberty.a' in the
|
1257 |
|
|
directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
|
1258 |
|
|
|
1259 |
|
|
One popular reason to build several GDB configurations in separate
|
1260 |
|
|
directories is to configure GDB for cross-compiling (where GDB runs on
|
1261 |
|
|
one machine--the "host"--while debugging programs that run on another
|
1262 |
|
|
machine--the "target"). You specify a cross-debugging target by giving
|
1263 |
|
|
the `--target=TARGET' option to `configure'.
|
1264 |
|
|
|
1265 |
|
|
When you run `make' to build a program or library, you must run it
|
1266 |
|
|
in a configured directory--whatever directory you were in when you
|
1267 |
|
|
called `configure' (or one of its subdirectories).
|
1268 |
|
|
|
1269 |
|
|
The `Makefile' that `configure' generates in each source directory
|
1270 |
|
|
also runs recursively. If you type `make' in a source directory such
|
1271 |
|
|
as `gdb-5.0' (or in a separate configured directory configured with
|
1272 |
|
|
`--srcdir=DIRNAME/gdb-5.0'), you will build all the required libraries,
|
1273 |
|
|
and then build GDB.
|
1274 |
|
|
|
1275 |
|
|
When you have multiple hosts or targets configured in separate
|
1276 |
|
|
directories, you can run `make' on them in parallel (for example, if
|
1277 |
|
|
they are NFS-mounted on each of the hosts); they will not interfere
|
1278 |
|
|
with each other.
|
1279 |
|
|
|
1280 |
|
|
|
1281 |
|
|
File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDB
|
1282 |
|
|
|
1283 |
|
|
Specifying names for hosts and targets
|
1284 |
|
|
======================================
|
1285 |
|
|
|
1286 |
|
|
The specifications used for hosts and targets in the `configure'
|
1287 |
|
|
script are based on a three-part naming scheme, but some short
|
1288 |
|
|
predefined aliases are also supported. The full naming scheme encodes
|
1289 |
|
|
three pieces of information in the following pattern:
|
1290 |
|
|
|
1291 |
|
|
ARCHITECTURE-VENDOR-OS
|
1292 |
|
|
|
1293 |
|
|
For example, you can use the alias `sun4' as a HOST argument, or as
|
1294 |
|
|
the value for TARGET in a `--target=TARGET' option. The equivalent
|
1295 |
|
|
full name is `sparc-sun-sunos4'.
|
1296 |
|
|
|
1297 |
|
|
The `configure' script accompanying GDB does not provide any query
|
1298 |
|
|
facility to list all supported host and target names or aliases.
|
1299 |
|
|
`configure' calls the Bourne shell script `config.sub' to map
|
1300 |
|
|
abbreviations to full names; you can read the script, if you wish, or
|
1301 |
|
|
you can use it to test your guesses on abbreviations--for example:
|
1302 |
|
|
|
1303 |
|
|
% sh config.sub i386-linux
|
1304 |
|
|
i386-pc-linux-gnu
|
1305 |
|
|
% sh config.sub alpha-linux
|
1306 |
|
|
alpha-unknown-linux-gnu
|
1307 |
|
|
% sh config.sub hp9k700
|
1308 |
|
|
hppa1.1-hp-hpux
|
1309 |
|
|
% sh config.sub sun4
|
1310 |
|
|
sparc-sun-sunos4.1.1
|
1311 |
|
|
% sh config.sub sun3
|
1312 |
|
|
m68k-sun-sunos4.1.1
|
1313 |
|
|
% sh config.sub i986v
|
1314 |
|
|
Invalid configuration `i986v': machine `i986v' not recognized
|
1315 |
|
|
|
1316 |
|
|
`config.sub' is also distributed in the GDB source directory
|
1317 |
|
|
(`gdb-5.0', for version 5.0).
|
1318 |
|
|
|
1319 |
|
|
|
1320 |
|
|
File: gdb.info, Node: Configure Options, Prev: Config Names, Up: Installing GDB
|
1321 |
|
|
|
1322 |
|
|
`configure' options
|
1323 |
|
|
===================
|
1324 |
|
|
|
1325 |
|
|
Here is a summary of the `configure' options and arguments that are
|
1326 |
|
|
most often useful for building GDB. `configure' also has several other
|
1327 |
|
|
options not listed here. *note (configure.info)What Configure Does::,
|
1328 |
|
|
for a full explanation of `configure'.
|
1329 |
|
|
|
1330 |
|
|
configure [--help]
|
1331 |
|
|
[--prefix=DIR]
|
1332 |
|
|
[--exec-prefix=DIR]
|
1333 |
|
|
[--srcdir=DIRNAME]
|
1334 |
|
|
[--norecursion] [--rm]
|
1335 |
|
|
[--target=TARGET]
|
1336 |
|
|
HOST
|
1337 |
|
|
|
1338 |
|
|
You may introduce options with a single `-' rather than `--' if you
|
1339 |
|
|
prefer; but you may abbreviate option names if you use `--'.
|
1340 |
|
|
|
1341 |
|
|
`--help'
|
1342 |
|
|
Display a quick summary of how to invoke `configure'.
|
1343 |
|
|
|
1344 |
|
|
`--prefix=DIR'
|
1345 |
|
|
Configure the source to install programs and files under directory
|
1346 |
|
|
`DIR'.
|
1347 |
|
|
|
1348 |
|
|
`--exec-prefix=DIR'
|
1349 |
|
|
Configure the source to install programs under directory `DIR'.
|
1350 |
|
|
|
1351 |
|
|
`--srcdir=DIRNAME'
|
1352 |
|
|
*Warning: using this option requires GNU `make', or another `make'
|
1353 |
|
|
that implements the `VPATH' feature.*
|
1354 |
|
|
Use this option to make configurations in directories separate
|
1355 |
|
|
from the GDB source directories. Among other things, you can use
|
1356 |
|
|
this to build (or maintain) several configurations simultaneously,
|
1357 |
|
|
in separate directories. `configure' writes configuration
|
1358 |
|
|
specific files in the current directory, but arranges for them to
|
1359 |
|
|
use the source in the directory DIRNAME. `configure' creates
|
1360 |
|
|
directories under the working directory in parallel to the source
|
1361 |
|
|
directories below DIRNAME.
|
1362 |
|
|
|
1363 |
|
|
`--norecursion'
|
1364 |
|
|
Configure only the directory level where `configure' is executed;
|
1365 |
|
|
do not propagate configuration to subdirectories.
|
1366 |
|
|
|
1367 |
|
|
`--target=TARGET'
|
1368 |
|
|
Configure GDB for cross-debugging programs running on the specified
|
1369 |
|
|
TARGET. Without this option, GDB is configured to debug programs
|
1370 |
|
|
that run on the same machine (HOST) as GDB itself.
|
1371 |
|
|
|
1372 |
|
|
There is no convenient way to generate a list of all available
|
1373 |
|
|
targets.
|
1374 |
|
|
|
1375 |
|
|
`HOST ...'
|
1376 |
|
|
Configure GDB to run on the specified HOST.
|
1377 |
|
|
|
1378 |
|
|
There is no convenient way to generate a list of all available
|
1379 |
|
|
hosts.
|
1380 |
|
|
|
1381 |
|
|
There are many other options available as well, but they are
|
1382 |
|
|
generally needed for special purposes only.
|
1383 |
|
|
|