changeset 65855:97ab21c68453

2005-10-06 Masatake YAMATO <jet@gyve.org> * progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Put `font-lock-function-name-face'. (gdb-info-frames-custom): Put `font-lock-function-name-face' and `font-lock-variable-name-face' (gdb-registers-font-lock-keywords): New font lock keywords definition. (gdb-registers-mode): Use `gdb-registers-font-lock-keywords`. (gdb-memory-font-lock-keywords): New font lock keywords definition. (gdb-memory-mode): Use `gdb-memory-font-lock-keywords'. (gdb-local-font-lock-keywords): New font lock keywords definition. (gdb-locals-mode): Use `gdb-local-font-lock-keywords' (gdb-threads-font-lock-keywords): New font lock keywords definition. (gdb-threads-mode): Use `gdb-threads-font-lock-keywords'.
author Masatake YAMATO <jet@gyve.org>
date Wed, 05 Oct 2005 17:20:04 +0000
parents 88cc3da19d59
children d64aeb0dc54e 2a679c81f552
files lisp/ChangeLog lisp/progmodes/gdb-ui.el
diffstat 2 files changed, 85 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Oct 05 15:31:44 2005 +0000
+++ b/lisp/ChangeLog	Wed Oct 05 17:20:04 2005 +0000
@@ -1,3 +1,18 @@
+2005-10-06  Masatake YAMATO  <jet@gyve.org>
+
+	* progmodes/gdb-ui.el (gdb-info-breakpoints-custom): Put 
+	`font-lock-function-name-face'.
+	(gdb-info-frames-custom): Put `font-lock-function-name-face'
+	and `font-lock-variable-name-face'
+	(gdb-registers-font-lock-keywords): New font lock keywords definition.
+	(gdb-registers-mode): Use `gdb-registers-font-lock-keywords`.
+	(gdb-memory-font-lock-keywords): New font lock keywords definition.
+	(gdb-memory-mode): Use `gdb-memory-font-lock-keywords'.
+	(gdb-local-font-lock-keywords): New font lock keywords definition.
+	(gdb-locals-mode): Use `gdb-local-font-lock-keywords'
+	(gdb-threads-font-lock-keywords): New font lock keywords definition.
+	(gdb-threads-mode): Use `gdb-threads-font-lock-keywords'.
+
 2005-10-05  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* progmodes/scheme.el (scheme-mode-syntax-table): Mark ; as being
--- a/lisp/progmodes/gdb-ui.el	Wed Oct 05 15:31:44 2005 +0000
+++ b/lisp/progmodes/gdb-ui.el	Wed Oct 05 17:20:04 2005 +0000
@@ -1337,8 +1337,11 @@
 		(setq bptno (match-string 1))
 		(setq flag (char-after (match-beginning 2)))
 		(beginning-of-line)
-		(if (re-search-forward " in .* at\\s-+" nil t)
+		(if (re-search-forward " in \\(.*\\) at\\s-+" nil t)
 		    (progn
+		      (let ((buffer-read-only nil))
+			(add-text-properties (match-beginning 1) (match-end 1)
+					     '(face font-lock-function-name-face)))
 		      (looking-at "\\(\\S-+\\):\\([0-9]+\\)")
 		      (let ((line (match-string 2)) (buffer-read-only nil)
 			    (file (match-string 1)))
@@ -1531,17 +1534,31 @@
 (defun gdb-info-frames-custom ()
   (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
     (save-excursion
-      (let ((buffer-read-only nil))
+      (let ((buffer-read-only nil)
+	    bl el)
 	(goto-char (point-min))
 	(while (< (point) (point-max))
-	  (add-text-properties (line-beginning-position) (line-end-position)
+	  (setq bl (line-beginning-position)
+		el (line-end-position))
+	  (add-text-properties bl el
 			     '(mouse-face highlight
 			       help-echo "mouse-2, RET: Select frame"))
-	  (beginning-of-line)
-	  (when (and (looking-at "^#\\([0-9]+\\)")
-		     (equal (match-string 1) gdb-frame-number))
-	    (put-text-property (line-beginning-position) (line-end-position)
-			       'face '(:inverse-video t)))
+	  (goto-char bl)
+	  (when (looking-at "^#\\([0-9]+\\)")
+	    (if (equal (match-string 1) gdb-frame-number)
+		(put-text-property bl el 'face '(:inverse-video t))
+	      (when (re-search-forward " in \\([^ ]+\\) (" el t)
+		(put-text-property (match-beginning 1) (match-end 1)
+				   'face font-lock-function-name-face)
+		(setq bl (match-end 0))
+		(while (re-search-forward "<\\([^>]+\\)>" el t)
+		  (put-text-property (match-beginning 1) (match-end 1)
+				     'face font-lock-function-name-face))
+		(goto-char bl)
+		(while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
+		  (put-text-property (match-beginning 1) (match-end 1)
+				     'face font-lock-variable-name-face))
+		)))
 	  (forward-line 1))))))
 
 (defun gdb-stack-buffer-name ()
@@ -1648,6 +1665,14 @@
     (define-key map [mouse-2] 'gdb-threads-select)
     map))
 
+(defvar gdb-threads-font-lock-keywords
+  '(
+    (") +\\([^ ]+\\) ("  (1 font-lock-function-name-face))
+    ("in \\([^ ]+\\) ("  (1 font-lock-function-name-face))
+    ("\\(\\(\\sw\\|[_.]\\)+\\)="  (1 font-lock-variable-name-face))
+    )
+  "Font lock keywords used in `gdb-threads-mode'.")
+
 (defun gdb-threads-mode ()
   "Major mode for gdb frames.
 
@@ -1657,6 +1682,8 @@
   (setq mode-name "Threads")
   (setq buffer-read-only t)
   (use-local-map gdb-threads-mode-map)
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-threads-font-lock-keywords))
   (run-mode-hooks 'gdb-threads-mode-hook)
   'gdb-invalidate-threads)
 
@@ -1702,6 +1729,12 @@
     (define-key map "q" 'kill-this-buffer)
      map))
 
+(defvar gdb-registers-font-lock-keywords
+  '(
+    ("^[^ ]+" . font-lock-variable-name-face)
+    )
+  "Font lock keywords used in `gdb-registers-mode'.")
+
 (defun gdb-registers-mode ()
   "Major mode for gdb registers.
 
@@ -1711,6 +1744,8 @@
   (setq mode-name "Registers:")
   (setq buffer-read-only t)
   (use-local-map gdb-registers-mode-map)
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-registers-font-lock-keywords))
   (run-mode-hooks 'gdb-registers-mode-hook)
   (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
       'gdb-invalidate-registers
@@ -1955,6 +1990,12 @@
     (define-key map (vector 'header-line 'down-mouse-1) 'ignore)
     map))
 
+(defvar gdb-memory-font-lock-keywords
+  '(;; <__function.name+n>
+    ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face))
+    )
+  "Font lock keywords used in `gdb-memory-mode'.")
+
 (defun gdb-memory-mode ()
   "Major mode for examining memory.
 
@@ -2026,6 +2067,8 @@
 		       'help-echo "mouse-3: Select unit size"
 		       'mouse-face 'mode-line-highlight
 		       'local-map gdb-memory-unit-keymap))))
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-memory-font-lock-keywords))
   (run-mode-hooks 'gdb-memory-mode-hook)
   'gdb-invalidate-memory)
 
@@ -2094,6 +2137,23 @@
     (define-key map "q" 'kill-this-buffer)
      map))
 
+(defvar gdb-local-font-lock-keywords
+  '(
+    ;; var = (struct struct_tag) value
+    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(struct\\) \\(\\(\\sw\\|[_.]\\)+\\)"
+      (1 font-lock-variable-name-face)
+      (3 font-lock-keyword-face)
+      (4 font-lock-type-face))
+    ;; var = (type) value 
+    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +(\\(\\(\\sw\\|[_.]\\)+\\)"
+      (1 font-lock-variable-name-face)
+      (3 font-lock-type-face))
+    ;; var = val
+    ( "\\(^\\(\\sw\\|[_.]\\)+\\) += +[^(]"
+      (1 font-lock-variable-name-face))
+    )
+  "Font lock keywords used in `gdb-local-mode'.")
+
 (defun gdb-locals-mode ()
   "Major mode for gdb locals.
 
@@ -2103,6 +2163,8 @@
   (setq mode-name (concat "Locals:" gdb-selected-frame))
   (setq buffer-read-only t)
   (use-local-map gdb-locals-mode-map)
+  (set (make-local-variable 'font-lock-defaults)
+       '(gdb-local-font-lock-keywords))
   (run-mode-hooks 'gdb-locals-mode-hook)
   (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
       'gdb-invalidate-locals