emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106552: Fix gdb-mi.el bug#9853, bug#


From: Ken Brown
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106552: Fix gdb-mi.el bug#9853, bug#9858, and bug#9878.
Date: Tue, 29 Nov 2011 22:18:33 -0500
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106552
committer: Ken Brown <address@hidden>
branch nick: trunk
timestamp: Tue 2011-11-29 22:18:33 -0500
message:
  Fix gdb-mi.el bug#9853, bug#9858, and bug#9878.
  
  * lisp/progmodes/gdb-mi.el (gdb-version): Remove defvar.
  (gdb-supports-non-stop): New defvar, replacing `gdb-version'.
  (gdb-gud-context-command, gdb-non-stop-handler)
  (gdb-current-context-command, gdb-stopped): Use it.
  (gdb-init-1): Enable pretty printing here.
  (gdb-non-stop-handler): Don't enable pretty-printing here.  Check
  to see if the target supports non-stop mode; if not, turn off
  non-stop mode.  Use the following.
  (gdb-check-target-async): New defun.
  (gud-watch, gdb-stopped): Fix whitespace.
  (gdb-get-source-file): Don't try to display the source file if
  `gdb-main-file' is nil.
modified:
  lisp/ChangeLog
  lisp/progmodes/gdb-mi.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-29 20:21:28 +0000
+++ b/lisp/ChangeLog    2011-11-30 03:18:33 +0000
@@ -1,3 +1,19 @@
+2011-11-29  Ken Brown  <address@hidden>
+
+       * progmodes/gdb-mi.el: Fix bug#9853, bug#9858, and bug#9878.
+       (gdb-version): Remove defvar.
+       (gdb-supports-non-stop): New defvar, replacing `gdb-version'.
+       (gdb-gud-context-command, gdb-non-stop-handler)
+       (gdb-current-context-command, gdb-stopped): Use it.
+       (gdb-init-1): Enable pretty printing here.
+       (gdb-non-stop-handler): Don't enable pretty-printing here.  Check
+       to see if the target supports non-stop mode; if not, turn off
+       non-stop mode.  Use the following.
+       (gdb-check-target-async): New defun.
+       (gud-watch, gdb-stopped): Fix whitespace.
+       (gdb-get-source-file): Don't try to display the source file if
+       `gdb-main-file' is nil.
+
 2011-11-29  Stefan Monnier  <address@hidden>
 
        * align.el: Try to generate fewer markers (bug#10047).

=== modified file 'lisp/progmodes/gdb-mi.el'
--- a/lisp/progmodes/gdb-mi.el  2011-11-27 08:33:25 +0000
+++ b/lisp/progmodes/gdb-mi.el  2011-11-30 03:18:33 +0000
@@ -214,7 +214,7 @@
 (defvar gdb-source-window nil)
 (defvar gdb-inferior-status nil)
 (defvar gdb-continuation nil)
-(defvar gdb-version nil)
+(defvar gdb-supports-non-stop nil)
 (defvar gdb-filter-output nil
   "Message to be shown in GUD console.
 
@@ -574,7 +574,7 @@
   (if gdb-non-stop
       (if (and gdb-gud-control-all-threads
                (not noall)
-              (string-equal gdb-version "7.0+"))
+              gdb-supports-non-stop)
           (concat command " --all ")
         (gdb-current-context-command command))
     command))
@@ -872,6 +872,8 @@
   (when gdb-non-stop
     (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler)))
 
+  (gdb-input (list "-enable-pretty-printing" 'ignore))
+
   ;; find source file and compilation directory here
   (if gdb-create-source-file-list
       (gdb-input
@@ -890,10 +892,18 @@
        (message
          "This version of GDB doesn't support non-stop mode.  Turning it off.")
        (setq gdb-non-stop nil)
-       (setq gdb-version "pre-7.0"))
-    (setq gdb-version "7.0+")
+       (setq gdb-supports-non-stop nil))
+    (setq gdb-supports-non-stop t)
     (gdb-input (list "-gdb-set target-async 1" 'ignore))
-    (gdb-input (list "-enable-pretty-printing" 'ignore))))
+    (gdb-input (list "-list-target-features" 'gdb-check-target-async))))
+
+(defun gdb-check-target-async ()
+  (goto-char (point-min))
+  (unless (re-search-forward "async" nil t)
+    (message
+     "Target doesn't support non-stop mode.  Turning it off.")
+    (setq gdb-non-stop nil)
+    (gdb-input (list "-gdb-set non-stop 0" 'ignore))))
 
 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
 
@@ -1071,7 +1081,7 @@
                               (tooltip-identifier-from-point (point)))))))
              (set-text-properties 0 (length expr) nil expr)
              (gdb-input
-              (list (concat"-var-create - * "  expr "")
+              (list (concat "-var-create - * "  expr "")
                     `(lambda () (gdb-var-create-handler ,expr)))))))
       (message "gud-watch is a no-op in this mode."))))
 
@@ -1699,7 +1709,7 @@
 (defun gdb-current-context-command (command)
   "Add --thread to gdb COMMAND when needed."
   (if (and gdb-thread-number
-          (string-equal gdb-version "7.0+"))
+          gdb-supports-non-stop)
       (concat command " --thread " gdb-thread-number)
     command))
 
@@ -1983,8 +1993,8 @@
     (when (not gdb-register-names)
       (gdb-input
        (list (concat "-data-list-register-names"
-                    (if (string-equal gdb-version "7.0+")
-                        (concat" --thread " thread-id)))
+                    (if gdb-supports-non-stop
+                        (concat " --thread " thread-id)))
              'gdb-register-names-handler)))
 
 ;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler
@@ -4133,7 +4143,7 @@
   (if gdb-many-windows
       (gdb-setup-windows)
     (gdb-get-buffer-create 'gdb-breakpoints-buffer)
-    (if gdb-show-main
+    (if (and gdb-show-main gdb-main-file)
         (let ((pop-up-windows t))
           (display-buffer (gud-find-file gdb-main-file))))))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]