unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9853: 24.0.90; gdb-version only set in non-stop mode
@ 2011-10-23 22:33 Ken Brown
  2011-10-26 18:04 ` Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2011-10-23 22:33 UTC (permalink / raw)
  To: 9853

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.

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.  Is 
there a reason pretty-printing should only be enabled in non-stop mode.

Ken





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#9853: 24.0.90; gdb-version only set in non-stop mode
  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
  2011-11-30  3:29   ` Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2011-10-26 18:04 UTC (permalink / raw)
  To: 9853

[-- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#9853: 24.0.90; gdb-version only set in non-stop mode
  2011-10-26 18:04 ` Ken Brown
@ 2011-11-30  3:29   ` Ken Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Brown @ 2011-11-30  3:29 UTC (permalink / raw)
  To: 9853-done

On 10/26/2011 2:04 PM, Ken Brown wrote:
> The attached patch implements my suggestions (and also makes a couple of
> whitespace changes).
>
> OK to apply?

Patch applied.  Closing bug.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-30  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2011-11-30  3:29   ` Ken Brown

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).