comparison lisp/progmodes/gdb-ui.el @ 79036:ef2bf5b448b2

(gdb-info-stack-custom): Ensure current frame is visible.
author Nick Roberts <nickrob@snap.net.nz>
date Thu, 11 Oct 2007 04:23:29 +0000
parents 47523d623a1c
children 9963a1e6e29f 591c29778a30
comparison
equal deleted inserted replaced
79035:aeeb4d5072f5 79036:ef2bf5b448b2
2118 gdb-info-stack-handler 2118 gdb-info-stack-handler
2119 gdb-info-stack-custom) 2119 gdb-info-stack-custom)
2120 2120
2121 (defun gdb-info-stack-custom () 2121 (defun gdb-info-stack-custom ()
2122 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) 2122 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
2123 (save-excursion 2123 (let (move-to)
2124 (unless (eq gdb-look-up-stack 'delete) 2124 (save-excursion
2125 (let ((buffer-read-only nil) 2125 (unless (eq gdb-look-up-stack 'delete)
2126 bl el) 2126 (let ((buffer-read-only nil)
2127 bl el)
2128 (goto-char (point-min))
2129 (while (< (point) (point-max))
2130 (setq bl (line-beginning-position)
2131 el (line-end-position))
2132 (when (looking-at "#")
2133 (add-text-properties bl el
2134 '(mouse-face highlight
2135 help-echo "mouse-2, RET: Select frame")))
2136 (goto-char bl)
2137 (when (looking-at "^#\\([0-9]+\\)")
2138 (when (string-equal (match-string 1) gdb-frame-number)
2139 (if (> (car (window-fringes)) 0)
2140 (progn
2141 (or gdb-stack-position
2142 (setq gdb-stack-position (make-marker)))
2143 (set-marker gdb-stack-position (point))
2144 (setq move-to gdb-stack-position))
2145 (put-text-property bl (+ bl 4)
2146 'face '(:inverse-video t))
2147 (setq move-to bl)))
2148 (when (re-search-forward
2149 (concat
2150 (if (string-equal (match-string 1) "0") "" " in ")
2151 "\\([^ ]+\\) (") el t)
2152 (put-text-property (match-beginning 1) (match-end 1)
2153 'face font-lock-function-name-face)
2154 (setq bl (match-end 0))
2155 (while (re-search-forward "<\\([^>]+\\)>" el t)
2156 (put-text-property (match-beginning 1) (match-end 1)
2157 'face font-lock-function-name-face))
2158 (goto-char bl)
2159 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
2160 (put-text-property (match-beginning 1) (match-end 1)
2161 'face font-lock-variable-name-face))))
2162 (forward-line 1))
2163 (forward-line -1)
2164 (when (looking-at "(More stack frames follow...)")
2165 (add-text-properties (match-beginning 0) (match-end 0)
2166 '(mouse-face highlight
2167 gdb-max-frames t
2168 help-echo
2169 "mouse-2, RET: customize gdb-max-frames to see more frames")))))
2170 (when gdb-look-up-stack
2127 (goto-char (point-min)) 2171 (goto-char (point-min))
2128 (while (< (point) (point-max)) 2172 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
2129 (setq bl (line-beginning-position) 2173 (let ((start (line-beginning-position))
2130 el (line-end-position)) 2174 (file (match-string 1))
2131 (when (looking-at "#") 2175 (line (match-string 2)))
2132 (add-text-properties bl el 2176 (re-search-backward "^#*\\([0-9]+\\)" start t)
2133 '(mouse-face highlight 2177 (gdb-enqueue-input
2134 help-echo "mouse-2, RET: Select frame"))) 2178 (list (concat gdb-server-prefix "frame "
2135 (goto-char bl) 2179 (match-string 1) "\n") 'gdb-set-hollow))
2136 (when (looking-at "^#\\([0-9]+\\)") 2180 (gdb-enqueue-input
2137 (when (string-equal (match-string 1) gdb-frame-number) 2181 (list (concat gdb-server-prefix "frame 0\n") 'ignore))))))
2138 (if (> (car (window-fringes)) 0) 2182 (when move-to
2139 (progn 2183 (let ((window (get-buffer-window (current-buffer) 0)))
2140 (or gdb-stack-position 2184 (when window
2141 (setq gdb-stack-position (make-marker))) 2185 (with-selected-window window
2142 (set-marker gdb-stack-position (point))) 2186 (goto-char move-to)
2143 (put-text-property bl (+ bl 4) 2187 (unless (pos-visible-in-window-p)
2144 'face '(:inverse-video t)))) 2188 (recenter '(center)))))))))
2145 (when (re-search-forward
2146 (concat
2147 (if (string-equal (match-string 1) "0") "" " in ")
2148 "\\([^ ]+\\) (") el t)
2149 (put-text-property (match-beginning 1) (match-end 1)
2150 'face font-lock-function-name-face)
2151 (setq bl (match-end 0))
2152 (while (re-search-forward "<\\([^>]+\\)>" el t)
2153 (put-text-property (match-beginning 1) (match-end 1)
2154 'face font-lock-function-name-face))
2155 (goto-char bl)
2156 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
2157 (put-text-property (match-beginning 1) (match-end 1)
2158 'face font-lock-variable-name-face))))
2159 (forward-line 1))
2160 (forward-line -1)
2161 (when (looking-at "(More stack frames follow...)")
2162 (add-text-properties (match-beginning 0) (match-end 0)
2163 '(mouse-face highlight
2164 gdb-max-frames t
2165 help-echo
2166 "mouse-2, RET: customize gdb-max-frames to see more frames")))))
2167 (when gdb-look-up-stack
2168 (goto-char (point-min))
2169 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
2170 (let ((start (line-beginning-position))
2171 (file (match-string 1))
2172 (line (match-string 2)))
2173 (re-search-backward "^#*\\([0-9]+\\)" start t)
2174 (gdb-enqueue-input
2175 (list (concat gdb-server-prefix "frame "
2176 (match-string 1) "\n") 'gdb-set-hollow))
2177 (gdb-enqueue-input
2178 (list (concat gdb-server-prefix "frame 0\n") 'ignore)))))))
2179 (if (eq gdb-look-up-stack 'delete) 2189 (if (eq gdb-look-up-stack 'delete)
2180 (kill-buffer (gdb-get-buffer 'gdb-stack-buffer))) 2190 (kill-buffer (gdb-get-buffer 'gdb-stack-buffer)))
2181 (setq gdb-look-up-stack nil)) 2191 (setq gdb-look-up-stack nil))
2182 2192
2183 (defun gdb-set-hollow () 2193 (defun gdb-set-hollow ()