Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 4

Interaction

This chapter describes the MDB interactive command-line editing and history functions, the output pager, and debugger signal handling.

Command Re-entry

The text of the last HISTSIZE (default 128) commands entered from a terminal device are saved in memory. The in-line editing facility, described next, provides key mappings for searching and fetching elements from the history list.

In-line Editing

If 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 caret (^) followed by a character shown in upper case. The notation for escape sequences is M- followed by a character. For example, M-f (pronounced meta- eff) is entered by depressing <ESC> followed by 'f', or by depressing Meta followed by 'f' on keyboards that support a Meta key. A command line is committed and executed using RETURN or NEWLINE. The edit commands are:

^F

Move cursor forward (right) one character.

M-f

Move cursor forward one word.

^B

Move cursor backward (left) one character.

M-b

Move cursor backward one word.

^A

Move cursor to start of line.

^E

Move cursor to end of line.

^D

Delete current character, if the current line is not empty. If the current line is empty, ^D denotes EOF and the debugger will exit.

M-^H

(Meta-backspace) Delete previous word.

^K

Delete from the cursor to the end of the line.

^L

Reprint the current line.

^T

Transpose current character with next character.

^N

Fetch the next command from the history. Each time ^N is entered, the next command forward in time is retrieved.

^P

Fetch the previous command from the history. Each time ^P is entered, the next command backward in time is retrieved.

^R[string]

Search backward in the history for a previous command line containing string. The string should be terminated by a RETURN or NEWLINE. If string is omitted, the previous history element containing the most recent string is retrieved.

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.

erase

User defined erase character (usually ^H or ^?). Delete previous character.

intr

User defined interrupt character (usually ^C). Abort the current command and print a new prompt.

kill

User defined kill character (usually ^U). Kill the entire current command line.

quit

User defined quit character (usually ^\). Quit the debugger.

suspend

User defined suspend character (usually ^Z). Suspend the debugger.

werase

User defined word erase character (usually ^W). Erase the preceding word.

On keyboards that support an extended keypad with arrow keys, mdb will interpret these keystrokes as editing commands:

up-arrow

Fetch the previous command from the history (same as ^P).

down-arrow

Fetch the next command from the history (same as ^N).

left-arrow

Move cursor backward one character (same as ^B).

right-arrow

Move cursor forward one character (same as ^F)

Output Pager

mdb 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 will pause after one screenful of output is produced and will display a pager prompt:

>> More [<space>, <cr>, q, n, c, a] ?

The following key sequences are recognized by the pager:

SPACE

Display the next screenful of output.

a, A

Abort the current top-level command and return to the prompt.

c, C

Continue displaying output without pausing at each screenful until the current top-level command is complete.

n, N, NEWLINE, RETURN

Display the next line of output.

q, Q, ^C, ^\

Quit (abort) the current dcmd only.

Signal Handling

The debugger 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 are generated asynchronously (that is, delivered from another process using kill(2)), mdb will restore the signal to its default disposition and dump core. However, if any of these signals are 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.

 
 
 
  Previous   Contents   Next