Commit 99f3b856 authored by Nick Roberts's avatar Nick Roberts
Browse files

(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.
parent 9c1a45ed
...@@ -218,6 +218,7 @@ Emacs can't find.") ...@@ -218,6 +218,7 @@ Emacs can't find.")
(defvar gdb-source-window nil) (defvar gdb-source-window nil)
(defvar gdb-inferior-status nil) (defvar gdb-inferior-status nil)
(defvar gdb-continuation nil) (defvar gdb-continuation nil)
(defvar gdb-version nil)
(defvar gdb-filter-output nil (defvar gdb-filter-output nil
"Message to be shown in GUD console. "Message to be shown in GUD console.
...@@ -571,9 +572,10 @@ If NOALL is t, always add --thread option no matter what ...@@ -571,9 +572,10 @@ If NOALL is t, always add --thread option no matter what
When `gdb-non-stop' is nil, return COMMAND unchanged." When `gdb-non-stop' is nil, return COMMAND unchanged."
(if gdb-non-stop (if gdb-non-stop
(if (and gdb-gud-control-all-threads (if (and gdb-gud-control-all-threads
(not noall)) (not noall)
(string-equal gdb-version "7.0+"))
(concat command " --all ") (concat command " --all ")
(gdb-current-context-command command t)) (gdb-current-context-command command))
command)) command))
(defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg) (defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg)
...@@ -820,7 +822,9 @@ detailed description of this mode. ...@@ -820,7 +822,9 @@ detailed description of this mode.
(if (re-search-forward "No symbol" nil t) (if (re-search-forward "No symbol" nil t)
(progn (progn
(message "This version of GDB doesn't support non-stop mode. Turning it off.") (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 "-gdb-set target-async 1" 'ignore))
(gdb-input (list "-enable-pretty-printing" 'ignore)))) (gdb-input (list "-enable-pretty-printing" 'ignore))))
...@@ -1629,16 +1633,10 @@ static char *magick[] = { ...@@ -1629,16 +1633,10 @@ static char *magick[] = {
(concat (car item) "\n"))) (concat (car item) "\n")))
;; NOFRAME is used for gud execution control commands ;; NOFRAME is used for gud execution control commands
(defun gdb-current-context-command (command &optional noframe) (defun gdb-current-context-command (command)
"Add --thread and --frame options to gdb COMMAND. "Add --thread to gdb COMMAND when needed."
(if (and gdb-thread-number
Option values are taken from `gdb-thread-number' and (string-equal gdb-version "7.0+"))
`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
(concat command " --thread " gdb-thread-number) (concat command " --thread " gdb-thread-number)
command)) command))
...@@ -1920,7 +1918,9 @@ current thread and update GDB buffers." ...@@ -1920,7 +1918,9 @@ current thread and update GDB buffers."
;; thread ;; thread
(when (not gdb-register-names) (when (not gdb-register-names)
(gdb-input (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))) 'gdb-register-names-handler)))
;;; Don't set gud-last-frame here as it's currently done in gdb-frame-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." ...@@ -2565,7 +2565,7 @@ corresponding to the mode line clicked."
"Display GDB threads in a new frame.") "Display GDB threads in a new frame.")
(def-gdb-trigger-and-handler (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 gdb-thread-list-handler gdb-thread-list-handler-custom
'(start update update-threads)) '(start update update-threads))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment