summaryrefslogtreecommitdiff
path: root/lisp/progmodes/gdb-ui.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-10-07 07:15:40 +0000
committerMiles Bader <miles@gnu.org>2005-10-07 07:15:40 +0000
commit00e18f33adde1d2f196fdf9cadf11235cc4fcc8f (patch)
tree8c553c9a361da158ba47f3d0ed0429da180d957f /lisp/progmodes/gdb-ui.el
parentba4c328314c2b01e6dcc3807a0666a644c3f3954 (diff)
parent9e1cb4bc96d36af6e8b893d467970a25afead03b (diff)
downloademacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.tar.gz
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-88
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 569-579) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 129-132) - Update from CVS - Merge from emacs--cvs-trunk--0
Diffstat (limited to 'lisp/progmodes/gdb-ui.el')
-rw-r--r--lisp/progmodes/gdb-ui.el97
1 files changed, 84 insertions, 13 deletions
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 6c960c4c5d5..fe05119d2cd 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -103,6 +103,7 @@ and #define directives otherwise.")
(defvar gdb-error "Non-nil when GDB is reporting an error.")
(defvar gdb-macro-info nil
"Non-nil if GDB knows that the inferior includes preprocessor macro info.")
+(defvar gdb-buffer-fringe-width nil)
(defvar gdb-buffer-type nil
"One of the symbols bound in `gdb-buffer-rules'.")
@@ -377,7 +378,8 @@ Also display the main routine in the disassembly buffer if present."
gdb-location-alist nil
gdb-find-file-unhook nil
gdb-error nil
- gdb-macro-info nil)
+ gdb-macro-info nil
+ gdb-buffer-fringe-width (car (window-fringes)))
;;
(setq gdb-buffer-type 'gdba)
;;
@@ -1337,8 +1339,11 @@ static char *magick[] = {
(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 +1536,34 @@ static char *magick[] = {
(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]+\\)")
+ (when (string-equal (match-string 1) gdb-frame-number)
+ (put-text-property bl (+ bl 4)
+ 'face '(:inverse-video t)))
+ (when (re-search-forward
+ (concat
+ (if (string-equal (match-string 1) "0") "" " 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 ()
@@ -1587,6 +1609,7 @@ static char *magick[] = {
(defun gdb-get-frame-number ()
(save-excursion
+ (end-of-line)
(let* ((pos (re-search-backward "^#*\\([0-9]*\\)" nil t))
(n (or (and pos (match-string-no-properties 1)) "0")))
n)))
@@ -1648,6 +1671,14 @@ static char *magick[] = {
(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 +1688,8 @@ static char *magick[] = {
(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 +1735,12 @@ static char *magick[] = {
(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 +1750,8 @@ static char *magick[] = {
(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 +1996,12 @@ corresponding to the mode line clicked."
(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 +2073,8 @@ corresponding to the mode line clicked."
'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 +2143,23 @@ corresponding to the mode line clicked."
(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 +2169,8 @@ corresponding to the mode line clicked."
(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
@@ -2408,7 +2476,8 @@ BUFFER nil or omitted means use the current buffer."
(defun gdb-put-breakpoint-icon (enabled bptno)
(let ((start (- (line-beginning-position) 1))
(end (+ (line-end-position) 1))
- (putstring (if enabled "B" "b")))
+ (putstring (if enabled "B" "b"))
+ (source-window (get-buffer-window (current-buffer) 0)))
(add-text-properties
0 1 '(help-echo "mouse-1: set/clear bkpt, mouse-3: enable/disable bkpt")
putstring)
@@ -2418,7 +2487,9 @@ BUFFER nil or omitted means use the current buffer."
0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring))
(gdb-remove-breakpoint-icons start end)
(if (display-images-p)
- (if (>= (car (window-fringes)) 8)
+ (if (>= (or left-fringe-width
+ (if source-window (car (window-fringes source-window)))
+ gdb-buffer-fringe-width) 8)
(gdb-put-string
nil (1+ start)
`(left-fringe breakpoint
@@ -2428,9 +2499,9 @@ BUFFER nil or omitted means use the current buffer."
(when (< left-margin-width 2)
(save-current-buffer
(setq left-margin-width 2)
- (if (get-buffer-window (current-buffer) 0)
+ (if source-window
(set-window-margins
- (get-buffer-window (current-buffer) 0)
+ source-window
left-margin-width right-margin-width))))
(put-image
(if enabled