changeset 105165:fd22b3e4d41f

(gdb-version): New variable. (gdb-non-stop-handler): Set gdb-version. (gdb-gud-context-command, gdb-current-context-command, gdb-stopped): Condition "--thread" option on gdb-version. (gdb-invalidate-threads): Remove unused argument.
author Nick Roberts <nickrob@snap.net.nz>
date Wed, 23 Sep 2009 23:22:13 +0000
parents ed1ef7720126
children 172e1951f385
files lisp/progmodes/gdb-mi.el
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-mi.el	Wed Sep 23 23:21:47 2009 +0000
+++ b/lisp/progmodes/gdb-mi.el	Wed Sep 23 23:22:13 2009 +0000
@@ -218,6 +218,7 @@
 (defvar gdb-source-window nil)
 (defvar gdb-inferior-status nil)
 (defvar gdb-continuation nil)
+(defvar gdb-version nil)
 (defvar gdb-filter-output nil
   "Message to be shown in GUD console.
 
@@ -571,9 +572,10 @@
 When `gdb-non-stop' is nil, return COMMAND unchanged."
   (if gdb-non-stop
       (if (and gdb-gud-control-all-threads
-               (not noall))
+               (not noall)
+	       (string-equal gdb-version "7.0+"))
           (concat command " --all ")
-        (gdb-current-context-command command t))
+        (gdb-current-context-command command))
     command))
 
 (defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg)
@@ -820,7 +822,9 @@
   (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))
+	(setq gdb-non-stop nil)
+	(setq gdb-version "pre-7.0"))
+    (setq gdb-version "7.0+")
     (gdb-input (list "-gdb-set target-async 1" 'ignore))
     (gdb-input (list "-enable-pretty-printing" 'ignore))))
 
@@ -1629,16 +1633,10 @@
 		       (concat (car item) "\n")))
 
 ;; NOFRAME is used for gud execution control commands
-(defun gdb-current-context-command (command &optional noframe)
-  "Add --thread and --frame options to gdb COMMAND.
-
-Option values are taken from `gdb-thread-number' and
-`gdb-frame-number'. If `gdb-thread-number' is nil, COMMAND is
-returned unchanged. If `gdb-frame-number' is nil of NOFRAME is t,
-then no --frame option is added."
-  ;; gdb-frame-number may be nil while gdb-thread-number is non-nil
-  ;; (when current thread is running)
-  (if gdb-thread-number
+(defun gdb-current-context-command (command)
+  "Add --thread to gdb COMMAND when needed."
+  (if (and gdb-thread-number
+	   (string-equal gdb-version "7.0+"))
       (concat command " --thread " gdb-thread-number)
     command))
 
@@ -1920,7 +1918,9 @@
     ;; thread
     (when (not gdb-register-names)
       (gdb-input
-       (list (concat "-data-list-register-names --thread " thread-id)
+       (list (concat "-data-list-register-names" 
+		     (if (string-equal gdb-version "7.0+")
+			 (concat" --thread " thread-id)))
              'gdb-register-names-handler)))
 
 ;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler
@@ -2565,7 +2565,7 @@
  "Display GDB threads in a new frame.")
 
 (def-gdb-trigger-and-handler
-  gdb-invalidate-threads (gdb-current-context-command "-thread-info" gud-running)
+  gdb-invalidate-threads (gdb-current-context-command "-thread-info")
   gdb-thread-list-handler gdb-thread-list-handler-custom
   '(start update update-threads))