changeset 67125:39c6d2fd1f63

(gdb-info-breakpoints-custom) (gdb-mouse-toggle-breakpoint-margin) (gdb-mouse-toggle-breakpoint-fringe, gdb-threads-select): Add gdb-server-prefix to keep out of command history. (gdb-edit-register-value): New function. (gdb-registers-mode-map): Bind mouse-2 and RET to it. (gdb-info-registers-custom): Use above map.
author Nick Roberts <nickrob@snap.net.nz>
date Fri, 25 Nov 2005 21:34:03 +0000
parents 47ddc89c842c
children ed2c1481cde9
files lisp/progmodes/gdb-ui.el
diffstat 1 files changed, 32 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/gdb-ui.el	Fri Nov 25 21:33:02 2005 +0000
+++ b/lisp/progmodes/gdb-ui.el	Fri Nov 25 21:34:03 2005 +0000
@@ -1466,11 +1466,11 @@
 				(gdb-put-breakpoint-icon (eq flag ?y) bptno)))
 			  (gdb-enqueue-input
 			   (list
-			    (concat "list "
+			    (concat gdb-server-prefix "list "
 				    (match-string-no-properties 1) ":1\n")
 			    'ignore))
 			  (gdb-enqueue-input
-			   (list "info source\n"
+			   (list (concat gdb-server-prefix "info source\n")
 				 `(lambda () (gdb-get-location
 					      ,bptno ,line ,flag))))))))))
 	  (end-of-line)))))
@@ -1505,7 +1505,7 @@
 		 (list
 		  (let ((bptno (get-text-property
 				0 'gdb-bptno (car (posn-string posn)))))
-		    (concat
+		    (concat gdb-server-prefix
 			    (if (get-text-property
 				 0 'gdb-enabled (car (posn-string posn)))
 				"disable "
@@ -1531,7 +1531,7 @@
 	  (when (stringp obj)
 	    (gdb-enqueue-input
 	     (list
-	      (concat
+	      (concat gdb-server-prefix
 	       (if (get-text-property 0 'gdb-enabled obj)
 		   "disable "
 		 "enable ")
@@ -1832,7 +1832,8 @@
   (interactive (list last-input-event))
   (if event (mouse-set-point event))
   (gdb-enqueue-input
-   (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore))
+   (list (concat gdb-server-prefix "thread "
+		 (gdb-get-thread-number) "\n") 'ignore))
   (gud-display-frame))
 
 
@@ -1859,19 +1860,36 @@
   (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
     (save-excursion
       (let ((buffer-read-only nil)
-	    bl)
+	    start end)
 	(goto-char (point-min))
 	(while (< (point) (point-max))
-	  (setq bl (line-beginning-position))
+	  (setq start (line-beginning-position))
+	  (setq end (line-end-position))
 	  (when (looking-at "^[^ ]+")
 	    (unless (string-equal (match-string 0) "The")
-	      (put-text-property bl (match-end 0)
-				 'face font-lock-variable-name-face)))
+	      (put-text-property start (match-end 0)
+				 'face font-lock-variable-name-face)
+	      (add-text-properties start end 
+		                   '(help-echo "mouse-2: edit value"
+				     mouse-face highlight))))
 	  (forward-line 1))))))
 
+(defun gdb-edit-register-value (&optional event)
+  (interactive (list last-input-event))
+  (save-excursion
+    (if event (mouse-set-point event))
+    (beginning-of-line)
+    (let* ((register (current-word))
+	  (value (read-string (format "New value (%s): " register))))
+      (gdb-enqueue-input
+       (list (concat gdb-server-prefix "set $" register "=" value "\n")
+	     'ignore)))))
+
 (defvar gdb-registers-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
+    (define-key map "\r" 'gdb-edit-register-value)
+    (define-key map [mouse-2] 'gdb-edit-register-value)
     (define-key map " " 'toggle-gdb-all-registers)
     (define-key map "q" 'kill-this-buffer)
      map))
@@ -1915,9 +1933,9 @@
 	(setq gdb-all-registers nil)
 	(with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
 	  (setq mode-name "Registers:")))
-	(setq gdb-all-registers t)
-	(with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
-	  (setq mode-name "Registers:All")))
+    (setq gdb-all-registers t)
+    (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
+      (setq mode-name "Registers:All")))
   (gdb-invalidate-registers))
 
 
@@ -2253,13 +2271,13 @@
  "Keymap to create watch expression of a complex data type local variable.")
 
 (defconst gdb-struct-string
-  (concat (propertize "[struct/union];"
+  (concat (propertize "[struct/union]"
 		      'mouse-face 'highlight
 		      'help-echo "mouse-2: create watch expression"
 		      'local-map gdb-locals-watch-keymap) "\n"))
 
 (defconst gdb-array-string
-  (concat " " (propertize "[array];"
+  (concat " " (propertize "[array]"
 			  'mouse-face 'highlight
 			  'help-echo "mouse-2: create watch expression"
 			  'local-map gdb-locals-watch-keymap) "\n"))