changeset 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 9ab7401c338b
children 0299ec0f58e6
files lisp/progmodes/gdb-mi.el
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-mi.el	Mon Aug 31 00:28:11 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Mon Aug 31 00:28:37 2009 +0000
@@ -528,12 +528,16 @@
   "Switch to non-stop/A mode."
   (interactive)
   (setq gdb-gud-control-all-threads t)
+  ;; Actually forcing the tool-bar to update.
+  (force-mode-line-update)
   (message "Now in non-stop/A mode."))
 
 (defun gdb-control-current-thread ()
   "Switch to non-stop/T mode."
   (interactive)
   (setq gdb-gud-control-all-threads nil)
+  ;; Actually forcing the tool-bar to update.
+  (force-mode-line-update)
   (message "Now in non-stop/T mode."))
 
 (defun gdb-find-watch-expression ()
@@ -803,8 +807,7 @@
   (gdb-input (list "-gdb-set height 0" 'ignore))
 
   (when gdb-non-stop
-    (gdb-input (list "-gdb-set non-stop 1" 'ignore))
-    (gdb-input (list "-gdb-set target-async 1" 'ignore)))
+    (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler)))
 
   ;; find source file and compilation directory here
   (gdb-input
@@ -817,6 +820,14 @@
   (gdb-input
    (list "-gdb-show prompt" 'gdb-get-prompt)))
 
+(defun gdb-non-stop-handler ()
+  (goto-char (point-min))
+  (if (re-search-forward "No symbol" nil t)
+      (progn
+	(message "This version of GDB doesn't support non-stop mode.  Turning it off.")
+	(setq gdb-non-stop nil))
+    (gdb-input (list "-gdb-set target-async 1" 'ignore))))
+
 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
 
 (defun gdb-create-define-alist ()
@@ -1372,9 +1383,6 @@
                  (gdb-bind-function-to-buffer trigger (current-buffer))))))))
    nil t))
 
-;; GUD buffers are an exception to the rules
-(gdb-set-buffer-rules 'gdbmi 'error)
-
 ;; Partial-output buffer : This accumulates output from a command executed on
 ;; behalf of emacs (rather than the user).
 ;;
@@ -1668,7 +1676,8 @@
   "Only this function must be used to change `gdb-thread-number'
 value to NUMBER, because `gud-running' and `gdb-frame-number'
 need to be updated appropriately when current thread changes."
-  (setq gdb-thread-number number)
+  ;; GDB 6.8 and earlier always output thread-id="0" when stopping.
+  (unless (string-equal number "0") (setq gdb-thread-number number))
   (setq gdb-frame-number "0")
   (gdb-update-gud-running))