以 PDF 格式下載這本書 (1196 KB)
Chapter 4 Using MDB Commands InteractivelyThis chapter describes the MDB interactive command line editing and history functions, the output pager, and debugger signal handling. Command ReentryThe text of the last HISTSIZE (default 128) commands entered from a terminal device is saved in memory. The inline editing facility provides key mappings for searching and fetching elements from the history list. Inline EditingIf standard input is a terminal device, MDB provides some simple emacs-style facilities for editing the command line. The search, previous, and next commands in edit mode provide access to the history list. Only strings, not patterns, are matched when searching. In the list below, the notation for control characters is the caret character (^) followed by a character shown in uppercase. The notation for escape sequences is M- followed by a character. For example, M-f (pronounced meta- eff) is entered by pressing the ESC keyboard key followed by the f key, or by pressing the Meta key followed by the f key on keyboards that support a Meta key. A command line is committed and executed using RETURN or NEWLINE. The edit commands are:
The editing mode also interprets the following user-defined sequences as editing commands. User-defined sequences can be read or modified using the stty(1) command.
On keyboards that support an extended keypad with arrow keys, mdb interprets these keystrokes as editing commands:
Keyboard ShortcutsMDB provides a set of keyboard shortcuts that bind individual keystrokes to common MDB commands when the keystroke listed in the table below is typed as the first character following the MDB prompt. The keyboard shortcuts are:
Output PagerMDB provides a built-in output pager. The output pager is enabled if the debugger's standard output is a terminal device. Each time a command is executed, mdb pauses after each screenful of output is written and displays a pager prompt:
The following key sequences are recognized by the pager:
Signal HandlingMDB ignores the PIPE and QUIT signals. The INT signal aborts the command that is currently executing. The debugger intercepts and provides special handling for the ILL, TRAP, EMT, FPE, BUS, and SEGV signals. If any of these signals is generated asynchronously (delivered from another process using the kill(2) call), mdb restores the signal to its default disposition and dumps core. However, if any of these signals is generated synchronously by the debugger process itself and a dcmd from an externally loaded dmod is currently executing, and standard input is a terminal, mdb will provide a menu of choices allowing the user to force a core dump, quit without producing a core dump, stop for attach by a debugger, or attempt to resume. The resume option will abort all active commands and unload the dmod whose dcmd was active at the time the fault occurred. It can then be subsequently re-loaded by the user. The resume option provides limited protection against buggy dcmds. Refer to Warnings, Use of the Error Recovery Mechanism, for information about the risks associated with the resume option. |
||