Debugging a Program With dbx
|
![Table Of Contents Table Of Contents](shared/toc01.gif) ![Previous Chapter Previous Chapter](shared/prev01.gif) ![Next Chapter Next Chapter](shared/next01.gif)
|
Using dbx With the Korn Shell
|
The dbx command language is based on the syntax of the Korn Shell (ksh 88), including I/O redirection, loops, built-in arithmetic, history, and command-line editing. This chapter lists the differences between ksh-88 and dbx command language.
If no dbx initialization file is located on startup, dbx assumes ksh mode.
This chapter is organized into the following sections:
ksh-88 Features Not Implemented
The following features of ksh-88 are not implemented in dbx:
- set -A name for assigning values to array name
- set -o particular options: allexport bgnice gmacs markdirs noclobber nolog privileged protected viraw
- typeset -l -u -L -R -H attributes
- backquote (`...`) for command substitution (use $(...) instead)
- [ [ expression ] ] compound command for expression evaluation
- @(pattern[|pattern] ...) extended pattern matching
- co-processes (command or pipeline running in the background that communicates with your program)
Extensions to ksh-88
dbx adds the following features as extensions:
- $[ p -> flags ] language expression
- typeset -q enables special quoting for user-defined functions
- csh-like history and alias arguments
- set +o path disables path searching
- 0xabcd C syntax for octal and hexadecimal numbers
- bind to change Emacs-mode bindings
- set -o hashall
- set -o ignore suspend
- print -e and read -e (opposite of -r, raw)
- built-in dbx commands
Renamed Commands
Particular dbx commands have been renamed to avoid conflicts with ksh commands.
- The dbx print command retains the name print; the ksh print command has been renamed kprint.
- The ksh kill command has been merged with the dbx kill command.
- The alias command is the ksh alias, unless in dbx compatibility mode.
- address/format is now examine address/format.
- /pattern is now search pattern.
- ?pattern is now bsearch pattern.
Rebinding of Editing Functions
The bind command allows rebinding of editing functions. You can use the command to display or modify the key bindings for EMacs-style editors and vi-style editors. The syntax of the bind command is:
bind
|
Display the current editing key bindings
|
bind key=definition
|
Bind key to definition
|
bind key
|
Display the current definition for key
|
bind key=
|
Remove binding of key
|
bind -m key=definition
|
Define key to be a macro with definition
|
bind -m
|
Same as bind
|
where:
key is the name of a key.
definition is the definition of the macro to be bound to the key.
The following are some of the more important default key bindings for EMacs-style editors:
^A = beginning-of-line
|
^B = backward-char
|
^D = eot-or-delete
|
^E = end-of-line
|
^F = forward-char
|
^G = abort
|
^K = kill-to-eo
|
^L = redraw
|
^N = down-history
|
^P = up-history
|
^R = search-history
|
^^ = quote
|
^? = delete-char-backward
|
^H = delete-char-backward
|
^[b = backward-word
|
^[d = delete-word-forward
|
^[f = forward-word
|
^[^H = delete-word-backward
|
^[^[ = complete
|
^[? = list-command
|
The following are some of the more important default key bindings for vi-style editors:
a = append
|
A = append at EOL
|
c = change
|
d = delete
|
G = go to line
|
h = backward character
|
i = insert
|
I = insert at BOL
|
j = next line
|
k = previous line
|
l = forward line
|
n = next match
|
N = prev match
|
p = put after
|
P = put before
|
r = repeat
|
R = replace
|
s = substitute
|
u = undo
|
x = delete character
|
X = delete previous character
|
y = yank
|
~ = transpose case
|
_ = last argument
|
* = expand
|
= = list expansion
|
- = previous line
|
+ = next line
|
sp = forward char
|
# = comment out command
|
? = search history from beginning
|
|
/ = search history from current
|
|
In insert mode, the following keystrokes are special:
^? = delete character
|
^H = delete character
|
^U = kill line
|
^W = delete word
|
Debugging a Program With dbx
|
817-5063-10
|
![Table Of Contents Table Of Contents](shared/toc01.gif) ![Previous Chapter Previous Chapter](shared/prev01.gif) ![Next Chapter Next Chapter](shared/next01.gif)
|
Copyright © 2004, Sun Microsystems, Inc. All rights reserved.