comparison lisp/progmodes/gdb-mi.el @ 104750:d2e8b86ba828

(gdb-control-all-threads) (gdb-control-current-thread): Force tool bar update. (gdb-non-stop-handler): New function. (gdb-init-1): Use it to test if GDB version supports non-stop mode Remove unused gdbmi buffer type.
author Nick Roberts <nickrob@snap.net.nz>
date Mon, 31 Aug 2009 00:28:37 +0000
parents 89cb3b38143d
children 78dd253006d6
comparison
equal deleted inserted replaced
104749:9ab7401c338b 104750:d2e8b86ba828
526 ;; These two are used for menu and toolbar 526 ;; These two are used for menu and toolbar
527 (defun gdb-control-all-threads () 527 (defun gdb-control-all-threads ()
528 "Switch to non-stop/A mode." 528 "Switch to non-stop/A mode."
529 (interactive) 529 (interactive)
530 (setq gdb-gud-control-all-threads t) 530 (setq gdb-gud-control-all-threads t)
531 ;; Actually forcing the tool-bar to update.
532 (force-mode-line-update)
531 (message "Now in non-stop/A mode.")) 533 (message "Now in non-stop/A mode."))
532 534
533 (defun gdb-control-current-thread () 535 (defun gdb-control-current-thread ()
534 "Switch to non-stop/T mode." 536 "Switch to non-stop/T mode."
535 (interactive) 537 (interactive)
536 (setq gdb-gud-control-all-threads nil) 538 (setq gdb-gud-control-all-threads nil)
539 ;; Actually forcing the tool-bar to update.
540 (force-mode-line-update)
537 (message "Now in non-stop/T mode.")) 541 (message "Now in non-stop/T mode."))
538 542
539 (defun gdb-find-watch-expression () 543 (defun gdb-find-watch-expression ()
540 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) 544 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
541 (varnum (car var)) expr array) 545 (varnum (car var)) expr array)
801 (if (eq window-system 'w32) 805 (if (eq window-system 'w32)
802 (gdb-input (list "-gdb-set new-console off" 'ignore))) 806 (gdb-input (list "-gdb-set new-console off" 'ignore)))
803 (gdb-input (list "-gdb-set height 0" 'ignore)) 807 (gdb-input (list "-gdb-set height 0" 'ignore))
804 808
805 (when gdb-non-stop 809 (when gdb-non-stop
806 (gdb-input (list "-gdb-set non-stop 1" 'ignore)) 810 (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler)))
807 (gdb-input (list "-gdb-set target-async 1" 'ignore)))
808 811
809 ;; find source file and compilation directory here 812 ;; find source file and compilation directory here
810 (gdb-input 813 (gdb-input
811 ; Needs GDB 6.2 onwards. 814 ; Needs GDB 6.2 onwards.
812 (list "-file-list-exec-source-files" 'gdb-get-source-file-list)) 815 (list "-file-list-exec-source-files" 'gdb-get-source-file-list))
814 (gdb-input 817 (gdb-input
815 ; Needs GDB 6.0 onwards. 818 ; Needs GDB 6.0 onwards.
816 (list "-file-list-exec-source-file" 'gdb-get-source-file))) 819 (list "-file-list-exec-source-file" 'gdb-get-source-file)))
817 (gdb-input 820 (gdb-input
818 (list "-gdb-show prompt" 'gdb-get-prompt))) 821 (list "-gdb-show prompt" 'gdb-get-prompt)))
822
823 (defun gdb-non-stop-handler ()
824 (goto-char (point-min))
825 (if (re-search-forward "No symbol" nil t)
826 (progn
827 (message "This version of GDB doesn't support non-stop mode. Turning it off.")
828 (setq gdb-non-stop nil))
829 (gdb-input (list "-gdb-set target-async 1" 'ignore))))
819 830
820 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") 831 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
821 832
822 (defun gdb-create-define-alist () 833 (defun gdb-create-define-alist ()
823 "Create an alist of #define directives for GUD tooltips." 834 "Create an alist of #define directives for GUD tooltips."
1370 ;; gdb-get-buffer-create 1381 ;; gdb-get-buffer-create
1371 (cons (current-buffer) 1382 (cons (current-buffer)
1372 (gdb-bind-function-to-buffer trigger (current-buffer)))))))) 1383 (gdb-bind-function-to-buffer trigger (current-buffer))))))))
1373 nil t)) 1384 nil t))
1374 1385
1375 ;; GUD buffers are an exception to the rules
1376 (gdb-set-buffer-rules 'gdbmi 'error)
1377
1378 ;; Partial-output buffer : This accumulates output from a command executed on 1386 ;; Partial-output buffer : This accumulates output from a command executed on
1379 ;; behalf of emacs (rather than the user). 1387 ;; behalf of emacs (rather than the user).
1380 ;; 1388 ;;
1381 (gdb-set-buffer-rules 'gdb-partial-output-buffer 1389 (gdb-set-buffer-rules 'gdb-partial-output-buffer
1382 'gdb-partial-output-name) 1390 'gdb-partial-output-name)
1666 ;; changing current thread (see gdb-running) 1674 ;; changing current thread (see gdb-running)
1667 (defun gdb-setq-thread-number (number) 1675 (defun gdb-setq-thread-number (number)
1668 "Only this function must be used to change `gdb-thread-number' 1676 "Only this function must be used to change `gdb-thread-number'
1669 value to NUMBER, because `gud-running' and `gdb-frame-number' 1677 value to NUMBER, because `gud-running' and `gdb-frame-number'
1670 need to be updated appropriately when current thread changes." 1678 need to be updated appropriately when current thread changes."
1671 (setq gdb-thread-number number) 1679 ;; GDB 6.8 and earlier always output thread-id="0" when stopping.
1680 (unless (string-equal number "0") (setq gdb-thread-number number))
1672 (setq gdb-frame-number "0") 1681 (setq gdb-frame-number "0")
1673 (gdb-update-gud-running)) 1682 (gdb-update-gud-running))
1674 1683
1675 (defun gdb-update-gud-running () 1684 (defun gdb-update-gud-running ()
1676 "Set `gud-running' according to the state of current thread. 1685 "Set `gud-running' according to the state of current thread.