aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2003-05-17 10:17:57 +0000
committerNick Roberts2003-05-17 10:17:57 +0000
commit3b623bffe2b4fffeabc0479acc2e0551d56d3582 (patch)
treed43154bccdfc69f401601d4b51ffec0436b3a995
parent886cad76751629b5ed7e9abf4d4e30962cfbd715 (diff)
downloademacs-3b623bffe2b4fffeabc0479acc2e0551d56d3582.tar.gz
emacs-3b623bffe2b4fffeabc0479acc2e0551d56d3582.zip
(gdb-info-frames-custom): Reverse contrast of face for
selected frame. (gdb-annotation-rules): Stop using frames-invalid and breakpoints-invalid annotations. Update after post-prompt instead. (gdb-post-prompt): Update frames and breakpoints here. (gdb-invalidate-frame-and-assembler) (gdb-invalidate-breakpoints-and-assembler): Remove. (gdb-current-address): Remove. (gdb-previous-address): New variable. (gud-until): Extend to work in Assembler buffer (gdb-append-to-inferior-io): Select IO buffer when there is output. (gdb-assembler-custom): Try to get line marker (arrow) to display in window. Correct parsing for OS dependent output syntax of Gdb command, where. (gdb-frame-handler): Correct parsing for OS dependent output syntax of Gdb command, frame. (gdb-invalidate-assembler): Update assembler buffer correctly when frame changes (revisited).
-rw-r--r--lisp/gdb-ui.el188
1 files changed, 104 insertions, 84 deletions
diff --git a/lisp/gdb-ui.el b/lisp/gdb-ui.el
index 4ebd4ad4364..60310f071c9 100644
--- a/lisp/gdb-ui.el
+++ b/lisp/gdb-ui.el
@@ -58,8 +58,8 @@
58 :type 'integer 58 :type 'integer
59 :group 'gud) 59 :group 'gud)
60 60
61(defvar gdb-main-or-pc nil "Initialisation for Assembler buffer.") 61(defvar gdb-current-address nil "Initialisation for Assembler buffer.")
62(defvar gdb-current-address nil) 62(defvar gdb-previous-address nil)
63(defvar gdb-display-in-progress nil) 63(defvar gdb-display-in-progress nil)
64(defvar gdb-dive nil) 64(defvar gdb-dive nil)
65(defvar gdb-buffer-type nil) 65(defvar gdb-buffer-type nil)
@@ -143,11 +143,19 @@ The following interactive lisp functions help control operation :
143 (gud-call "clear *%a" arg))) 143 (gud-call "clear *%a" arg)))
144 "\C-d" "Remove breakpoint at current line or address.") 144 "\C-d" "Remove breakpoint at current line or address.")
145 ;; 145 ;;
146 (gud-def gud-until (if (not (string-equal mode-name "Assembler"))
147 (gud-call "until %f:%l" arg)
148 (save-excursion
149 (beginning-of-line)
150 (forward-char 2)
151 (gud-call "until *%a" arg)))
152 "\C-u" "Continue up to current line or address.")
153
146 (setq comint-input-sender 'gdb-send) 154 (setq comint-input-sender 'gdb-send)
147 ;; 155 ;;
148 ;; (re-)initialise 156 ;; (re-)initialise
149 (setq gdb-main-or-pc "main") 157 (setq gdb-current-address "main")
150 (setq gdb-current-address nil) 158 (setq gdb-previous-address nil)
151 (setq gdb-display-in-progress nil) 159 (setq gdb-display-in-progress nil)
152 (setq gdb-dive nil) 160 (setq gdb-dive nil)
153 ;; 161 ;;
@@ -508,9 +516,7 @@ This filter may simply queue output for a later time."
508 :group 'gud) 516 :group 'gud)
509 517
510(defvar gdb-annotation-rules 518(defvar gdb-annotation-rules
511 '(("frames-invalid" gdb-invalidate-frame-and-assembler) 519 '(("pre-prompt" gdb-pre-prompt)
512 ("breakpoints-invalid" gdb-invalidate-breakpoints-and-assembler)
513 ("pre-prompt" gdb-pre-prompt)
514 ("prompt" gdb-prompt) 520 ("prompt" gdb-prompt)
515 ("commands" gdb-subprompt) 521 ("commands" gdb-subprompt)
516 ("overload-choice" gdb-subprompt) 522 ("overload-choice" gdb-subprompt)
@@ -524,7 +530,7 @@ This filter may simply queue output for a later time."
524 ("signal" gdb-stopping) 530 ("signal" gdb-stopping)
525 ("breakpoint" gdb-stopping) 531 ("breakpoint" gdb-stopping)
526 ("watchpoint" gdb-stopping) 532 ("watchpoint" gdb-stopping)
527; ("frame-begin" gdb-frame-begin) 533 ("frame-begin" gdb-frame-begin)
528 ("stopped" gdb-stopped) 534 ("stopped" gdb-stopped)
529 ("display-begin" gdb-display-begin) 535 ("display-begin" gdb-display-begin)
530 ("display-end" gdb-display-end) 536 ("display-end" gdb-display-end)
@@ -555,7 +561,6 @@ This filter may simply queue output for a later time."
555 (match-string 1 args) 561 (match-string 1 args)
556 (string-to-int (match-string 2 args)))) 562 (string-to-int (match-string 2 args))))
557 (setq gdb-current-address (match-string 3 args)) 563 (setq gdb-current-address (match-string 3 args))
558 (setq gdb-main-or-pc gdb-current-address)
559 ;;update with new frame for machine code if necessary 564 ;;update with new frame for machine code if necessary
560 (gdb-invalidate-assembler)) 565 (gdb-invalidate-assembler))
561 566
@@ -663,9 +668,12 @@ output from the current command if that happens to be appropriate."
663 (if (not (gdb-get-pending-triggers)) 668 (if (not (gdb-get-pending-triggers))
664 (progn 669 (progn
665 (gdb-get-current-frame) 670 (gdb-get-current-frame)
666 (gdb-invalidate-registers ignored) 671 (gdb-invalidate-frames)
667 (gdb-invalidate-locals ignored) 672 (gdb-invalidate-breakpoints)
668 (gdb-invalidate-display ignored) 673 (gdb-invalidate-assembler)
674 (gdb-invalidate-registers)
675 (gdb-invalidate-locals)
676 (gdb-invalidate-display)
669 (gdb-invalidate-threads))) 677 (gdb-invalidate-threads)))
670 (let ((sink (gdb-get-output-sink))) 678 (let ((sink (gdb-get-output-sink)))
671 (cond 679 (cond
@@ -1160,8 +1168,8 @@ output from the current command if that happens to be appropriate."
1160 (goto-char (point-max)) 1168 (goto-char (point-max))
1161 (insert-before-markers string)) 1169 (insert-before-markers string))
1162 (if (not (string-equal string "")) 1170 (if (not (string-equal string ""))
1163 (gdb-display-buffer 1171 (select-window
1164 (gdb-get-create-buffer 'gdb-inferior-io)))) 1172 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io)))))
1165 1173
1166(defun gdb-clear-inferior-io () 1174(defun gdb-clear-inferior-io ()
1167 (save-excursion 1175 (save-excursion
@@ -1351,8 +1359,8 @@ static char *magick[] = {
1351 (forward-line 1) 1359 (forward-line 1)
1352 (if (looking-at "[^\t].*breakpoint") 1360 (if (looking-at "[^\t].*breakpoint")
1353 (progn 1361 (progn
1354 (looking-at "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)") 1362 (looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)")
1355 (setq flag (char-after (match-beginning 2))) 1363 (setq flag (char-after (match-beginning 1)))
1356 (beginning-of-line) 1364 (beginning-of-line)
1357 (if (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) 1365 (if (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
1358 (progn 1366 (progn
@@ -1512,13 +1520,23 @@ current line."
1512(defun gdb-info-frames-custom () 1520(defun gdb-info-frames-custom ()
1513 (save-excursion 1521 (save-excursion
1514 (set-buffer (gdb-get-buffer 'gdb-stack-buffer)) 1522 (set-buffer (gdb-get-buffer 'gdb-stack-buffer))
1515 (let ((buffer-read-only nil)) 1523 (save-excursion
1516 (goto-char (point-min)) 1524 (let ((buffer-read-only nil))
1517 (while (< (point) (point-max)) 1525 (goto-char (point-min))
1518 (put-text-property (progn (beginning-of-line) (point)) 1526 (while (< (point) (point-max))
1519 (progn (end-of-line) (point)) 1527 (put-text-property (progn (beginning-of-line) (point))
1520 'mouse-face 'highlight) 1528 (progn (end-of-line) (point))
1521 (forward-line 1))))) 1529 'mouse-face 'highlight)
1530 (beginning-of-line)
1531 (if (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)")
1532 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)"))
1533 (if (equal (match-string 1) gdb-current-frame)
1534 (put-text-property (progn (beginning-of-line) (point))
1535 (progn (end-of-line) (point))
1536 'face
1537 `(:background ,(face-attribute 'default :foreground)
1538 :foreground ,(face-attribute 'default :background)))))
1539 (forward-line 1))))))
1522 1540
1523(defun gdb-stack-buffer-name () 1541(defun gdb-stack-buffer-name ()
1524 (with-current-buffer gud-comint-buffer 1542 (with-current-buffer gud-comint-buffer
@@ -1549,6 +1567,7 @@ current line."
1549 (setq mode-name "Frames") 1567 (setq mode-name "Frames")
1550 (setq buffer-read-only t) 1568 (setq buffer-read-only t)
1551 (use-local-map gdb-frames-mode-map) 1569 (use-local-map gdb-frames-mode-map)
1570 (font-lock-mode -1)
1552 (gdb-invalidate-frames)) 1571 (gdb-invalidate-frames))
1553 1572
1554(defun gdb-get-frame-number () 1573(defun gdb-get-frame-number ()
@@ -2214,29 +2233,28 @@ BUFFER nil or omitted means use the current buffer."
2214 2233
2215(def-gdb-auto-updated-buffer gdb-assembler-buffer 2234(def-gdb-auto-updated-buffer gdb-assembler-buffer
2216 gdb-invalidate-assembler 2235 gdb-invalidate-assembler
2217 (concat "server disassemble " gdb-main-or-pc "\n") 2236 (concat "server disassemble " gdb-current-address "\n")
2218 gdb-assembler-handler 2237 gdb-assembler-handler
2219 gdb-assembler-custom) 2238 gdb-assembler-custom)
2220 2239
2221(defun gdb-assembler-custom () 2240(defun gdb-assembler-custom ()
2222 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer)) 2241 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
2223 (gdb-arrow-position) (address) (flag)) 2242 (address) (flag))
2224 (if gdb-current-address
2225 (progn
2226 (save-excursion
2227 (set-buffer buffer)
2228 (remove-arrow)
2229 (goto-char (point-min))
2230 (re-search-forward gdb-current-address)
2231 (setq gdb-arrow-position (point))
2232 (put-arrow "=>" gdb-arrow-position nil 'left-margin))))
2233 ;; remove all breakpoint-icons in assembler buffer before updating.
2234 (save-excursion 2243 (save-excursion
2235 (set-buffer buffer) 2244 (set-buffer buffer)
2236 (if (display-graphic-p) 2245 (if (not (equal gdb-current-address "main"))
2237 (remove-images (point-min) (point-max)) 2246 (progn
2238 (remove-strings (point-min) (point-max)))) 2247 (remove-arrow)
2239 (save-excursion 2248 (goto-char (point-min))
2249 (if (re-search-forward gdb-current-address nil t)
2250 (progn
2251 (put-arrow "=>" (point) nil 'left-margin)
2252 (set-window-point gdb-source-window (point))))))
2253 ;; remove all breakpoint-icons in assembler buffer before updating.
2254 (save-excursion
2255 (if (display-graphic-p)
2256 (remove-images (point-min) (point-max))
2257 (remove-strings (point-min) (point-max))))
2240 (set-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)) 2258 (set-buffer (gdb-get-buffer 'gdb-breakpoints-buffer))
2241 (goto-char (point-min)) 2259 (goto-char (point-min))
2242 (while (< (point) (- (point-max) 1)) 2260 (while (< (point) (- (point-max) 1))
@@ -2244,33 +2262,35 @@ BUFFER nil or omitted means use the current buffer."
2244 (if (looking-at "[^\t].*breakpoint") 2262 (if (looking-at "[^\t].*breakpoint")
2245 (progn 2263 (progn
2246 (looking-at 2264 (looking-at
2247 "\\([0-9]*\\)\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x0\\(\\S-*\\)") 2265 "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)")
2248 ;; info break gives '0x0' (8 digit) while dump gives '0x' (7 digit) 2266 (setq flag (char-after (match-beginning 1)))
2249 (setq address (concat "0x" (match-string 3))) 2267 (let ((number (match-string 2)))
2250 (setq flag (char-after (match-beginning 2))) 2268 ;; remove leading 0s from output of info break.
2269 (if (string-match "0x0+\\(.*\\)" number)
2270 (setq address (concat "0x" (match-string 1 address)))
2271 (setq address number)))
2251 (save-excursion 2272 (save-excursion
2252 (set-buffer buffer) 2273 (set-buffer buffer)
2253 (goto-char (point-min)) 2274 (save-excursion
2254 (if (re-search-forward address nil t) 2275 (goto-char (point-min))
2255 (let ((start (progn (beginning-of-line) (- (point) 1))) 2276 (if (re-search-forward address nil t)
2256 (end (progn (end-of-line) (+ (point) 1)))) 2277 (let ((start (progn (beginning-of-line) (- (point) 1)))
2257 (if (display-graphic-p) 2278 (end (progn (end-of-line) (+ (point) 1))))
2258 (progn 2279 (if (display-graphic-p)
2259 (remove-images start end) 2280 (progn
2260 (if (eq ?y flag) 2281 (remove-images start end)
2261 (put-image breakpoint-enabled-icon (point) 2282 (if (eq ?y flag)
2262 "breakpoint icon enabled" 2283 (put-image breakpoint-enabled-icon (point)
2263 'left-margin) 2284 "breakpoint icon enabled"
2264 (put-image breakpoint-disabled-icon (point) 2285 'left-margin)
2265 "breakpoint icon disabled" 2286 (put-image breakpoint-disabled-icon (point)
2266 'left-margin))) 2287 "breakpoint icon disabled"
2267 (remove-strings start end) 2288 'left-margin)))
2268 (if (eq ?y flag) 2289 (remove-strings start end)
2269 (put-string "B" (point) "enabled" 'left-margin) 2290 (if (eq ?y flag)
2270 (put-string "b" (point) "disabled" 2291 (put-string "B" (point) "enabled" 'left-margin)
2271 'left-margin)))))))))) 2292 (put-string "b" (point) "disabled"
2272 (if gdb-current-address 2293 'left-margin)))))))))))))
2273 (set-window-point (get-buffer-window buffer) gdb-arrow-position))))
2274 2294
2275(defvar gdb-assembler-mode-map 2295(defvar gdb-assembler-mode-map
2276 (let ((map (make-sparse-keymap))) 2296 (let ((map (make-sparse-keymap)))
@@ -2303,40 +2323,29 @@ BUFFER nil or omitted means use the current buffer."
2303 (switch-to-buffer-other-frame 2323 (switch-to-buffer-other-frame
2304 (gdb-get-create-buffer 'gdb-assembler-buffer))) 2324 (gdb-get-create-buffer 'gdb-assembler-buffer)))
2305 2325
2306(defun gdb-invalidate-frame-and-assembler (&optional ignored) 2326;; modified because if gdb-current-address has changed value a new command
2307 (gdb-invalidate-frames)
2308 (gdb-invalidate-assembler))
2309
2310(defun gdb-invalidate-breakpoints-and-assembler (&optional ignored)
2311 (gdb-invalidate-breakpoints)
2312 (gdb-invalidate-assembler))
2313
2314(defvar gdb-prev-main-or-pc nil)
2315
2316;; modified because if gdb-main-or-pc has changed value a new command
2317;; must be enqueued to update the buffer with the new output 2327;; must be enqueued to update the buffer with the new output
2318(defun gdb-invalidate-assembler (&optional ignored) 2328(defun gdb-invalidate-assembler (&optional ignored)
2319 (if (and (gdb-get-buffer 'gdb-assembler-buffer) 2329 (if (and (gdb-get-buffer 'gdb-assembler-buffer)
2320 (or (not (member 'gdb-invalidate-assembler 2330 (or (not (member 'gdb-invalidate-assembler
2321 (gdb-get-pending-triggers))) 2331 (gdb-get-pending-triggers)))
2322 (not (string-equal gdb-main-or-pc gdb-prev-main-or-pc)))) 2332 (not (string-equal gdb-current-address gdb-previous-address))))
2323 (progn 2333 (progn
2324 ;; take previous disassemble command off the queue 2334 ;; take previous disassemble command off the queue
2325 (save-excursion 2335 (save-excursion
2326 (set-buffer gud-comint-buffer) 2336 (set-buffer gud-comint-buffer)
2327 (let ((queue gdb-idle-input-queue) (item)) 2337 (let ((queue (gdb-get-idle-input-queue)) (item))
2328 (dolist (item queue) 2338 (dolist (item queue)
2329 (setq item (car queue))
2330 (if (equal (cdr item) '(gdb-assembler-handler)) 2339 (if (equal (cdr item) '(gdb-assembler-handler))
2331 (setq gdb-idle-input-queue 2340 (gdb-set-idle-input-queue
2332 (delete item gdb-idle-input-queue)))))) 2341 (delete item (gdb-get-idle-input-queue)))))))
2333 (gdb-enqueue-idle-input 2342 (gdb-enqueue-idle-input
2334 (list (concat "server disassemble " gdb-main-or-pc "\n") 2343 (list (concat "server disassemble " gdb-current-address "\n")
2335 'gdb-assembler-handler)) 2344 'gdb-assembler-handler))
2336 (gdb-set-pending-triggers 2345 (gdb-set-pending-triggers
2337 (cons 'gdb-invalidate-assembler 2346 (cons 'gdb-invalidate-assembler
2338 (gdb-get-pending-triggers))) 2347 (gdb-get-pending-triggers)))
2339 (setq gdb-prev-main-or-pc gdb-main-or-pc)))) 2348 (setq gdb-previous-address gdb-current-address))))
2340 2349
2341(defun gdb-get-current-frame () 2350(defun gdb-get-current-frame ()
2342 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers))) 2351 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers)))
@@ -2353,8 +2362,19 @@ BUFFER nil or omitted means use the current buffer."
2353 (save-excursion 2362 (save-excursion
2354 (set-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)) 2363 (set-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer))
2355 (goto-char (point-min)) 2364 (goto-char (point-min))
2356 (if (looking-at "^#[0-9]*\\s-*0x\\S-* in \\(\\S-*\\)") 2365 (if (looking-at "^#[0-9]*\\s-*\\(\\S-*\\) in \\(\\S-*\\)")
2357 (setq gdb-current-frame (match-string 1)) 2366 (progn
2367 (setq gdb-current-frame (match-string 2))
2368 (let ((address (match-string 1)))
2369 ;; remove leading 0s from output of frame command.
2370 (if (string-match "0x0+\\(.*\\)" address)
2371 (setq gdb-current-address (concat "0x" (match-string 1 address)))
2372 (setq gdb-current-address address)))
2373 (if (not (looking-at ".*) at "))
2374 (progn
2375 (set-window-buffer gdb-source-window
2376 (gdb-get-create-buffer 'gdb-assembler-buffer))
2377 (gdb-invalidate-assembler))))
2358 (if (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)") 2378 (if (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)")
2359 (setq gdb-current-frame (match-string 1)))))) 2379 (setq gdb-current-frame (match-string 1))))))
2360 2380