Mercurial > emacs
comparison lisp/progmodes/gdb-mi.el @ 104672:2e2a12f25cd1
(gdb-use-separate-io-buffer): Remove
variable ...
(gdb-init-1, gdb-display-separate-io-buffer)
(gdb-frame-separate-io-buffer, gdb-setup-windows): ... and
references to it.
(gdb-inferior-io-mode): Use make-comint-in-buffer.
(gdb-inferior-filter): Use comint-output-filter to stop
echoing and remove ^M characters.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Fri, 28 Aug 2009 10:56:13 +0000 |
parents | 81d782e3337d |
children | 89cb3b38143d |
comparison
equal
deleted
inserted
replaced
104671:887871b8a8ae | 104672:2e2a12f25cd1 |
---|---|
495 "Non-nil means display source file containing the main routine at startup. | 495 "Non-nil means display source file containing the main routine at startup. |
496 Also display the main routine in the disassembly buffer if present." | 496 Also display the main routine in the disassembly buffer if present." |
497 :type 'boolean | 497 :type 'boolean |
498 :group 'gdb | 498 :group 'gdb |
499 :version "22.1") | 499 :version "22.1") |
500 | |
501 ; Note: This mode requires a separate buffer for inferior IO. | |
502 (defconst gdb-use-separate-io-buffer t) | |
503 | 500 |
504 (defun gdb-force-mode-line-update (status) | 501 (defun gdb-force-mode-line-update (status) |
505 (let ((buffer gud-comint-buffer)) | 502 (let ((buffer gud-comint-buffer)) |
506 (if (and buffer (buffer-name buffer)) | 503 (if (and buffer (buffer-name buffer)) |
507 (with-current-buffer buffer | 504 (with-current-buffer buffer |
790 ;; | 787 ;; |
791 (setq gdb-buffer-type 'gdbmi) | 788 (setq gdb-buffer-type 'gdbmi) |
792 ;; | 789 ;; |
793 (gdb-force-mode-line-update | 790 (gdb-force-mode-line-update |
794 (propertize "initializing..." 'face font-lock-variable-name-face)) | 791 (propertize "initializing..." 'face font-lock-variable-name-face)) |
795 (when gdb-use-separate-io-buffer | 792 |
796 (gdb-get-buffer-create 'gdb-inferior-io) | 793 (gdb-get-buffer-create 'gdb-inferior-io) |
797 (gdb-clear-inferior-io) | 794 (gdb-clear-inferior-io) |
798 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) | 795 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) |
799 (gdb-input | 796 (gdb-input |
800 ;; Needs GDB 6.4 onwards | 797 ;; Needs GDB 6.4 onwards |
801 (list (concat "-inferior-tty-set " | 798 (list (concat "-inferior-tty-set " |
802 (process-tty-name (get-process "gdb-inferior"))) | 799 (process-tty-name (get-process "gdb-inferior"))) |
803 'ignore))) | 800 'ignore)) |
804 (if (eq window-system 'w32) | 801 (if (eq window-system 'w32) |
805 (gdb-input (list "-gdb-set new-console off" 'ignore))) | 802 (gdb-input (list "-gdb-set new-console off" 'ignore))) |
806 (gdb-input (list "-gdb-set height 0" 'ignore)) | 803 (gdb-input (list "-gdb-set height 0" 'ignore)) |
807 | 804 |
808 (when gdb-non-stop | 805 (when gdb-non-stop |
1323 (interactive) | 1320 (interactive) |
1324 (gdb-display-buffer | 1321 (gdb-display-buffer |
1325 (gdb-get-buffer-create ,buffer thread) t))) | 1322 (gdb-get-buffer-create ,buffer thread) t))) |
1326 | 1323 |
1327 ;; Used to display windows with thread-bound buffers | 1324 ;; Used to display windows with thread-bound buffers |
1328 (defmacro def-gdb-preempt-display-buffer (name buffer &optional doc split-horizontal) | 1325 (defmacro def-gdb-preempt-display-buffer (name buffer &optional doc |
1326 split-horizontal) | |
1329 `(defun ,name (&optional thread) | 1327 `(defun ,name (&optional thread) |
1330 ,(when doc doc) | 1328 ,(when doc doc) |
1331 (message thread) | 1329 (message thread) |
1332 (gdb-preempt-existing-or-display-buffer | 1330 (gdb-preempt-existing-or-display-buffer |
1333 (gdb-get-buffer-create ,buffer thread) | 1331 (gdb-get-buffer-create ,buffer thread) |
1399 "*")) | 1397 "*")) |
1400 | 1398 |
1401 (defun gdb-display-separate-io-buffer () | 1399 (defun gdb-display-separate-io-buffer () |
1402 "Display IO of debugged program in a separate window." | 1400 "Display IO of debugged program in a separate window." |
1403 (interactive) | 1401 (interactive) |
1404 (if gdb-use-separate-io-buffer | 1402 (gdb-display-buffer |
1405 (gdb-display-buffer | 1403 (gdb-get-buffer-create 'gdb-inferior-io) t)) |
1406 (gdb-get-buffer-create 'gdb-inferior-io) t))) | |
1407 | 1404 |
1408 (defconst gdb-frame-parameters | 1405 (defconst gdb-frame-parameters |
1409 '((height . 14) (width . 80) | 1406 '((height . 14) (width . 80) |
1410 (unsplittable . t) | 1407 (unsplittable . t) |
1411 (tool-bar-lines . nil) | 1408 (tool-bar-lines . nil) |
1413 (minibuffer . nil))) | 1410 (minibuffer . nil))) |
1414 | 1411 |
1415 (defun gdb-frame-separate-io-buffer () | 1412 (defun gdb-frame-separate-io-buffer () |
1416 "Display IO of debugged program in a new frame." | 1413 "Display IO of debugged program in a new frame." |
1417 (interactive) | 1414 (interactive) |
1418 (if gdb-use-separate-io-buffer | 1415 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
1419 (let ((special-display-regexps (append special-display-regexps '(".*"))) | 1416 (special-display-frame-alist gdb-frame-parameters)) |
1420 (special-display-frame-alist gdb-frame-parameters)) | 1417 (display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))) |
1421 (display-buffer (gdb-get-buffer-create 'gdb-inferior-io))))) | |
1422 | 1418 |
1423 (defvar gdb-inferior-io-mode-map | 1419 (defvar gdb-inferior-io-mode-map |
1424 (let ((map (make-sparse-keymap))) | 1420 (let ((map (make-sparse-keymap))) |
1425 (define-key map "\C-c\C-c" 'gdb-separate-io-interrupt) | 1421 (define-key map "\C-c\C-c" 'gdb-separate-io-interrupt) |
1426 (define-key map "\C-c\C-z" 'gdb-separate-io-stop) | 1422 (define-key map "\C-c\C-z" 'gdb-separate-io-stop) |
1427 (define-key map "\C-c\C-\\" 'gdb-separate-io-quit) | 1423 (define-key map "\C-c\C-\\" 'gdb-separate-io-quit) |
1428 (define-key map "\C-c\C-d" 'gdb-separate-io-eof) | 1424 (define-key map "\C-c\C-d" 'gdb-separate-io-eof) |
1429 (define-key map "\C-d" 'gdb-separate-io-eof) | 1425 (define-key map "\C-d" 'gdb-separate-io-eof) |
1430 map)) | 1426 map)) |
1431 | 1427 |
1428 ;; We want to use comint because it has various nifty and familiar features. | |
1432 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" | 1429 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
1433 "Major mode for gdb inferior-io." | 1430 "Major mode for gdb inferior-io. |
1431 | |
1432 The following commands are available: | |
1433 \\{gdb-inferior-io-mode-map}" | |
1434 | |
1434 :syntax-table nil :abbrev-table nil | 1435 :syntax-table nil :abbrev-table nil |
1435 ;; We want to use comint because it has various nifty and familiar features. | 1436 |
1436 (start-process "gdb-inferior" | 1437 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil)) |
1437 ;; (concat "*input/output of " (gdb-get-target-string) "*") | |
1438 (current-buffer) | |
1439 nil)) | |
1440 | 1438 |
1441 (defun gdb-inferior-filter (proc string) | 1439 (defun gdb-inferior-filter (proc string) |
1442 (unless (string-equal string "") | 1440 (unless (string-equal string "") |
1443 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)) | 1441 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)) |
1444 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) | 1442 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
1445 (insert-before-markers string))) | 1443 (comint-output-filter proc string))) |
1446 | 1444 |
1447 (defun gdb-separate-io-interrupt () | 1445 (defun gdb-separate-io-interrupt () |
1448 "Interrupt the program being debugged." | 1446 "Interrupt the program being debugged." |
1449 (interactive) | 1447 (interactive) |
1450 (interrupt-process | 1448 (interrupt-process |
3947 (gud-find-file gdb-main-file) | 3945 (gud-find-file gdb-main-file) |
3948 ;; Put buffer list in window if we | 3946 ;; Put buffer list in window if we |
3949 ;; can't find a source file. | 3947 ;; can't find a source file. |
3950 (list-buffers-noselect)))) | 3948 (list-buffers-noselect)))) |
3951 (setq gdb-source-window (selected-window)) | 3949 (setq gdb-source-window (selected-window)) |
3952 (when gdb-use-separate-io-buffer | 3950 (split-window-horizontally) |
3953 (split-window-horizontally) | 3951 (other-window 1) |
3954 (other-window 1) | 3952 (gdb-set-window-buffer |
3955 (gdb-set-window-buffer | 3953 (gdb-get-buffer-create 'gdb-inferior-io)) |
3956 (gdb-get-buffer-create 'gdb-inferior-io))) | |
3957 (other-window 1) | 3954 (other-window 1) |
3958 (gdb-set-window-buffer (gdb-stack-buffer-name)) | 3955 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
3959 (split-window-horizontally) | 3956 (split-window-horizontally) |
3960 (other-window 1) | 3957 (other-window 1) |
3961 (gdb-set-window-buffer (if gdb-show-threads-by-default | 3958 (gdb-set-window-buffer (if gdb-show-threads-by-default |