(require (quote shell))

(defvar dbx-trace-flag nil "\
Dbx trace switch.")

(defvar dbx-process nil "\
The process in which dbx is running.")

(defvar dbx-break-point "stopped in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" "\
Regexp of pattern that dbx writes at break point.")

(defvar inferior-dbx-mode-map nil)

(if inferior-dbx-mode-map nil (setq inferior-dbx-mode-map (copy-keymap shell-mode-map)) (define-key inferior-dbx-mode-map "w" (quote dbx-where)) (define-key inferior-dbx-mode-map "" (quote dbx-trace-mode)) (define-key ctl-x-map " " (quote dbx-stop-at)))

(defun inferior-dbx-mode nil "\
Major mode for interacting with an inferior Dbx process.

The following commands are available:

Entry to this mode calls the value of dbx-mode-hook with no arguments,
if that value is non-nil.  Likewise with the value of shell-mode-hook.
dbx-mode-hook is called after shell-mode-hook.

You can display the debugging program in other window and point out
where you are looking at using the command \\[dbx-where].

\\[dbx-trace-mode] toggles dbx-trace mode. In dbx-trace mode,
debugging program is automatically traced using output from dbx.

The command \\[dbx-stop-at] sets break point at current line of the
program in the buffer. Major mode name of the buffer must be in


Return at end of buffer sends line as input.
Return not at end copies rest of line to end and sends it.
\\[shell-send-eof] sends end-of-file as input.
\\[kill-shell-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing.
\\[interrupt-shell-subjob] interrupts the shell or its current subjob if any.
\\[stop-shell-subjob] stops, likewise. \\[quit-shell-subjob] sends quit signal, likewise.
\\[dbx-where] displays debugging program in other window and
 points out where you are looking at.
\\[dbx-trace-mode] toggles dbx-trace mode.
\\[dbx-stop-at] sets break point at current line." (interactive) (byte-code "Lj ˉ͉̉!! ! !lj!҉	\"H	B	\"" [major-mode mode-name mode-line-process inferior-dbx-mode-map last-input-start last-input-end dbx-trace-flag nil shell-prompt-pattern minor-mode-alist kill-all-local-variables inferior-dbx-mode "Inferior Dbx" (": %s") use-local-map make-local-variable make-marker make-variable-buffer-local "^[^)]*dbx) *" assq (dbx-trace-flag " Trace") run-hooks shell-mode-hook dbx-mode-hook] 12))

(defun run-dbx (path) "\
Run an inferior Dbx process, input and output via buffer *dbx*." (interactive "fProgram to debug: ") (byte-code "È	!Q!	!P$!)p!\" " [file path default-directory nil dbx-process file-name-nondirectory switch-to-buffer "*dbx-" "*" file-name-directory make-shell "dbx-" "dbx" get-buffer-process set-process-filter dbx-filter inferior-dbx-mode] 9))

(defun dbx-trace-mode (arg) "\
Toggle dbx-trace mode.
With arg, turn dbx-trace mode on iff arg is positive.
In dbx-trace mode, user program is automatically traced." (interactive "P") (byte-code "È=?!
?	?
!V !" [major-mode dbx-trace-flag arg nil inferior-dbx-mode error "Dbx-trace mode is effective in inferior-dbx mode only." prefix-numeric-value 0 set-buffer-modified-p buffer-modified-p] 5))

(defun dbx-filter (process string) "\
Trace debugging program automatically if dbx-trace-flag is not nil." (byte-code "!qdb`
c	\")!$!d\")!p=0db" [process beg string dbx-trace-flag t process-buffer dbx-where process-mark set-marker] 8))

(defun dbx-where (&optional begin quiet) "\
Display dbx'ed program in other window and point out where you are looking at.
BEGIN bounds the search. If QUIET, just return nil (no error) if fail." (interactive) (byte-code "ň
#$!!\"!!\")+	X\"!	!! ӉM `p#!*" [file line dbx-break-point begin quiet nil overlay-arrow-string overlay-arrow-position re-search-backward buffer-substring match-beginning 1 match-end 2 find-file-other-window expand-file-name goto-line string-to-int beginning-of-line "=>" make-marker set-marker other-window] 17))

(defun dbx-stop-at nil "\
Set break point at current line." (interactive) (byte-code "Ĉ	! `\"T)
%\"*" [file-name buffer-file-name line dbx-process nil file-name-nondirectory widen count-lines 1 send-string concat "stop at \"" "\":" "
"] 11))