URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
[/] [or1k_old/] [trunk/] [insight/] [gdb/] [doc/] [gdb.info-13] - Rev 1782
Compare with Previous | Blame | View Log
This is ./gdb.info, produced by makeinfo version 4.0 from gdb.texinfo.INFO-DIR-SECTION Programming & development tools.START-INFO-DIR-ENTRY* Gdb: (gdb). The GNU debugger.END-INFO-DIR-ENTRYThis file documents the GNU debugger GDB.This is the Ninth Edition, April 2001, of `Debugging with GDB: theGNU Source-Level Debugger' for GDB Version 20010707.Copyright (C)1988,1989,1990,1991,1992,1993,1994,1995,1996,1998,1999,2000,2001Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.1 orany later version published by the Free Software Foundation; with theInvariant Sections being "A Sample GDB Session" and "Free Software",with the Front-Cover texts being "A GNU Manual," and with theBack-Cover Texts as in (a) below.(a) The FSF's Back-Cover Text is: "You have freedom to copy andmodify this GNU Manual, like GNU software. Copies published by the FreeSoftware Foundation raise funds for GNU development."File: gdb.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init FileReadline Init File Syntax-------------------------There are only a few basic constructs allowed in the Readline initfile. Blank lines are ignored. Lines beginning with a `#' arecomments. Lines beginning with a `$' indicate conditional constructs(*note Conditional Init Constructs::). Other lines denote variablesettings and key bindings.Variable SettingsYou can modify the run-time behavior of Readline by altering thevalues of variables in Readline using the `set' command within theinit file. Here is how to change from the default Emacs-like keybinding to use `vi' line editing commands:set editing-mode viA great deal of run-time behavior is changeable with the followingvariables.`bell-style'Controls what happens when Readline wants to ring theterminal bell. If set to `none', Readline never rings thebell. If set to `visible', Readline uses a visible bell ifone is available. If set to `audible' (the default),Readline attempts to ring the terminal's bell.`comment-begin'The string to insert at the beginning of the line when the`insert-comment' command is executed. The default value is`"#"'.`completion-ignore-case'If set to `on', Readline performs filename matching andcompletion in a case-insensitive fashion. The default valueis `off'.`completion-query-items'The number of possible completions that determines when theuser is asked whether he wants to see the list ofpossibilities. If the number of possible completions isgreater than this value, Readline will ask the user whetheror not he wishes to view them; otherwise, they are simplylisted. The default limit is `100'.`convert-meta'If set to `on', Readline will convert characters with theeighth bit set to an ASCII key sequence by stripping theeighth bit and prefixing an <ESC> character, converting themto a meta-prefixed key sequence. The default value is `on'.`disable-completion'If set to `On', Readline will inhibit word completion.Completion characters will be inserted into the line as ifthey had been mapped to `self-insert'. The default is `off'.`editing-mode'The `editing-mode' variable controls which default set of keybindings is used. By default, Readline starts up in Emacsediting mode, where the keystrokes are most similar to Emacs.This variable can be set to either `emacs' or `vi'.`enable-keypad'When set to `on', Readline will try to enable the applicationkeypad when it is called. Some systems need this to enablethe arrow keys. The default is `off'.`expand-tilde'If set to `on', tilde expansion is performed when Readlineattempts word completion. The default is `off'.`horizontal-scroll-mode'This variable can be set to either `on' or `off'. Setting itto `on' means that the text of the lines being edited willscroll horizontally on a single screen line when they arelonger than the width of the screen, instead of wrapping ontoa new screen line. By default, this variable is set to `off'.`input-meta'If set to `on', Readline will enable eight-bit input (it willnot strip the eighth bit from the characters it reads),regardless of what the terminal claims it can support. Thedefault value is `off'. The name `meta-flag' is a synonymfor this variable.`isearch-terminators'The string of characters that should terminate an incrementalsearch without subsequently executing the character as acommand (*note Searching::). If this variable has not beengiven a value, the characters <ESC> and <C-J> will terminatean incremental search.`keymap'Sets Readline's idea of the current keymap for key bindingcommands. Acceptable `keymap' names are `emacs',`emacs-standard', `emacs-meta', `emacs-ctlx', `vi',`vi-command', and `vi-insert'. `vi' is equivalent to`vi-command'; `emacs' is equivalent to `emacs-standard'. Thedefault value is `emacs'. The value of the `editing-mode'variable also affects the default keymap.`mark-directories'If set to `on', completed directory names have a slashappended. The default is `on'.`mark-modified-lines'This variable, when set to `on', causes Readline to display anasterisk (`*') at the start of history lines which have beenmodified. This variable is `off' by default.`output-meta'If set to `on', Readline will display characters with theeighth bit set directly rather than as a meta-prefixed escapesequence. The default is `off'.`print-completions-horizontally'If set to `on', Readline will display completions with matchessorted horizontally in alphabetical order, rather than downthe screen. The default is `off'.`show-all-if-ambiguous'This alters the default behavior of the completion functions.If set to `on', words which have more than one possiblecompletion cause the matches to be listed immediately insteadof ringing the bell. The default value is `off'.`visible-stats'If set to `on', a character denoting a file's type isappended to the filename when listing possible completions.The default is `off'.Key BindingsThe syntax for controlling key bindings in the init file issimple. First you need to find the name of the command that youwant to change. The following sections contain tables of thecommand name, the default keybinding, if any, and a shortdescription of what the command does.Once you know the name of the command, simply place the name ofthe key you wish to bind the command to, a colon, and then thename of the command on a line in the init file. The name of thekey can be expressed in different ways, depending on which is mostcomfortable for you.KEYNAME: FUNCTION-NAME or MACROKEYNAME is the name of a key spelled out in English. Forexample:Control-u: universal-argumentMeta-Rubout: backward-kill-wordControl-o: "> output"In the above example, <C-u> is bound to the function`universal-argument', and <C-o> is bound to run the macroexpressed on the right hand side (that is, to insert the text`> output' into the line)."KEYSEQ": FUNCTION-NAME or MACROKEYSEQ differs from KEYNAME above in that strings denoting anentire key sequence can be specified, by placing the keysequence in double quotes. Some GNU Emacs style key escapescan be used, as in the following example, but the specialcharacter names are not recognized."\C-u": universal-argument"\C-x\C-r": re-read-init-file"\e[11~": "Function Key 1"In the above example, <C-u> is bound to the function`universal-argument' (just as it was in the first example),`<C-x> <C-r>' is bound to the function `re-read-init-file',and `<ESC> <[> <1> <1> <~>' is bound to insert the text`Function Key 1'.The following GNU Emacs style escape sequences are available whenspecifying key sequences:`\C-'control prefix`\M-'meta prefix`\e'an escape character`\\'backslash`\"'<">, a double quotation mark`\''<'>, a single quote or apostropheIn addition to the GNU Emacs style escape sequences, a second setof backslash escapes is available:`\a'alert (bell)`\b'backspace`\d'delete`\f'form feed`\n'newline`\r'carriage return`\t'horizontal tab`\v'vertical tab`\NNN'the character whose `ASCII' code is the octal value NNN (oneto three digits)`\xNNN'the character whose `ASCII' code is the hexadecimal value NNN(one to three digits)When entering the text of a macro, single or double quotes must beused to indicate a macro definition. Unquoted text is assumed tobe a function name. In the macro body, the backslash escapesdescribed above are expanded. Backslash will quote any othercharacter in the macro text, including `"' and `''. For example,the following binding will make `C-x \' insert a single `\' intothe line:"\C-x\\": "\\"File: gdb.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init FileConditional Init Constructs---------------------------Readline implements a facility similar in spirit to the conditionalcompilation features of the C preprocessor which allows key bindingsand variable settings to be performed as the result of tests. Thereare four parser directives used.`$if'The `$if' construct allows bindings to be made based on theediting mode, the terminal being used, or the application usingReadline. The text of the test extends to the end of the line; nocharacters are required to isolate it.`mode'The `mode=' form of the `$if' directive is used to testwhether Readline is in `emacs' or `vi' mode. This may beused in conjunction with the `set keymap' command, forinstance, to set bindings in the `emacs-standard' and`emacs-ctlx' keymaps only if Readline is starting out in`emacs' mode.`term'The `term=' form may be used to include terminal-specific keybindings, perhaps to bind the key sequences output by theterminal's function keys. The word on the right side of the`=' is tested against both the full name of the terminal andthe portion of the terminal name before the first `-'. Thisallows `sun' to match both `sun' and `sun-cmd', for instance.`application'The APPLICATION construct is used to includeapplication-specific settings. Each program using theReadline library sets the APPLICATION NAME, and you can testfor it. This could be used to bind key sequences tofunctions useful for a specific program. For instance, thefollowing command adds a key sequence that quotes the currentor previous word in Bash:$if Bash# Quote the current or previous word"\C-xq": "\eb\"\ef\""$endif`$endif'This command, as seen in the previous example, terminates an `$if'command.`$else'Commands in this branch of the `$if' directive are executed if thetest fails.`$include'This directive takes a single filename as an argument and readscommands and bindings from that file.$include /etc/inputrcFile: gdb.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init FileSample Init File----------------Here is an example of an inputrc file. This illustrates keybinding, variable assignment, and conditional syntax.# This file controls the behaviour of line input editing for# programs that use the Gnu Readline library. Existing programs# include FTP, Bash, and Gdb.## You can re-read the inputrc file with C-x C-r.# Lines beginning with '#' are comments.## First, include any systemwide bindings and variable assignments from# /etc/Inputrc$include /etc/Inputrc## Set various bindings for emacs mode.set editing-mode emacs$if mode=emacsMeta-Control-h: backward-kill-word Text after the function name is ignored## Arrow keys in keypad mode##"\M-OD": backward-char#"\M-OC": forward-char#"\M-OA": previous-history#"\M-OB": next-history## Arrow keys in ANSI mode#"\M-[D": backward-char"\M-[C": forward-char"\M-[A": previous-history"\M-[B": next-history## Arrow keys in 8 bit keypad mode##"\M-\C-OD": backward-char#"\M-\C-OC": forward-char#"\M-\C-OA": previous-history#"\M-\C-OB": next-history## Arrow keys in 8 bit ANSI mode##"\M-\C-[D": backward-char#"\M-\C-[C": forward-char#"\M-\C-[A": previous-history#"\M-\C-[B": next-historyC-q: quoted-insert$endif# An old-style binding. This happens to be the default.TAB: complete# Macros that are convenient for shell interaction$if Bash# edit the path"\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"# prepare to type a quoted word -- insert open and close double quotes# and move to just after the open quote"\C-x\"": "\"\"\C-b"# insert a backslash (testing backslash escapes in sequences and macros)"\C-x\\": "\\"# Quote the current or previous word"\C-xq": "\eb\"\ef\""# Add a binding to refresh the line, which is unbound"\C-xr": redraw-current-line# Edit variable on current line."\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="$endif# use a visible bell if one is availableset bell-style visible# don't strip characters to 7 bits when readingset input-meta on# allow iso-latin1 characters to be inserted rather than converted to# prefix-meta sequencesset convert-meta off# display characters with the eighth bit set directly rather than# as meta-prefixed charactersset output-meta on# if there are more than 150 possible completions for a word, ask the# user if he wants to see all of themset completion-query-items 150# For FTP$if Ftp"\C-xg": "get \M-?""\C-xt": "put \M-?""\M-.": yank-last-arg$endifFile: gdb.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line EditingBindable Readline Commands==========================* Menu:* Commands For Moving:: Moving about the line.* Commands For History:: Getting at previous lines.* Commands For Text:: Commands for changing text.* Commands For Killing:: Commands for killing and yanking.* Numeric Arguments:: Specifying numeric arguments, repeat counts.* Commands For Completion:: Getting Readline to do the typing for you.* Keyboard Macros:: Saving and re-executing typed characters* Miscellaneous Commands:: Other miscellaneous commands.This section describes Readline commands that may be bound to keysequences.Command names without an accompanying key sequence are unbound bydefault. In the following descriptions, POINT refers to the currentcursor position, and MARK refers to a cursor position saved by the`set-mark' command. The text between the point and mark is referred toas the REGION.File: gdb.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline CommandsCommands For Moving-------------------`beginning-of-line (C-a)'Move to the start of the current line.`end-of-line (C-e)'Move to the end of the line.`forward-char (C-f)'Move forward a character.`backward-char (C-b)'Move back a character.`forward-word (M-f)'Move forward to the end of the next word. Words are composed ofletters and digits.`backward-word (M-b)'Move back to the start of the current or previous word. Words arecomposed of letters and digits.`clear-screen (C-l)'Clear the screen and redraw the current line, leaving the currentline at the top of the screen.`redraw-current-line ()'Refresh the current line. By default, this is unbound.File: gdb.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline CommandsCommands For Manipulating The History-------------------------------------`accept-line (Newline, Return)'Accept the line regardless of where the cursor is. If this line isnon-empty, add it to the history list. If this line was a historyline, then restore the history line to its original state.`previous-history (C-p)'Move `up' through the history list.`next-history (C-n)'Move `down' through the history list.`beginning-of-history (M-<)'Move to the first line in the history.`end-of-history (M->)'Move to the end of the input history, i.e., the line currentlybeing entered.`reverse-search-history (C-r)'Search backward starting at the current line and moving `up'through the history as necessary. This is an incremental search.`forward-search-history (C-s)'Search forward starting at the current line and moving `down'through the the history as necessary. This is an incrementalsearch.`non-incremental-reverse-search-history (M-p)'Search backward starting at the current line and moving `up'through the history as necessary using a non-incremental searchfor a string supplied by the user.`non-incremental-forward-search-history (M-n)'Search forward starting at the current line and moving `down'through the the history as necessary using a non-incremental searchfor a string supplied by the user.`history-search-forward ()'Search forward through the history for the string of charactersbetween the start of the current line and the point. This is anon-incremental search. By default, this command is unbound.`history-search-backward ()'Search backward through the history for the string of charactersbetween the start of the current line and the point. This is anon-incremental search. By default, this command is unbound.`yank-nth-arg (M-C-y)'Insert the first argument to the previous command (usually thesecond word on the previous line). With an argument N, insert theNth word from the previous command (the words in the previouscommand begin with word 0). A negative argument inserts the Nthword from the end of the previous command.`yank-last-arg (M-., M-_)'Insert last argument to the previous command (the last word of theprevious history entry). With an argument, behave exactly like`yank-nth-arg'. Successive calls to `yank-last-arg' move backthrough the history list, inserting the last argument of each linein turn.File: gdb.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline CommandsCommands For Changing Text--------------------------`delete-char (C-d)'Delete the character under the cursor. If the cursor is at thebeginning of the line, there are no characters in the line, andthe last character typed was not bound to `delete-char', thenreturn `EOF'.`backward-delete-char (Rubout)'Delete the character behind the cursor. A numeric argument meansto kill the characters instead of deleting them.`forward-backward-delete-char ()'Delete the character under the cursor, unless the cursor is at theend of the line, in which case the character behind the cursor isdeleted. By default, this is not bound to a key.`quoted-insert (C-q, C-v)'Add the next character typed to the line verbatim. This is how toinsert key sequences like <C-q>, for example.`tab-insert (M-TAB)'Insert a tab character.`self-insert (a, b, A, 1, !, ...)'Insert yourself.`transpose-chars (C-t)'Drag the character before the cursor forward over the character atthe cursor, moving the cursor forward as well. If the insertionpoint is at the end of the line, then this transposes the last twocharacters of the line. Negative arguments have no effect.`transpose-words (M-t)'Drag the word before point past the word after point, moving pointpast that word as well.`upcase-word (M-u)'Uppercase the current (or following) word. With a negativeargument, uppercase the previous word, but do not move the cursor.`downcase-word (M-l)'Lowercase the current (or following) word. With a negativeargument, lowercase the previous word, but do not move the cursor.`capitalize-word (M-c)'Capitalize the current (or following) word. With a negativeargument, capitalize the previous word, but do not move the cursor.File: gdb.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline CommandsKilling And Yanking-------------------`kill-line (C-k)'Kill the text from point to the end of the line.`backward-kill-line (C-x Rubout)'Kill backward to the beginning of the line.`unix-line-discard (C-u)'Kill backward from the cursor to the beginning of the current line.`kill-whole-line ()'Kill all characters on the current line, no matter point is. Bydefault, this is unbound.`kill-word (M-d)'Kill from point to the end of the current word, or if betweenwords, to the end of the next word. Word boundaries are the sameas `forward-word'.`backward-kill-word (M-DEL)'Kill the word behind point. Word boundaries are the same as`backward-word'.`unix-word-rubout (C-w)'Kill the word behind point, using white space as a word boundary.The killed text is saved on the kill-ring.`delete-horizontal-space ()'Delete all spaces and tabs around point. By default, this isunbound.`kill-region ()'Kill the text in the current region. By default, this command isunbound.`copy-region-as-kill ()'Copy the text in the region to the kill buffer, so it can be yankedright away. By default, this command is unbound.`copy-backward-word ()'Copy the word before point to the kill buffer. The wordboundaries are the same as `backward-word'. By default, thiscommand is unbound.`copy-forward-word ()'Copy the word following point to the kill buffer. The wordboundaries are the same as `forward-word'. By default, thiscommand is unbound.`yank (C-y)'Yank the top of the kill ring into the buffer at the currentcursor position.`yank-pop (M-y)'Rotate the kill-ring, and yank the new top. You can only do thisif the prior command is yank or yank-pop.File: gdb.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline CommandsSpecifying Numeric Arguments----------------------------`digit-argument (M-0, M-1, ... M--)'Add this digit to the argument already accumulating, or start a newargument. <M-> starts a negative argument.`universal-argument ()'This is another way to specify an argument. If this command isfollowed by one or more digits, optionally with a leading minussign, those digits define the argument. If the command isfollowed by digits, executing `universal-argument' again ends thenumeric argument, but is otherwise ignored. As a special case, ifthis command is immediately followed by a character that isneither a digit or minus sign, the argument count for the nextcommand is multiplied by four. The argument count is initiallyone, so executing this function the first time makes the argumentcount four, a second time makes the argument count sixteen, and soon. By default, this is not bound to a key.File: gdb.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline CommandsLetting Readline Type For You-----------------------------`complete (TAB)'Attempt to do completion on the text before the cursor. This isapplication-specific. Generally, if you are typing a filenameargument, you can do filename completion; if you are typing acommand, you can do command completion; if you are typing in asymbol to GDB, you can do symbol name completion; if you aretyping in a variable to Bash, you can do variable name completion,and so on.`possible-completions (M-?)'List the possible completions of the text before the cursor.`insert-completions (M-*)'Insert all completions of the text before point that would havebeen generated by `possible-completions'.`menu-complete ()'Similar to `complete', but replaces the word to be completed witha single match from the list of possible completions. Repeatedexecution of `menu-complete' steps through the list of possiblecompletions, inserting each match in turn. At the end of the listof completions, the bell is rung and the original text is restored.An argument of N moves N positions forward in the list of matches;a negative argument may be used to move backward through the list.This command is intended to be bound to `TAB', but is unbound bydefault.`delete-char-or-list ()'Deletes the character under the cursor if not at the beginning orend of the line (like `delete-char'). If at the end of the line,behaves identically to `possible-completions'. This command isunbound by default.File: gdb.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline CommandsKeyboard Macros---------------`start-kbd-macro (C-x ()'Begin saving the characters typed into the current keyboard macro.`end-kbd-macro (C-x ))'Stop saving the characters typed into the current keyboard macroand save the definition.`call-last-kbd-macro (C-x e)'Re-execute the last keyboard macro defined, by making thecharacters in the macro appear as if typed at the keyboard.File: gdb.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline CommandsSome Miscellaneous Commands---------------------------`re-read-init-file (C-x C-r)'Read in the contents of the INPUTRC file, and incorporate anybindings or variable assignments found there.`abort (C-g)'Abort the current editing command and ring the terminal's bell(subject to the setting of `bell-style').`do-uppercase-version (M-a, M-b, M-X, ...)'If the metafied character X is lowercase, run the command that isbound to the corresponding uppercase character.`prefix-meta (ESC)'Make the next character typed be metafied. This is for keyboardswithout a meta key. Typing `ESC f' is equivalent to typing `M-f'.`undo (C-_, C-x C-u)'Incremental undo, separately remembered for each line.`revert-line (M-r)'Undo all changes made to this line. This is like executing the`undo' command enough times to get back to the beginning.`tilde-expand (M-~)'Perform tilde expansion on the current word.`set-mark (C-@)'Set the mark to the current point. If a numeric argument issupplied, the mark is set to that position.`exchange-point-and-mark (C-x C-x)'Swap the point with the mark. The current cursor position is setto the saved position, and the old cursor position is saved as themark.`character-search (C-])'A character is read and point is moved to the next occurrence ofthat character. A negative count searches for previousoccurrences.`character-search-backward (M-C-])'A character is read and point is moved to the previous occurrenceof that character. A negative count searches for subsequentoccurrences.`insert-comment (M-#)'The value of the `comment-begin' variable is inserted at thebeginning of the current line, and the line is accepted as if anewline had been typed.`dump-functions ()'Print all of the functions and their key bindings to the Readlineoutput stream. If a numeric argument is supplied, the output isformatted in such a way that it can be made part of an INPUTRCfile. This command is unbound by default.`dump-variables ()'Print all of the settable variables and their values to theReadline output stream. If a numeric argument is supplied, theoutput is formatted in such a way that it can be made part of anINPUTRC file. This command is unbound by default.`dump-macros ()'Print all of the Readline key sequences bound to macros and thestrings they ouput. If a numeric argument is supplied, the outputis formatted in such a way that it can be made part of an INPUTRCfile. This command is unbound by default.File: gdb.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line EditingReadline vi Mode================While the Readline library does not have a full set of `vi' editingfunctions, it does contain enough to allow simple editing of the line.The Readline `vi' mode behaves as specified in the POSIX 1003.2standard.In order to switch interactively between `emacs' and `vi' editingmodes, use the command M-C-j (toggle-editing-mode). The Readlinedefault is `emacs' mode.When you enter a line in `vi' mode, you are already placed in`insertion' mode, as if you had typed an `i'. Pressing <ESC> switchesyou into `command' mode, where you can edit the text of the line withthe standard `vi' movement keys, move to previous history lines with`k' and subsequent lines with `j', and so forth.File: gdb.info, Node: Using History Interactively, Next: Installing GDB, Prev: Command Line Editing, Up: TopUsing History Interactively***************************This chapter describes how to use the GNU History Libraryinteractively, from a user's standpoint. It should be considered auser's guide.* Menu:* History Interaction:: What it feels like using History as a user.File: gdb.info, Node: History Interaction, Up: Using History InteractivelyHistory Expansion=================The History library provides a history expansion feature that issimilar to the history expansion provided by `csh'. This sectiondescribes the syntax used to manipulate the history information.History expansions introduce words from the history list into theinput stream, making it easy to repeat commands, insert the argumentsto a previous command into the current input line, or fix errors inprevious commands quickly.History expansion takes place in two parts. The first is todetermine which line from the history list should be used duringsubstitution. The second is to select portions of that line forinclusion into the current one. The line selected from the history iscalled the "event", and the portions of that line that are acted uponare called "words". Various "modifiers" are available to manipulatethe selected words. The line is broken into words in the same fashionthat Bash does, so that several words surrounded by quotes areconsidered one word. History expansions are introduced by theappearance of the history expansion character, which is `!' by default.* Menu:* Event Designators:: How to specify which history line to use.* Word Designators:: Specifying which words are of interest.* Modifiers:: Modifying the results of substitution.File: gdb.info, Node: Event Designators, Next: Word Designators, Up: History InteractionEvent Designators-----------------An event designator is a reference to a command line entry in thehistory list.`!'Start a history substitution, except when followed by a space, tab,the end of the line, `=' or `('.`!N'Refer to command line N.`!-N'Refer to the command N lines back.`!!'Refer to the previous command. This is a synonym for `!-1'.`!STRING'Refer to the most recent command starting with STRING.`!?STRING[?]'Refer to the most recent command containing STRING. The trailing`?' may be omitted if the STRING is followed immediately by anewline.`^STRING1^STRING2^'Quick Substitution. Repeat the last command, replacing STRING1with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.`!#'The entire command line typed so far.File: gdb.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History InteractionWord Designators----------------Word designators are used to select desired words from the event. A`:' separates the event specification from the word designator. It maybe omitted if the word designator begins with a `^', `$', `*', `-', or`%'. Words are numbered from the beginning of the line, with the firstword being denoted by 0 (zero). Words are inserted into the currentline separated by single spaces.For example,`!!'designates the preceding command. When you type this, thepreceding command is repeated in toto.`!!:$'designates the last argument of the preceding command. This may beshortened to `!$'.`!fi:2'designates the second argument of the most recent command startingwith the letters `fi'.Here are the word designators:`0 (zero)'The `0'th word. For many applications, this is the command word.`N'The Nth word.`^'The first argument; that is, word 1.`$'The last argument.`%'The word matched by the most recent `?STRING?' search.`X-Y'A range of words; `-Y' abbreviates `0-Y'.`*'All of the words, except the `0'th. This is a synonym for `1-$'.It is not an error to use `*' if there is just one word in theevent; the empty string is returned in that case.`X*'Abbreviates `X-$'`X-'Abbreviates `X-$' like `X*', but omits the last word.If a word designator is supplied without an event specification, theprevious command is used as the event.File: gdb.info, Node: Modifiers, Prev: Word Designators, Up: History InteractionModifiers---------After the optional word designator, you can add a sequence of one ormore of the following modifiers, each preceded by a `:'.`h'Remove a trailing pathname component, leaving only the head.`t'Remove all leading pathname components, leaving the tail.`r'Remove a trailing suffix of the form `.SUFFIX', leaving thebasename.`e'Remove all but the trailing suffix.`p'Print the new command but do not execute it.`s/OLD/NEW/'Substitute NEW for the first occurrence of OLD in the event line.Any delimiter may be used in place of `/'. The delimiter may bequoted in OLD and NEW with a single backslash. If `&' appears inNEW, it is replaced by OLD. A single backslash will quote the`&'. The final delimiter is optional if it is the last characteron the input line.`&'Repeat the previous substitution.`g'Cause changes to be applied over the entire event line. Used inconjunction with `s', as in `gs/OLD/NEW/', or with `&'.File: gdb.info, Node: Formatting Documentation, Next: Command Line Editing, Prev: GDB Bugs, Up: TopFormatting Documentation************************The GDB 4 release includes an already-formatted reference card, readyfor printing with PostScript or Ghostscript, in the `gdb' subdirectoryof the main source directory(1). If you can use PostScript orGhostscript with your printer, you can print the reference cardimmediately with `refcard.ps'.The release also includes the source for the reference card. Youcan format it, using TeX, by typing:make refcard.dviThe GDB reference card is designed to print in "landscape" mode onUS "letter" size paper; that is, on a sheet 11 inches wide by 8.5 incheshigh. You will need to specify this form of printing as an option toyour DVI output program.All the documentation for GDB comes as part of the machine-readabledistribution. The documentation is written in Texinfo format, which isa documentation system that uses a single source file to produce bothon-line information and a printed manual. You can use one of the Infoformatting commands to create the on-line version of the documentationand TeX (or `texi2roff') to typeset the printed version.GDB includes an already formatted copy of the on-line Info versionof this manual in the `gdb' subdirectory. The main Info file is`gdb-20010707/gdb/gdb.info', and it refers to subordinate filesmatching `gdb.info*' in the same directory. If necessary, you canprint out these files, or read them with any editor; but they areeasier to read using the `info' subsystem in GNU Emacs or thestandalone `info' program, available as part of the GNU Texinfodistribution.If you want to format these Info files yourself, you need one of theInfo formatting programs, such as `texinfo-format-buffer' or `makeinfo'.If you have `makeinfo' installed, and are in the top level GDBsource directory (`gdb-20010707', in the case of version 20010707), youcan make the Info file by typing:cd gdbmake gdb.infoIf you want to typeset and print copies of this manual, you need TeX,a program to print its DVI output files, and `texinfo.tex', the Texinfodefinitions file.TeX is a typesetting program; it does not print files directly, butproduces output files called DVI files. To print a typeset document,you need a program to print DVI files. If your system has TeXinstalled, chances are it has such a program. The precise command touse depends on your system; `lpr -d' is common; another (for PostScriptdevices) is `dvips'. The DVI print command may require a file namewithout any extension or a `.dvi' extension.TeX also requires a macro definitions file called `texinfo.tex'.This file tells TeX how to typeset a document written in Texinfoformat. On its own, TeX cannot either read or typeset a Texinfo file.`texinfo.tex' is distributed with GDB and is located in the`gdb-VERSION-NUMBER/texinfo' directory.If you have TeX and a DVI printer program installed, you can typesetand print this manual. First switch to the the `gdb' subdirectory ofthe main source directory (for example, to `gdb-20010707/gdb') and type:make gdb.dviThen give `gdb.dvi' to your DVI printing program.---------- Footnotes ----------(1) In `gdb-20010707/gdb/refcard.ps' of the version 20010707 release.File: gdb.info, Node: Installing GDB, Next: Index, Prev: Using History Interactively, Up: TopInstalling GDB**************GDB comes with a `configure' script that automates the process ofpreparing GDB for installation; you can then use `make' to build the`gdb' program.The GDB distribution includes all the source code you need for GDBin a single directory, whose name is usually composed by appending theversion number to `gdb'.For example, the GDB version 20010707 distribution is in the`gdb-20010707' directory. That directory contains:`gdb-20010707/configure (and supporting files)'script for configuring GDB and all its supporting libraries`gdb-20010707/gdb'the source specific to GDB itself`gdb-20010707/bfd'source for the Binary File Descriptor library`gdb-20010707/include'GNU include files`gdb-20010707/libiberty'source for the `-liberty' free software library`gdb-20010707/opcodes'source for the library of opcode tables and disassemblers`gdb-20010707/readline'source for the GNU command-line interface`gdb-20010707/glob'source for the GNU filename pattern-matching subroutine`gdb-20010707/mmalloc'source for the GNU memory-mapped malloc packageThe simplest way to configure and build GDB is to run `configure'from the `gdb-VERSION-NUMBER' source directory, which in this exampleis the `gdb-20010707' directory.First switch to the `gdb-VERSION-NUMBER' source directory if you arenot already in it; then run `configure'. Pass the identifier for theplatform on which GDB will run as an argument.For example:cd gdb-20010707./configure HOSTmakewhere HOST is an identifier such as `sun4' or `decstation', thatidentifies the platform where GDB will run. (You can often leave offHOST; `configure' tries to guess the correct value by examining yoursystem.)Running `configure HOST' and then running `make' builds the `bfd',`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.The configured source files, and the binaries, are left in thecorresponding source directories.`configure' is a Bourne-shell (`/bin/sh') script; if your systemdoes not recognize this automatically when you run a different shell,you may need to run `sh' on it explicitly:sh configure HOSTIf you run `configure' from a directory that contains sourcedirectories for multiple libraries or programs, such as the`gdb-20010707' source directory for version 20010707, `configure'creates configuration files for every directory level underneath (unlessyou tell it not to, with the `--norecursion' option).You can run the `configure' script from any of the subordinatedirectories in the GDB distribution if you only want to configure thatsubdirectory, but be sure to specify a path to it.For example, with version 20010707, type the following to configureonly the `bfd' subdirectory:cd gdb-20010707/bfd../configure HOSTYou can install `gdb' anywhere; it has no hardwired paths. However,you should make sure that the shell on your path (named by the `SHELL'environment variable) is publicly readable. Remember that GDB uses theshell to start your program--some systems refuse to let GDB debug childprocesses whose programs are not readable.* Menu:* Separate Objdir:: Compiling GDB in another directory* Config Names:: Specifying names for hosts and targets* Configure Options:: Summary of options for configureFile: gdb.info, Node: Separate Objdir, Next: Config Names, Up: Installing GDBCompiling GDB in another directory==================================If you want to run GDB versions for several host or target machines,you need a different `gdb' compiled for each combination of host andtarget. `configure' is designed to make this easy by allowing you togenerate each configuration in a separate subdirectory, rather than inthe source directory. If your `make' program handles the `VPATH'feature (GNU `make' does), running `make' in each of these directoriesbuilds the `gdb' program specified there.To build `gdb' in a separate directory, run `configure' with the`--srcdir' option to specify where to find the source. (You also needto specify a path to find `configure' itself from your workingdirectory. If the path to `configure' would be the same as theargument to `--srcdir', you can leave out the `--srcdir' option; it isassumed.)For example, with version 20010707, you can build GDB in a separatedirectory for a Sun 4 like this:cd gdb-20010707mkdir ../gdb-sun4cd ../gdb-sun4../gdb-20010707/configure sun4makeWhen `configure' builds a configuration using a remote sourcedirectory, it creates a tree for the binaries with the same structure(and using the same names) as the tree under the source directory. Inthe example, you'd find the Sun 4 library `libiberty.a' in thedirectory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.One popular reason to build several GDB configurations in separatedirectories is to configure GDB for cross-compiling (where GDB runs onone machine--the "host"--while debugging programs that run on anothermachine--the "target"). You specify a cross-debugging target by givingthe `--target=TARGET' option to `configure'.When you run `make' to build a program or library, you must run itin a configured directory--whatever directory you were in when youcalled `configure' (or one of its subdirectories).The `Makefile' that `configure' generates in each source directoryalso runs recursively. If you type `make' in a source directory suchas `gdb-20010707' (or in a separate configured directory configuredwith `--srcdir=DIRNAME/gdb-20010707'), you will build all the requiredlibraries, and then build GDB.When you have multiple hosts or targets configured in separatedirectories, you can run `make' on them in parallel (for example, ifthey are NFS-mounted on each of the hosts); they will not interferewith each other.File: gdb.info, Node: Config Names, Next: Configure Options, Prev: Separate Objdir, Up: Installing GDBSpecifying names for hosts and targets======================================The specifications used for hosts and targets in the `configure'script are based on a three-part naming scheme, but some shortpredefined aliases are also supported. The full naming scheme encodesthree pieces of information in the following pattern:ARCHITECTURE-VENDOR-OSFor example, you can use the alias `sun4' as a HOST argument, or asthe value for TARGET in a `--target=TARGET' option. The equivalentfull name is `sparc-sun-sunos4'.The `configure' script accompanying GDB does not provide any queryfacility to list all supported host and target names or aliases.`configure' calls the Bourne shell script `config.sub' to mapabbreviations to full names; you can read the script, if you wish, oryou can use it to test your guesses on abbreviations--for example:% sh config.sub i386-linuxi386-pc-linux-gnu% sh config.sub alpha-linuxalpha-unknown-linux-gnu% sh config.sub hp9k700hppa1.1-hp-hpux% sh config.sub sun4sparc-sun-sunos4.1.1% sh config.sub sun3m68k-sun-sunos4.1.1% sh config.sub i986vInvalid configuration `i986v': machine `i986v' not recognized`config.sub' is also distributed in the GDB source directory(`gdb-20010707', for version 20010707).File: gdb.info, Node: Configure Options, Prev: Config Names, Up: Installing GDB`configure' options===================Here is a summary of the `configure' options and arguments that aremost often useful for building GDB. `configure' also has several otheroptions not listed here. *note (configure.info)What Configure Does::,for a full explanation of `configure'.configure [--help][--prefix=DIR][--exec-prefix=DIR][--srcdir=DIRNAME][--norecursion] [--rm][--target=TARGET]HOSTYou may introduce options with a single `-' rather than `--' if youprefer; but you may abbreviate option names if you use `--'.`--help'Display a quick summary of how to invoke `configure'.`--prefix=DIR'Configure the source to install programs and files under directory`DIR'.`--exec-prefix=DIR'Configure the source to install programs under directory `DIR'.`--srcdir=DIRNAME'*Warning: using this option requires GNU `make', or another `make'that implements the `VPATH' feature.*Use this option to make configurations in directories separatefrom the GDB source directories. Among other things, you can usethis to build (or maintain) several configurations simultaneously,in separate directories. `configure' writes configurationspecific files in the current directory, but arranges for them touse the source in the directory DIRNAME. `configure' createsdirectories under the working directory in parallel to the sourcedirectories below DIRNAME.`--norecursion'Configure only the directory level where `configure' is executed;do not propagate configuration to subdirectories.`--target=TARGET'Configure GDB for cross-debugging programs running on the specifiedTARGET. Without this option, GDB is configured to debug programsthat run on the same machine (HOST) as GDB itself.There is no convenient way to generate a list of all availabletargets.`HOST ...'Configure GDB to run on the specified HOST.There is no convenient way to generate a list of all availablehosts.There are many other options available as well, but they aregenerally needed for special purposes only.
