all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: 9853@debbugs.gnu.org
Subject: bug#9853: 24.0.90; gdb-version only set in non-stop mode
Date: Wed, 26 Oct 2011 14:04:17 -0400	[thread overview]
Message-ID: <4EA84BA1.6080706@cornell.edu> (raw)
In-Reply-To: <4EA4964E.5040002@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On 10/23/2011 6:33 PM, Ken Brown wrote:
> The variable gdb-version is set in the function gdb-non-stop-handler,
> which is only called if gdb-non-stop is non-nil. Given that
> gdb-non-stop-setting is customizable and may well be set to nil,
> wouldn't it make more sense to get the version some other way? For
> instance, there's a GDB/MI command -gdb-version that could be used.

After looking through gdb-mi.el more carefully, I see that emacs doesn't 
really need to know the GDB version.  So I withdraw my complaint.  But I 
think the variable gdb-version should probably be renamed to reflect its 
real purpose, perhaps to gdb-supports-non-stop.

> Also, the -enable-pretty-printing command is sent from
> gdb-non-stop-handler and so is only sent if gdb-non-stop is non-nil.

This still seems wrong, unless there's some reason that pretty-printing 
is only useful in non-stop mode.

The attached patch implements my suggestions (and also makes a couple of 
whitespace changes).

OK to apply?

Ken

[-- Attachment #2: gdb-version.patch --]
[-- Type: text/plain, Size: 2601 bytes --]

=== modified file 'lisp/progmodes/gdb-mi.el'
--- lisp/progmodes/gdb-mi.el	2011-10-06 16:11:38 +0000
+++ lisp/progmodes/gdb-mi.el	2011-10-26 17:49:07 +0000
@@ -225,7 +225,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.
 
@@ -585,7 +585,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))
@@ -860,6 +860,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
   (gdb-input
                                         ; Needs GDB 6.2 onwards.
@@ -878,10 +880,9 @@
 	(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+")
-    (gdb-input (list "-gdb-set target-async 1" 'ignore))
-    (gdb-input (list "-enable-pretty-printing" 'ignore))))
+	(setq gdb-supports-non-stop nil))
+    (setq gdb-supports-non-stop t)
+    (gdb-input (list "-gdb-set target-async 1" 'ignore))))
 
 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
 
@@ -1059,7 +1060,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."))))
 
@@ -1687,7 +1688,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))
 
@@ -1971,8 +1972,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


  reply	other threads:[~2011-10-26 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 22:33 bug#9853: 24.0.90; gdb-version only set in non-stop mode Ken Brown
2011-10-26 18:04 ` Ken Brown [this message]
2011-11-30  3:29   ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA84BA1.6080706@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=9853@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.