comparison lisp/progmodes/gud.el @ 104151:22070e4cdf2a

* progmodes/gud.el (gud-stop-subjob, gud-menu-map): Respect GDB non-stop settings. * progmodes/gdb-mi.el (gdb-thread-number): Initialize with nil. (gdb-current-context-command): Do not append --thread if `gdb-thread-number' is nil. (gdb-running-threads-count, gdb-stopped-threads-count): New variables. (gdb-non-stop, gdb-gud-control-all-threads, gdb-switch-reasons) (gdb-stopped-hooks, gdb-switch-when-another-stopped): New customization options. (gdb-gud-context-command, gdb-gud-context-call): New wrappers for GUD commands. (gdb): `gud-def' definitions changed to use `gdb-gud-context-call' (gdb-init-1): Activate non-stop mode if `gdb-non-stop' is enabled. (gdb-setq-thread-number, gdb-update-gud-running): New functions to set `gdb-thread-number' and update `gud-running' properly. (gdb-running): Update threads list when new threads appear. (gdb-stopped): Support non-stop operation and new thread switching logic. (gdb-jsonify-buffer, gdb-json-read-buffer, gdb-json-string) (gdb-json-partial-output): New set of JSON routines. (def-gdb-auto-update-trigger): New `signal-list' optional argument. (gdb-thread-list-handler-custom): Update `gud-running', `gdb-stopped-threads-count' and `gdb-running-threads-count'. (def-gdb-thread-buffer-gdb-command, gdb-interrupt-thread) (gdb-continue-thread, gdb-step-thread): New commands for fine thread execution control. (gud-menu-map): New menu items to switch non-stop options. (gdb-reset): Cleanup `gdb-thread-position' overlay arrow marker.
author Dmitry Dzhus <dima@sphinx.net.ru>
date Tue, 04 Aug 2009 15:07:23 +0000
parents d37c3737e41f
children 87373993f3bd
comparison
equal deleted inserted replaced
104150:925e1efc6761 104151:22070e4cdf2a
134 (> (car (window-fringes)) 0))))) 134 (> (car (window-fringes)) 0)))))
135 135
136 (defun gud-stop-subjob () 136 (defun gud-stop-subjob ()
137 (interactive) 137 (interactive)
138 (with-current-buffer gud-comint-buffer 138 (with-current-buffer gud-comint-buffer
139 (if (string-equal gud-target-name "emacs") 139 (cond ((string-equal gud-target-name "emacs")
140 (comint-stop-subjob) 140 (comint-stop-subjob))
141 (if (eq gud-minor-mode 'jdb) 141 ((eq gud-minor-mode 'jdb)
142 (gud-call "suspend") 142 (gud-call "suspend"))
143 (comint-interrupt-subjob))))) 143 ((eq gud-minor-mode 'gdbmi)
144 (gdb-gud-context-call "-exec-interrupt" nil nil t))
145 (t
146 (comint-interrupt-subjob)))))
144 147
145 (easy-mmode-defmap gud-menu-map 148 (easy-mmode-defmap gud-menu-map
146 '(([help] "Info (debugger)" . gud-goto-info) 149 '(([help] "Info (debugger)" . gud-goto-info)
147 ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode 150 ([tooltips] menu-item "Show GUD tooltips" gud-tooltip-mode
148 :enable (and (not emacs-basic-display) 151 :enable (and (not emacs-basic-display)
154 ([refresh] "Refresh" . gud-refresh) 157 ([refresh] "Refresh" . gud-refresh)
155 ([run] menu-item "Run" gud-run 158 ([run] menu-item "Run" gud-run
156 :enable (not gud-running) 159 :enable (not gud-running)
157 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) 160 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
158 ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go 161 ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go
159 :visible (and (not gud-running) 162 :visible (and (eq gud-minor-mode 'gdbmi)
160 (eq gud-minor-mode 'gdbmi))) 163 (or (and (or
164 (not gdb-gud-control-all-threads)
165 (not gdb-non-stop))
166 (not gud-running))
167 (and gdb-gud-control-all-threads
168 (> gdb-stopped-threads-count 0)))))
161 ([stop] menu-item "Stop" gud-stop-subjob 169 ([stop] menu-item "Stop" gud-stop-subjob
162 :visible (or (not (memq gud-minor-mode '(gdbmi pdb))) 170 :visible (or (not (memq gud-minor-mode '(gdbmi pdb)))
163 (and gud-running 171 (and (eq gud-minor-mode 'gdbmi)
164 (eq gud-minor-mode 'gdbmi)))) 172 (or (and (or
173 (not gdb-gud-control-all-threads)
174 (not gdb-non-stop))
175 gud-running)
176 (and gdb-gud-control-all-threads
177 (> gdb-running-threads-count 0))))))
165 ([until] menu-item "Continue to selection" gud-until 178 ([until] menu-item "Continue to selection" gud-until
166 :enable (not gud-running) 179 :enable (not gud-running)
167 :visible (and (memq gud-minor-mode '(gdbmi gdb perldb)) 180 :visible (and (memq gud-minor-mode '(gdbmi gdb perldb))
168 (gud-tool-bar-item-visible-no-fringe))) 181 (gud-tool-bar-item-visible-no-fringe)))
169 ([remove] menu-item "Remove Breakpoint" gud-remove 182 ([remove] menu-item "Remove Breakpoint" gud-remove
246 ([menu-bar run] menu-item 259 ([menu-bar run] menu-item
247 ,(propertize "run" 'face 'font-lock-doc-face) gud-run 260 ,(propertize "run" 'face 'font-lock-doc-face) gud-run
248 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) 261 :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
249 ([menu-bar go] menu-item 262 ([menu-bar go] menu-item
250 ,(propertize " go " 'face 'font-lock-doc-face) gud-go 263 ,(propertize " go " 'face 'font-lock-doc-face) gud-go
251 :visible (and (not gud-running) 264 :visible (and (eq gud-minor-mode 'gdbmi)
252 (eq gud-minor-mode 'gdbmi))) 265 (or (and (or
266 (not gdb-gud-control-all-threads)
267 (not gdb-non-stop))
268 (not gud-running))
269 (and gdb-gud-control-all-threads
270 (> gdb-stopped-threads-count 0)))))
253 ([menu-bar stop] menu-item 271 ([menu-bar stop] menu-item
254 ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob 272 ,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob
255 :visible (or gud-running 273 :visible (or (and (eq gud-minor-mode 'gdbmi)
274 (or (and (or
275 (not gdb-gud-control-all-threads)
276 (not gdb-non-stop))
277 gud-running)
278 (and gdb-gud-control-all-threads
279 (> gdb-running-threads-count 0))))
256 (not (eq gud-minor-mode 'gdbmi)))) 280 (not (eq gud-minor-mode 'gdbmi))))
257 ([menu-bar print] 281 ([menu-bar print]
258 . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print)) 282 . (,(propertize "print" 'face 'font-lock-doc-face) . gud-print))
259 ([menu-bar tools] . undefined) 283 ([menu-bar tools] . undefined)
260 ([menu-bar buffer] . undefined) 284 ([menu-bar buffer] . undefined)