aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/gdb-mi.el42
-rw-r--r--lisp/progmodes/gud.el4
3 files changed, 35 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8c649b17718..ccd8359f285 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12009-08-11 Dmitry Dzhus <dima@sphinx.net.ru>
2
3 * progmodes/gud.el (gud-stop-subjob): Rewritten without macros
4 from `gdb-mi.el' to avoid extra tangling.
5
6 * progmodes/gdb-mi.el (gdb-gud-context-call): Reverting previous
7 change which breaks `gud-def' definitions. used in `gdb'.
8 (gdb-update-gud-running): No extra fuss for updating frame number.
9
12009-08-10 Stefan Monnier <monnier@iro.umontreal.ca> 102009-08-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * international/mule-cmds.el (mule-keymap, mule-menu-keymap) 12 * international/mule-cmds.el (mule-keymap, mule-menu-keymap)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 975908f2166..d2724cc3779 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -134,7 +134,14 @@ value.")
134(defvar gdb-frame-number nil 134(defvar gdb-frame-number nil
135 "Selected frame level for main current thread. 135 "Selected frame level for main current thread.
136 136
137Reset whenever current thread changes.") 137Updated according to the following rules:
138
139When a thread is selected or current thread stops, set to \"0\".
140
141When current thread goes running (and possibly exits eventually),
142set to nil.
143
144May be manually changed by user with `gdb-select-frame'.")
138 145
139;; Used to show overlay arrow in source buffer. All set in 146;; Used to show overlay arrow in source buffer. All set in
140;; gdb-get-main-selected-frame. Disassembly buffer should not use 147;; gdb-get-main-selected-frame. Disassembly buffer should not use
@@ -565,12 +572,15 @@ When `gdb-non-stop' is nil, return COMMAND unchanged."
565 (gdb-current-context-command command t)) 572 (gdb-current-context-command command t))
566 command)) 573 command))
567 574
568;; TODO Document this. We use noarg when not in gud-def 575(defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg)
569(defun gdb-gud-context-call (cmd1 &optional cmd2 noall noarg) 576 "`gud-call' wrapper which adds --thread/--all options between
570 (gud-call 577CMD1 and CMD2. NOALL is the same as in `gdb-gud-context-command'.
571 (concat 578
572 (gdb-gud-context-command cmd1 noall) 579NOARG must be t when this macro is used outside `gud-def'"
573 cmd2) (when (not noarg) 'arg))) 580 `(gud-call
581 (concat
582 (gdb-gud-context-command ,cmd1 ,noall)
583 ,cmd2) ,(when (not noarg) 'arg)))
574 584
575;;;###autoload 585;;;###autoload
576(defun gdb (command-line) 586(defun gdb (command-line)
@@ -1655,11 +1665,9 @@ need to be updated appropriately when current thread changes."
1655 (gdb-update-gud-running)) 1665 (gdb-update-gud-running))
1656 1666
1657(defun gdb-update-gud-running () 1667(defun gdb-update-gud-running ()
1658 "Set `gud-running' and `gdb-frame-number' according to the state 1668 "Set `gud-running' according to the state of current thread.
1659of current thread.
1660 1669
1661`gdb-frame-number' is set to nil if new current thread is 1670`gdb-frame-number' is set to 0 if current thread is now stopped.
1662running.
1663 1671
1664Note that when `gdb-gud-control-all-threads' is t, `gud-running' 1672Note that when `gdb-gud-control-all-threads' is t, `gud-running'
1665cannot be reliably used to determine whether or not execution 1673cannot be reliably used to determine whether or not execution
@@ -1673,12 +1681,10 @@ is running."
1673 (setq gud-running 1681 (setq gud-running
1674 (string= (gdb-get-field (gdb-current-buffer-thread) 'state) 1682 (string= (gdb-get-field (gdb-current-buffer-thread) 'state)
1675 "running")) 1683 "running"))
1676 ;; We change frame number only if the state of current thread has 1684 ;; Set frame number to "0" when _current_ threads stops
1677 ;; changed or there's no current thread. 1685 (when (and (gdb-current-buffer-thread)
1678 (when (not (eq gud-running old-value)) 1686 (not (eq gud-running old-value)))
1679 (if (or gud-running (not (gdb-current-buffer-thread))) 1687 (setq gdb-frame-number "0"))))
1680 (setq gdb-frame-number nil)
1681 (setq gdb-frame-number "0")))))
1682 1688
1683(defun gdb-show-run-p () 1689(defun gdb-show-run-p ()
1684 "Return t if \"Run/continue\" should be shown on the toolbar." 1690 "Return t if \"Run/continue\" should be shown on the toolbar."
@@ -1801,7 +1807,7 @@ is running."
1801(defun gdb-thread-created (output-field)) 1807(defun gdb-thread-created (output-field))
1802(defun gdb-thread-exited (output-field) 1808(defun gdb-thread-exited (output-field)
1803 "Handle =thread-exited async record: unset `gdb-thread-number' 1809 "Handle =thread-exited async record: unset `gdb-thread-number'
1804if current thread exited and update threads list." 1810 if current thread exited and update threads list."
1805 (let* ((thread-id (gdb-get-field (gdb-json-string output-field) 'id))) 1811 (let* ((thread-id (gdb-get-field (gdb-json-string output-field) 'id)))
1806 (if (string= gdb-thread-number thread-id) 1812 (if (string= gdb-thread-number thread-id)
1807 (gdb-setq-thread-number nil)) 1813 (gdb-setq-thread-number nil))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 6e66b0fb261..4b77f4a1ff5 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -133,7 +133,7 @@ Used to grey out relevant toolbar icons.")
133 (and (eq gud-minor-mode 'gdbmi) 133 (and (eq gud-minor-mode 'gdbmi)
134 (> (car (window-fringes)) 0))))) 134 (> (car (window-fringes)) 0)))))
135 135
136(declare-function gdb-gud-context-call "gdb-mi.el") 136(declare-function gdb-gud-context-command "gdb-mi.el")
137 137
138(defun gud-stop-subjob () 138(defun gud-stop-subjob ()
139 (interactive) 139 (interactive)
@@ -143,7 +143,7 @@ Used to grey out relevant toolbar icons.")
143 ((eq gud-minor-mode 'jdb) 143 ((eq gud-minor-mode 'jdb)
144 (gud-call "suspend")) 144 (gud-call "suspend"))
145 ((eq gud-minor-mode 'gdbmi) 145 ((eq gud-minor-mode 'gdbmi)
146 (gdb-gud-context-call "-exec-interrupt" nil nil t)) 146 (gud-call (gdb-gud-context-command "-exec-interrupt")))
147 (t 147 (t
148 (comint-interrupt-subjob))))) 148 (comint-interrupt-subjob)))))
149 149