aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Dzhus2009-07-07 17:40:32 +0000
committerDmitry Dzhus2009-07-07 17:40:32 +0000
commit17c1380b1f7deb7499a6c8df5f398fb245d60e71 (patch)
treebc25952802848470573a5b8bc58386c54844a82d
parentdc6b4519c8789251646686d618b53a3dce2f00ce (diff)
downloademacs-17c1380b1f7deb7499a6c8df5f398fb245d60e71.tar.gz
emacs-17c1380b1f7deb7499a6c8df5f398fb245d60e71.zip
* progmodes/gdb-mi.el (gdb-stack-list-frames-handler): Rewritten
without regexps.
-rw-r--r--lisp/ChangeLog1
-rw-r--r--lisp/progmodes/gdb-mi.el70
2 files changed, 30 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dce1b31e8d9..6dd6c13c325 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -14,6 +14,7 @@
14 end of line, too. 14 end of line, too.
15 (gdb-frame-handler): Match convention to for disassembly buffer 15 (gdb-frame-handler): Match convention to for disassembly buffer
16 mode name. 16 mode name.
17 (gdb-stack-list-frames-handler): Rewritten without regexps.
17 18
18 * progmodes/gdb-mi.el (gdb-init-1): Set mode name for disassembly 19 * progmodes/gdb-mi.el (gdb-init-1): Set mode name for disassembly
19 buffer properly. 20 buffer properly.
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index ca917a02843..21e47b514bb 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2477,10 +2477,11 @@ breakpoints buffer."
2477 'gdb-stack-buffer-name 2477 'gdb-stack-buffer-name
2478 'gdb-frames-mode) 2478 'gdb-frames-mode)
2479 2479
2480(def-gdb-auto-update-trigger gdb-invalidate-frames 2480(def-gdb-auto-updated-buffer gdb-stack-buffer
2481 (gdb-get-buffer 'gdb-stack-buffer) 2481 gdb-invalidate-frames
2482 "-stack-list-frames\n" 2482 "-stack-list-frames\n"
2483 gdb-stack-list-frames-handler) 2483 gdb-stack-list-frames-handler
2484 gdb-stack-list-frames-custom)
2484 2485
2485(defun gdb-insert-frame-location (frame) 2486(defun gdb-insert-frame-location (frame)
2486 "Insert \"of file:line\" button or library name for structure FRAME. 2487 "Insert \"of file:line\" button or library name for structure FRAME.
@@ -2498,45 +2499,32 @@ member."
2498 ;; Library 2499 ;; Library
2499 (from (insert (format " of %s" from)))))) 2500 (from (insert (format " of %s" from))))))
2500 2501
2501(defun gdb-stack-list-frames-handler ()
2502 (setq gdb-pending-triggers (delq 'gdb-invalidate-frames
2503 gdb-pending-triggers))
2504 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
2505 (let* ((res (json-partial-output "frame"))
2506 (stack (gdb-get-field res 'stack))
2507 (buf (gdb-get-buffer 'gdb-stack-buffer)))
2508 (and buf
2509 (with-current-buffer buf
2510 (let ((buffer-read-only nil))
2511 (erase-buffer)
2512 (dolist (frame (nreverse stack))
2513 (insert (apply 'format `("%s in %s" ,@(gdb-get-many-fields frame 'level 'func))))
2514 (gdb-insert-frame-location frame)
2515 (newline))
2516 (gdb-stack-list-frames-custom)))))))
2517
2518(defun gdb-stack-list-frames-custom () 2502(defun gdb-stack-list-frames-custom ()
2519 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) 2503 (let* ((res (json-partial-output "frame"))
2520 (save-excursion 2504 (stack (gdb-get-field res 'stack)))
2521 (let ((buffer-read-only nil)) 2505 (dolist (frame (nreverse stack))
2522 (goto-char (point-min)) 2506 (insert (apply 'format `("%s in %s" ,@(gdb-get-many-fields frame 'level 'func))))
2523 (forward-line 1) 2507 (gdb-insert-frame-location frame)
2524 (while (< (point) (point-max)) 2508 (newline))
2525 (add-text-properties (point-at-bol) (1+ (point-at-bol)) 2509 (save-excursion
2526 '(mouse-face highlight 2510 (goto-char (point-min))
2527 help-echo "mouse-2, RET: Select frame")) 2511 (forward-line 1)
2528 (beginning-of-line) 2512 (while (< (point) (point-max))
2529 (when (and (looking-at "^[0-9]+\\s-+\\S-+\\s-+\\(\\S-+\\)") 2513 (add-text-properties (point-at-bol) (1+ (point-at-bol))
2530 (equal (match-string 1) gdb-selected-frame)) 2514 '(mouse-face highlight
2531 (if (> (car (window-fringes)) 0) 2515 help-echo "mouse-2, RET: Select frame"))
2532 (progn 2516 (beginning-of-line)
2533 (or gdb-stack-position 2517 (when (and (looking-at "^[0-9]+\\s-+\\S-+\\s-+\\(\\S-+\\)")
2534 (setq gdb-stack-position (make-marker))) 2518 (equal (match-string 1) gdb-selected-frame))
2535 (set-marker gdb-stack-position (point))) 2519 (if (> (car (window-fringes)) 0)
2536 (let ((bl (point-at-bol))) 2520 (progn
2537 (put-text-property bl (+ bl 4) 2521 (or gdb-stack-position
2538 'face '(:inverse-video t))))) 2522 (setq gdb-stack-position (make-marker)))
2539 (forward-line 1)))))) 2523 (set-marker gdb-stack-position (point)))
2524 (let ((bl (point-at-bol)))
2525 (put-text-property bl (+ bl 4)
2526 'face '(:inverse-video t)))))
2527 (forward-line 1)))))
2540 2528
2541(defun gdb-stack-buffer-name () 2529(defun gdb-stack-buffer-name ()
2542 (with-current-buffer gud-comint-buffer 2530 (with-current-buffer gud-comint-buffer