4.4BSD/usr/src/contrib/emacs-18.57/lisp/gdb.elc
(require (quote shell))
(defvar gdb-prompt-pattern "^(.*gdb[+]?) *" "\
A regexp to recognize the prompt for gdb or gdb+.")
(defvar gdb-mode-map nil "\
Keymap for gdb-mode.")
(if gdb-mode-map nil (setq gdb-mode-map (copy-keymap shell-mode-map)) (define-key gdb-mode-map "" (quote gdb-refresh)))
(define-key ctl-x-map " " (quote gdb-break))
(define-key ctl-x-map "&" (quote send-gdb-command))
(defmacro def-gdb (name key &optional doc) (byte-code "ÅÆÇ \"!ÈÉÆÊ ËF FÌÍÎφ ÐÑÒ
D&ÓÔÕDFE*‡" [fun name cstr doc key intern format "gdb-%s" if (not (= 1 arg)) "%s %s" arg progn list defun (arg) "" (interactive "p") gdb-call define-key gdb-mode-map quote] 11))
(def-gdb "step" "ó" "Step one source line with display")
(def-gdb "stepi" "é" "Step one instruction with display")
(def-gdb "next" "î" "Step one source line (skip functions)")
(def-gdb "cont" "ã" "Continue with display")
(def-gdb "finish" "" "Finish executing current function")
(def-gdb "up" "õ" "Go up N stack frames (numeric arg) with display")
(def-gdb "down" "ä" "Go down N stack frames (numeric arg) with display")
(defun gdb-mode nil "\
Major mode for interacting with an inferior Gdb process.
The following commands are available:
\\{gdb-mode-map}
\\[gdb-display-frame] displays in the other window
the last line referred to in the gdb buffer.
\\[gdb-step],\\[gdb-next], and \\[gdb-nexti] in the gdb window,
call gdb to step,next or nexti and then update the other window
with the current file and position.
If you are in a source file, you may select a point to break
at, by doing \\[gdb-break].
Commands:
Many commands are inherited from shell mode.
Additionally we have:
\\[gdb-display-frame] display frames file in other window
\\[gdb-step] advance one line in program
\\[gdb-next] advance one line in program (skip over calls).
\\[send-gdb-command] used for special printing of an arg at the current point.
C-x SPACE sets break point at current line." (interactive) (byte-code "LjΠˆÏ‰ˆÐ‰ˆÑ‰ˆÒ!ˆÓÄ!ˆÔ ‰ˆÓÅ!ˆÔ ‰ˆÓÆ!ˆÇ‰ˆÓÈ!ˆÉ‰ˆÓÊ!ˆÇ‰
ˆÓË!ˆÇ‰ˆÓÌ!ˆ
‰ˆÕÖ×\"‡" [major-mode mode-name mode-line-process gdb-mode-map last-input-start last-input-end gdb-last-frame nil gdb-last-frame-displayed-p t gdb-delete-prompt-marker gdb-filter-accumulator shell-prompt-pattern gdb-prompt-pattern kill-all-local-variables gdb-mode "Inferior Gdb" (": %s") use-local-map make-local-variable make-marker run-hooks shell-mode-hook gdb-mode-hook] 14))
(defvar current-gdb-buffer nil)
(defvar gdb-command-name "gdb" "\
Pathname for executing gdb.")
(defun gdb (path) "\
Run gdb on program FILE in buffer *gdb-FILE*.
The directory containing FILE becomes the initial working directory
and source-file directory for GDB. If you wish to change this, use
the GDB commands `cd DIR' and `directory'." (interactive "FRun gdb on file: ") (byte-code "ĈÅ!‰ˆÆ!ÇÈ ÉQ!ˆÊ!‰ˆn† Ë ˆÌÍ
Î#ˆÏÐ PÄÑÒ
&ˆÓ ˆÔÕp!Ö\"ˆ×Õp!Ø\"ˆÙ )‡" [path file default-directory gdb-command-name nil expand-file-name file-name-nondirectory switch-to-buffer "*gdb-" "*" file-name-directory newline insert "Current directory is " "
" make-shell "gdb-" "-fullname" "-cd" gdb-mode set-process-filter get-buffer-process gdb-filter set-process-sentinel gdb-sentinel gdb-set-buffer] 14))
(defun gdb-set-buffer nil (byte-code "Â=… p‰‡" [major-mode current-gdb-buffer gdb-mode] 2))
(defun gdb-filter (proc string) (byte-code "Á
ƒ Å
P\"‚ Æ\")‡" [inhibit-quit t gdb-filter-accumulator proc string gdb-filter-accumulate-marker gdb-filter-scan-input] 4))
(defun gdb-filter-accumulate-marker (proc string) (byte-code "Á‰ˆ
GÉVƒc
ÉHÊUƒR ËÌ
\"ƒK ËÍ
Î#ËÍ
T#
ÎOÏ
T
O!B‰*ˆÁ‰ˆÐ
TÁO\"‚N
‰)‚` ÑÒ\"ˆÐ
ÉÁO\"‚f
‰‡" [gdb-filter-accumulator nil string end first-colon second-colon gdb-last-frame gdb-last-frame-displayed-p proc 1 26 string-match "
" ":" 2 string-to-int gdb-filter-scan-input gdb-filter-insert ""] 11))
(defun gdb-filter-scan-input (proc string) (byte-code "ÅÆ\"ƒ
‰‚- ÇÈ\"ƒ( ÉÊO\"ˆËÂO\"‚, É\")‡" [string gdb-filter-accumulator nil start proc equal "" string-match "" gdb-filter-insert 0 gdb-filter-accumulate-marker] 8))
(defun gdb-filter-insert (proc string) (byte-code "`Ç !U`Ç !WpÈÉ !qˆÊŽŠÇ !bˆ`‰ˆ
cˆËÇ !`\"ˆÌ ˆÍ
†7 Îp!?Æ\"))ˆ…D Ç !b,‡" [moving proc output-after-point old-buffer start string t process-mark nil process-buffer ((byte-code "q‡" [old-buffer] 1)) set-marker gdb-maybe-delete-prompt gdb-display-frame get-buffer-window] 11))
(defun gdb-sentinel (proc msg) (byte-code "ÇÈ!!?ƒ ‰ˆÉÂ\"‚X Ê!Ë>…X ‰ˆÌÍÊ!!P‰ˆpÎŽÈ!qˆÏÐ !ˆmƒF ÑÒ
Ó$‚R ŠdbˆÑÒ
Ó$)ˆÔ!))‡" [proc overlay-arrow-position nil mode-line-process obuf mode-name msg buffer-name process-buffer set-process-buffer process-status (signal exit) ": " symbol-name ((byte-code "q‡" [obuf] 1)) set-buffer-modified-p buffer-modified-p insert 10 " " delete-process] 15))
(defun gdb-refresh nil "\
Fix up a possibly garbled display, and redraw the arrow." (interactive) (byte-code "ÀˆÁ ˆÂ ‡" [nil redraw-display gdb-display-frame] 3))
(defun gdb-display-frame (&optional nodisplay noauto) "\
Find, obey and delete the last filename-and-line marker from GDB.
The marker looks like \\032\\032FILENAME:LINE:CHARPOS\\n.
Obeying it means displaying in another window the specified file and line." (interactive) (byte-code "ÅˆÆ ˆ…\"