]> git.eshelyaron.com Git - emacs.git/commitdiff
(gdb-version): New variable.
authorNick Roberts <nickrob@snap.net.nz>
Wed, 23 Sep 2009 23:22:13 +0000 (23:22 +0000)
committerNick Roberts <nickrob@snap.net.nz>
Wed, 23 Sep 2009 23:22:13 +0000 (23:22 +0000)
(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.

lisp/progmodes/gdb-mi.el

index 831c6fdb0f82c9c5dcd33872e5a70f09c89712c6..6756b7c9f30f1c85e96328bc890a5f6621c8fa1b 100644 (file)
@@ -218,6 +218,7 @@ Emacs can't find.")
 (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 @@ If NOALL is t, always add --thread option no matter what
 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 @@ detailed description of this mode.
   (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 @@ static char *magick[] = {
                       (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 @@ current thread and update GDB buffers."
     ;; 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 @@ corresponding to the mode line clicked."
  "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))