<?Pub CX solbook(?><chapter id="interaction-3"><?Pub Tag atict:info tracking="off" ref="4"?><?Pub Tag
atict:user user="ae149097" fullname="Alta Elstad"?><title>Using MDB Commands
Interactively</title><highlights><para>This chapter describes the MDB interactive command line editing and
history functions, the output pager, and debugger signal handling.</para>
</highlights><sect1 id="interaction-4"><title>Command Reentry</title><para><indexterm><primary>command reentry</primary></indexterm>The text of
the last <literal>HISTSIZE</literal> (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.</para>
</sect1><sect1 id="interaction-5"><title>Inline Editing</title><para><indexterm><primary>inline editing</primary></indexterm><indexterm><primary>editing commands</primary></indexterm>If standard input is a terminal
device, MDB provides some simple emacs-style facilities for editing the command
line. The <literal>search</literal>, <literal>previous</literal>, and <literal>next</literal> 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 (<literal>^</literal>)
 followed by a character shown in uppercase. The notation for escape sequences
is M- followed by a character. For example, M-f (pronounced <emphasis>meta-
eff</emphasis>) is entered by pressing the <keycap>ESC</keycap> keyboard
key followed by the <keycap>f</keycap> key, or by pressing the <keycap>Meta</keycap> key
followed by the <keycap>f</keycap> key on keyboards that support a <keycap>Meta</keycap> key.
A command line is committed and executed using <symbol>RETURN</symbol> or <symbol>NEWLINE</symbol>. The edit commands are:</para><variablelist><varlistentry><term>^F</term><listitem><para>Move cursor forward (right) one character.</para>
</listitem>
</varlistentry><varlistentry><term>M-f</term><listitem><para>Move cursor forward one word.</para>
</listitem>
</varlistentry><varlistentry><term>^B</term><listitem><para>Move cursor backward (left) one character.</para>
</listitem>
</varlistentry><varlistentry><term>M-b</term><listitem><para>Move cursor backward one word.</para>
</listitem>
</varlistentry><varlistentry><term>^A</term><listitem><para>Move cursor to start of line.</para>
</listitem>
</varlistentry><varlistentry><term>^E</term><listitem><para>Move cursor to end of line.</para>
</listitem>
</varlistentry><varlistentry><term>^D</term><listitem><para>Delete current character, if the current line is  not empty.
If the current line is empty, ^D denotes EOF and the debugger will exit.</para>
</listitem>
</varlistentry><varlistentry><term>M-^H</term><listitem><para>(Meta-backspace) Delete previous word.</para>
</listitem>
</varlistentry><varlistentry><term>^K</term><listitem><para>Delete from the cursor to the end of the line.</para>
</listitem>
</varlistentry><varlistentry><term>^L</term><listitem><para>Reprint the current line.</para>
</listitem>
</varlistentry><varlistentry><term>^T</term><listitem><para>Transpose the current character with the next character.</para>
</listitem>
</varlistentry><varlistentry><term>^N</term><listitem><para>Fetch the next command from the history. Each time  ^N is
entered, the next command forward  in time is retrieved.</para>
</listitem>
</varlistentry><varlistentry><term>^P</term><listitem><para>Fetch the previous command from the history. Each time ^P
is entered, the next command backward in time is retrieved.</para>
</listitem>
</varlistentry><varlistentry><term>^R[<replaceable>string</replaceable>]</term><listitem><para>Search backward in the history for a previous command line
containing <replaceable>string</replaceable>. The string should be terminated
by a <symbol>RETURN</symbol> or <symbol>NEWLINE</symbol>. If <replaceable>string</replaceable> is
 omitted, the previous history element containing the most recent string is
retrieved.</para>
</listitem>
</varlistentry>
</variablelist><para>The editing mode also interprets the following user-defined sequences
as editing commands. User-defined sequences can be read or modified using
the <olink targetdoc="refman1" targetptr="stty-1" remap="external"><citerefentry><refentrytitle>stty</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> command.</para><variablelist><varlistentry><term>erase</term><listitem><para>User-defined erase character  (usually ^H or ^?). Delete previous
character.</para>
</listitem>
</varlistentry><varlistentry><term>intr</term><listitem><para>User-defined interrupt character (usually  ^C).  Abort the
current command and print a new prompt.</para>
</listitem>
</varlistentry><varlistentry><term>kill</term><listitem><para>User-defined kill character (usually  ^U).  Kill  the entire
current command line.</para>
</listitem>
</varlistentry><varlistentry><term>quit</term><listitem><para>User-defined quit character (usually  ^\).  Quit the debugger.</para>
</listitem>
</varlistentry><varlistentry><term>suspend</term><listitem><para>User-defined suspend character (usually  ^Z).  Suspend the
debugger.</para>
</listitem>
</varlistentry><varlistentry><term>werase</term><listitem><para>User-defined word erase character (usually ^W). Erase the
preceding word.</para>
</listitem>
</varlistentry>
</variablelist><para><indexterm><primary>arrow keys</primary></indexterm>On keyboards that
support an extended keypad with arrow keys, <literal>mdb</literal> interprets
these keystrokes as editing commands:</para><variablelist><varlistentry><term>Up arrow</term><listitem><para>Fetch the previous command from the history  (same  as ^P)</para>
</listitem>
</varlistentry><varlistentry><term>Down arrow</term><listitem><para>Fetch the next command from the history (same as ^N)</para>
</listitem>
</varlistentry><varlistentry><term>Left arrow</term><listitem><para>Move cursor backward one character (same as ^B)</para>
</listitem>
</varlistentry><varlistentry><term>Right arrow</term><listitem><para>Move cursor forward one character (same as ^F)</para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="interaction-6"><title>Keyboard Shortcuts</title><indexterm><primary>keyboard shortcuts</primary>
</indexterm><indexterm><primary><command>step over</command> command</primary>
</indexterm><indexterm><primary><command>step</command> command</primary>
</indexterm><para>MDB 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:</para><variablelist><varlistentry><term><literal>[</literal></term><listitem><para>Execute the command <command>::step over</command></para>
</listitem>
</varlistentry><varlistentry><term><literal>]</literal></term><listitem><para>Execute the command <command>::step</command></para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="interaction-1"><title>Output Pager</title><para><indexterm><primary>output pager</primary></indexterm>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, <literal>mdb</literal> pauses
after each screenful of output is written and displays a pager prompt:</para><screen>&gt;&gt; More [&lt;space&gt;, &lt;cr&gt;, q, n, c, a] ?</screen><para>The following key sequences are recognized by the pager:</para><variablelist><varlistentry><term><symbol>SPACE</symbol></term><listitem><para>Display the next screenful of output</para>
</listitem>
</varlistentry><varlistentry><term>a, A</term><listitem><para>Abort the current top-level command and return to  the prompt</para>
</listitem>
</varlistentry><varlistentry><term>c, C</term><listitem><para>Continue displaying output without pausing at each screenful,
until the current top-level command is complete</para>
</listitem>
</varlistentry><varlistentry><term>n, N, <symbol>NEWLINE</symbol>, <symbol>RETURN</symbol></term><listitem><para>Display the next line of output</para>
</listitem>
</varlistentry><varlistentry><term>q, Q, ^C, ^\</term><listitem><para>Quit (abort) the current dcmd only</para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="interaction-2"><title>Signal Handling</title><para><indexterm><primary>signal handling</primary></indexterm>MDB 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 <olink targetdoc="refman2" targetptr="kill-2" remap="external"><citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry></olink> 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 <literal>dmod</literal> is currently executing,
and standard input is a terminal, <literal>mdb</literal> 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 <literal>dmod</literal> 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 <olink targetptr="notes-2" remap="internal">Warnings</olink>, Use of
the Error Recovery Mechanism, for information about the risks associated with
the resume option.</para>
</sect1>
</chapter><?Pub *0000010101 0?>