diff 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
line wrap: on
line diff
--- a/lisp/progmodes/gud.el	Tue Aug 04 14:40:33 2009 +0000
+++ b/lisp/progmodes/gud.el	Tue Aug 04 15:07:23 2009 +0000
@@ -136,11 +136,14 @@
 (defun gud-stop-subjob ()
   (interactive)
   (with-current-buffer gud-comint-buffer
-    (if (string-equal gud-target-name "emacs")
-	(comint-stop-subjob)
-      (if (eq gud-minor-mode 'jdb)
-	  (gud-call "suspend")
-	(comint-interrupt-subjob)))))
+    (cond ((string-equal gud-target-name "emacs")
+           (comint-stop-subjob))
+          ((eq gud-minor-mode 'jdb)
+           (gud-call "suspend"))
+          ((eq gud-minor-mode 'gdbmi)
+           (gdb-gud-context-call "-exec-interrupt" nil nil t))
+          (t 
+           (comint-interrupt-subjob)))))
 
 (easy-mmode-defmap gud-menu-map
   '(([help]     "Info (debugger)" . gud-goto-info)
@@ -156,12 +159,22 @@
                   :enable (not gud-running)
 		  :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
     ([go]	menu-item (if gdb-active-process "Continue" "Run") gud-go
-		  :visible (and (not gud-running)
-				(eq gud-minor-mode 'gdbmi)))
+		  :visible (and (eq gud-minor-mode 'gdbmi)
+                                (or (and (or
+                                          (not gdb-gud-control-all-threads)
+                                          (not gdb-non-stop))
+                                         (not gud-running))
+                                    (and gdb-gud-control-all-threads
+                                         (> gdb-stopped-threads-count 0)))))
     ([stop]	menu-item "Stop" gud-stop-subjob
 		  :visible (or (not (memq gud-minor-mode '(gdbmi pdb)))
-			       (and gud-running
-				    (eq gud-minor-mode 'gdbmi))))
+			       (and (eq gud-minor-mode 'gdbmi)
+                                    (or (and (or
+                                              (not gdb-gud-control-all-threads)
+                                              (not gdb-non-stop))
+                                             gud-running)
+                                        (and gdb-gud-control-all-threads
+                                             (> gdb-running-threads-count 0))))))
     ([until]	menu-item "Continue to selection" gud-until
                   :enable (not gud-running)
 		  :visible (and (memq gud-minor-mode '(gdbmi gdb perldb))
@@ -248,11 +261,22 @@
 	:visible (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
        ([menu-bar go] menu-item
 	,(propertize " go " 'face 'font-lock-doc-face) gud-go
-	:visible (and (not gud-running)
-		      (eq gud-minor-mode 'gdbmi)))
+	:visible (and (eq gud-minor-mode 'gdbmi)
+                      (or (and (or
+                                (not gdb-gud-control-all-threads)
+                                (not gdb-non-stop))
+                               (not gud-running))
+                          (and gdb-gud-control-all-threads
+                               (> gdb-stopped-threads-count 0)))))
        ([menu-bar stop] menu-item
 	,(propertize "stop" 'face 'font-lock-doc-face) gud-stop-subjob
-	:visible (or gud-running
+	:visible (or (and (eq gud-minor-mode 'gdbmi)
+                          (or (and (or
+                                    (not gdb-gud-control-all-threads)
+                                    (not gdb-non-stop))
+                                   gud-running)
+                              (and gdb-gud-control-all-threads
+                                   (> gdb-running-threads-count 0))))
 		     (not (eq gud-minor-mode 'gdbmi))))
        ([menu-bar print]
 	. (,(propertize "print" 'face 'font-lock-doc-face) . gud-print))