diff options
| author | Richard M. Stallman | 1993-05-22 21:25:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-05-22 21:25:32 +0000 |
| commit | dd8e46c7e5b2d03b05ec949510cb1c838a429f2b (patch) | |
| tree | 59b3ee964916233494673855d05b6bf9f538b02b | |
| parent | f753e9aa9233cffe70cc7fde602b6078a1433d08 (diff) | |
| download | emacs-dd8e46c7e5b2d03b05ec949510cb1c838a429f2b.tar.gz emacs-dd8e46c7e5b2d03b05ec949510cb1c838a429f2b.zip | |
(gud-def): Fix inclusion of the define-key.
(gdb, sdb, dbx): Change bindings from letters to control chars.
(gud-common-init): Add save-excursion.
(gud-display-line): Don't mess with buffer-read-only.
(gud-filter): Set output-after-point *after* deleting old prompt.
| -rw-r--r-- | lisp/gud.el | 109 |
1 files changed, 55 insertions, 54 deletions
diff --git a/lisp/gud.el b/lisp/gud.el index 4729624904b..53f2acf8cb0 100644 --- a/lisp/gud.el +++ b/lisp/gud.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | ;; Version: 1.3 | 4 | ;; Version: 1.3 |
| 5 | ;; Keywords: unix, tools | 5 | ;; Keywords: unix, tools |
| 6 | 6 | ||
| 7 | ;; Copyright (C) 1992 Free Software Foundation, Inc. | 7 | ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc. |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -100,15 +100,14 @@ we're in the GUD buffer)." | |||
| 100 | '(interactive "p") | 100 | '(interactive "p") |
| 101 | (list 'gud-call cmd 'arg)) | 101 | (list 'gud-call cmd 'arg)) |
| 102 | (if key | 102 | (if key |
| 103 | (progn | 103 | (list 'define-key |
| 104 | (list 'define-key | 104 | '(current-local-map) |
| 105 | '(current-local-map) | 105 | (concat "\C-c" key) |
| 106 | (concat "\C-c" key) | 106 | (list 'quote func))) |
| 107 | (list 'quote func)) | 107 | (if key |
| 108 | (list 'global-set-key | 108 | (list 'global-set-key |
| 109 | (concat gud-key-prefix key) | 109 | (concat gud-key-prefix key) |
| 110 | (list 'quote func)) | 110 | (list 'quote func))))) |
| 111 | )))) | ||
| 112 | 111 | ||
| 113 | ;; Where gud-display-frame should put the debugging arrow. This is | 112 | ;; Where gud-display-frame should put the debugging arrow. This is |
| 114 | ;; set by the marker-filter, which scans the debugger's output for | 113 | ;; set by the marker-filter, which scans the debugger's output for |
| @@ -178,17 +177,17 @@ and source-file directory for your debugger." | |||
| 178 | 177 | ||
| 179 | (gud-common-init args) | 178 | (gud-common-init args) |
| 180 | 179 | ||
| 181 | (gud-def gud-break "break %f:%l" "b" "Set breakpoint at current line.") | 180 | (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") |
| 182 | (gud-def gud-tbreak "tbreak %f:%l" "t" "Set breakpoint at current line.") | 181 | (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set breakpoint at current line.") |
| 183 | (gud-def gud-remove "clear %l" "d" "Remove breakpoint at current line") | 182 | (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line") |
| 184 | (gud-def gud-step "step %p" "s" "Step one source line with display.") | 183 | (gud-def gud-step "step %p" "\C-s" "Step one source line with display.") |
| 185 | (gud-def gud-stepi "stepi %p" "i" "Step one instruction with display.") | 184 | (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") |
| 186 | (gud-def gud-next "next %p" "n" "Step one line (skip functions).") | 185 | (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") |
| 187 | (gud-def gud-cont "cont" "r" "Continue with display.") | 186 | (gud-def gud-cont "cont" "\C-r" "Continue with display.") |
| 188 | (gud-def gud-finish "finish" "f" "Finish executing current function.") | 187 | (gud-def gud-finish "finish" "\C-f" "Finish executing current function.") |
| 189 | (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") | 188 | (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") |
| 190 | (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") | 189 | (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") |
| 191 | (gud-def gud-print "print %e" "p" "Evaluate C expression at point.") | 190 | (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") |
| 192 | 191 | ||
| 193 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") | 192 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") |
| 194 | (run-hooks 'gdb-mode-hook) | 193 | (run-hooks 'gdb-mode-hook) |
| @@ -252,14 +251,14 @@ and source-file directory for your debugger." | |||
| 252 | 251 | ||
| 253 | (gud-common-init args) | 252 | (gud-common-init args) |
| 254 | 253 | ||
| 255 | (gud-def gud-break "%l b" "b" "Set breakpoint at current line.") | 254 | (gud-def gud-break "%l b" "\C-b" "Set breakpoint at current line.") |
| 256 | (gud-def gud-tbreak "%l c" "t" "Set temporary breakpoint at current line.") | 255 | (gud-def gud-tbreak "%l c" "\C-t" "Set temporary breakpoint at current line.") |
| 257 | (gud-def gud-remove "%l d" "d" "Remove breakpoint at current line") | 256 | (gud-def gud-remove "%l d" "\C-d" "Remove breakpoint at current line") |
| 258 | (gud-def gud-step "s %p" "s" "Step one source line with display.") | 257 | (gud-def gud-step "s %p" "\C-s" "Step one source line with display.") |
| 259 | (gud-def gud-stepi "i %p" "i" "Step one instruction with display.") | 258 | (gud-def gud-stepi "i %p" "\C-i" "Step one instruction with display.") |
| 260 | (gud-def gud-next "S %p" "n" "Step one line (skip functions).") | 259 | (gud-def gud-next "S %p" "\C-n" "Step one line (skip functions).") |
| 261 | (gud-def gud-cont "c" "r" "Continue with display.") | 260 | (gud-def gud-cont "c" "\C-r" "Continue with display.") |
| 262 | (gud-def gud-print "%e/" "p" "Evaluate C expression at point.") | 261 | (gud-def gud-print "%e/" "\C-p" "Evaluate C expression at point.") |
| 263 | 262 | ||
| 264 | (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") | 263 | (setq comint-prompt-regexp "\\(^\\|\n\\)\\*") |
| 265 | (run-hooks 'sdb-mode-hook) | 264 | (run-hooks 'sdb-mode-hook) |
| @@ -298,15 +297,15 @@ and source-file directory for your debugger." | |||
| 298 | (gud-common-init args) | 297 | (gud-common-init args) |
| 299 | 298 | ||
| 300 | (gud-def gud-break "stop at \"%f\":%l" | 299 | (gud-def gud-break "stop at \"%f\":%l" |
| 301 | "b" "Set breakpoint at current line.") | 300 | "\C-b" "Set breakpoint at current line.") |
| 302 | (gud-def gud-remove "clear %l" "d" "Remove breakpoint at current line") | 301 | (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line") |
| 303 | (gud-def gud-step "step %p" "s" "Step one line with display.") | 302 | (gud-def gud-step "step %p" "\C-s" "Step one line with display.") |
| 304 | (gud-def gud-stepi "stepi %p" "i" "Step one instruction with display.") | 303 | (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.") |
| 305 | (gud-def gud-next "next %p" "n" "Step one line (skip functions).") | 304 | (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).") |
| 306 | (gud-def gud-cont "cont" "r" "Continue with display.") | 305 | (gud-def gud-cont "cont" "\C-r" "Continue with display.") |
| 307 | (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") | 306 | (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.") |
| 308 | (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.") | 307 | (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.") |
| 309 | (gud-def gud-print "print %e" "p" "Evaluate C expression at point.") | 308 | (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") |
| 310 | 309 | ||
| 311 | (setq comint-prompt-regexp "^[^)]*dbx) *") | 310 | (setq comint-prompt-regexp "^[^)]*dbx) *") |
| 312 | (run-hooks 'dbx-mode-hook) | 311 | (run-hooks 'dbx-mode-hook) |
| @@ -433,20 +432,21 @@ comint mode, which see." | |||
| 433 | (let (file i) | 432 | (let (file i) |
| 434 | (if (string= args "") | 433 | (if (string= args "") |
| 435 | (setq args nil) | 434 | (setq args nil) |
| 436 | (set-buffer (get-buffer-create "*gud-scratch*")) | 435 | (save-excursion |
| 437 | (erase-buffer) | 436 | (set-buffer (get-buffer-create "*gud-scratch*")) |
| 438 | (insert args) | 437 | (erase-buffer) |
| 439 | (goto-char (point-max)) | 438 | (insert args) |
| 440 | (insert "\")") | 439 | (goto-char (point-max)) |
| 441 | (goto-char (point-min)) | 440 | (insert "\")") |
| 442 | (insert "(\"") | 441 | (goto-char (point-min)) |
| 443 | (while (re-search-forward " +" nil t) | 442 | (insert "(\"") |
| 444 | (replace-match "\" \"" nil nil)) | 443 | (while (re-search-forward " +" nil t) |
| 445 | (goto-char (point-min)) | 444 | (replace-match "\" \"" nil nil)) |
| 446 | (while (re-search-forward "\"\"" nil t) | 445 | (goto-char (point-min)) |
| 447 | (replace-match "" nil nil)) | 446 | (while (re-search-forward "\"\"" nil t) |
| 448 | (setq args (read (buffer-string))) | 447 | (replace-match "" nil nil)) |
| 449 | (kill-buffer (current-buffer))) | 448 | (setq args (read (buffer-string))) |
| 449 | (kill-buffer (current-buffer)))) | ||
| 450 | (setq i (1- (length args))) | 450 | (setq i (1- (length args))) |
| 451 | (while (and (>= i 0) (not (= (aref (nth i args) 0) ?-))) | 451 | (while (and (>= i 0) (not (= (aref (nth i args) 0) ?-))) |
| 452 | (setq file (nth i args)) (setq i (1- i))) | 452 | (setq file (nth i args)) (setq i (1- i))) |
| @@ -476,8 +476,7 @@ comint mode, which see." | |||
| 476 | (let ((inhibit-quit t)) | 476 | (let ((inhibit-quit t)) |
| 477 | (save-excursion | 477 | (save-excursion |
| 478 | (set-buffer (process-buffer proc)) | 478 | (set-buffer (process-buffer proc)) |
| 479 | (let ((moving (= (point) (process-mark proc))) | 479 | (let (moving output-after-point) |
| 480 | (output-after-point (< (point) (process-mark proc)))) | ||
| 481 | (save-excursion | 480 | (save-excursion |
| 482 | (goto-char (process-mark proc)) | 481 | (goto-char (process-mark proc)) |
| 483 | ;; If we have been so requested, delete the debugger prompt. | 482 | ;; If we have been so requested, delete the debugger prompt. |
| @@ -486,6 +485,8 @@ comint mode, which see." | |||
| 486 | (delete-region (point) gud-delete-prompt-marker) | 485 | (delete-region (point) gud-delete-prompt-marker) |
| 487 | (set-marker gud-delete-prompt-marker nil))) | 486 | (set-marker gud-delete-prompt-marker nil))) |
| 488 | (insert-before-markers (gud-marker-filter string)) | 487 | (insert-before-markers (gud-marker-filter string)) |
| 488 | (setq moving (= (point) (process-mark proc))) | ||
| 489 | (setq output-after-point (< (point) (process-mark proc))) | ||
| 489 | ;; Check for a filename-and-line number. | 490 | ;; Check for a filename-and-line number. |
| 490 | ;; Don't display the specified file | 491 | ;; Don't display the specified file |
| 491 | ;; unless (1) point is at or after the position where output appears | 492 | ;; unless (1) point is at or after the position where output appears |
| @@ -552,12 +553,12 @@ Obeying it means displaying in another window the specified file and line." | |||
| 552 | (let* ((buffer (gud-find-file true-file)) | 553 | (let* ((buffer (gud-find-file true-file)) |
| 553 | (window (display-buffer buffer)) | 554 | (window (display-buffer buffer)) |
| 554 | (pos)) | 555 | (pos)) |
| 555 | (if (equal buffer (current-buffer)) | 556 | ;;; (if (equal buffer (current-buffer)) |
| 556 | nil | 557 | ;;; nil |
| 557 | (setq buffer-read-only nil)) | 558 | ;;; (setq buffer-read-only nil)) |
| 558 | (save-excursion | 559 | (save-excursion |
| 560 | ;;; (setq buffer-read-only t) | ||
| 559 | (set-buffer buffer) | 561 | (set-buffer buffer) |
| 560 | (setq buffer-read-only t) | ||
| 561 | (save-restriction | 562 | (save-restriction |
| 562 | (widen) | 563 | (widen) |
| 563 | (goto-line line) | 564 | (goto-line line) |