]> code.delx.au - gnu-emacs/commitdiff
* progmodes/gdb-mi.el (gdb-stack-list-frames-handler): Rewritten
authorDmitry Dzhus <dima@sphinx.net.ru>
Tue, 7 Jul 2009 17:40:32 +0000 (17:40 +0000)
committerDmitry Dzhus <dima@sphinx.net.ru>
Tue, 7 Jul 2009 17:40:32 +0000 (17:40 +0000)
  without regexps.

lisp/ChangeLog
lisp/progmodes/gdb-mi.el

index dce1b31e8d9a11c957c5095f4360a6fc0d017792..6dd6c13c325b86cbfc1393e327f94d381aef3331 100644 (file)
@@ -14,6 +14,7 @@
        end of line, too.
        (gdb-frame-handler): Match convention to for disassembly buffer
        mode name.
+       (gdb-stack-list-frames-handler): Rewritten without regexps.
 
        * progmodes/gdb-mi.el (gdb-init-1): Set mode name for disassembly
        buffer properly.
index ca917a0284354c9d3202eba49f8359a5028eb2eb..21e47b514bba9c4f16160abb7d4481628acf7cb5 100644 (file)
@@ -2477,10 +2477,11 @@ breakpoints buffer."
                      'gdb-stack-buffer-name
                      'gdb-frames-mode)
 
-(def-gdb-auto-update-trigger gdb-invalidate-frames
-  (gdb-get-buffer 'gdb-stack-buffer)
+(def-gdb-auto-updated-buffer gdb-stack-buffer
+  gdb-invalidate-frames
   "-stack-list-frames\n"
-  gdb-stack-list-frames-handler)
+  gdb-stack-list-frames-handler
+  gdb-stack-list-frames-custom)
 
 (defun gdb-insert-frame-location (frame)
   "Insert \"of file:line\" button or library name for structure FRAME.
@@ -2498,45 +2499,32 @@ member."
           ;; Library
           (from (insert (format " of %s" from))))))
 
-(defun gdb-stack-list-frames-handler ()
-  (setq gdb-pending-triggers (delq 'gdb-invalidate-frames
-                                 gdb-pending-triggers))
-  (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer)
-    (let* ((res (json-partial-output "frame"))
-           (stack (gdb-get-field res 'stack))
-           (buf (gdb-get-buffer 'gdb-stack-buffer)))
-      (and buf 
-           (with-current-buffer buf
-             (let ((buffer-read-only nil))
-               (erase-buffer)
-               (dolist (frame (nreverse stack))
-                 (insert (apply 'format `("%s in %s" ,@(gdb-get-many-fields frame 'level 'func))))
-                 (gdb-insert-frame-location frame)
-                 (newline))
-               (gdb-stack-list-frames-custom)))))))
-
 (defun gdb-stack-list-frames-custom ()
-  (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
-    (save-excursion
-      (let ((buffer-read-only nil))
-       (goto-char (point-min))
-       (forward-line 1)
-       (while (< (point) (point-max))
-         (add-text-properties (point-at-bol) (1+ (point-at-bol))
-                            '(mouse-face highlight
-                              help-echo "mouse-2, RET: Select frame"))
-         (beginning-of-line)
-         (when (and (looking-at "^[0-9]+\\s-+\\S-+\\s-+\\(\\S-+\\)")
-                    (equal (match-string 1) gdb-selected-frame))
-               (if (> (car (window-fringes)) 0)
-                   (progn
-                     (or gdb-stack-position
-                         (setq gdb-stack-position (make-marker)))
-                     (set-marker gdb-stack-position (point)))
-                 (let ((bl (point-at-bol)))
-                   (put-text-property bl (+ bl 4)
-                                      'face '(:inverse-video t)))))
-         (forward-line 1))))))
+  (let* ((res (json-partial-output "frame"))
+         (stack (gdb-get-field res 'stack)))
+         (dolist (frame (nreverse stack))
+           (insert (apply 'format `("%s in %s" ,@(gdb-get-many-fields frame 'level 'func))))
+           (gdb-insert-frame-location frame)
+           (newline))
+         (save-excursion
+           (goto-char (point-min))
+           (forward-line 1)
+           (while (< (point) (point-max))
+             (add-text-properties (point-at-bol) (1+ (point-at-bol))
+                                  '(mouse-face highlight
+                                               help-echo "mouse-2, RET: Select frame"))
+             (beginning-of-line)
+             (when (and (looking-at "^[0-9]+\\s-+\\S-+\\s-+\\(\\S-+\\)")
+                        (equal (match-string 1) gdb-selected-frame))
+               (if (> (car (window-fringes)) 0)
+                   (progn
+                     (or gdb-stack-position
+                         (setq gdb-stack-position (make-marker)))
+                     (set-marker gdb-stack-position (point)))
+                 (let ((bl (point-at-bol)))
+                   (put-text-property bl (+ bl 4)
+                                      'face '(:inverse-video t)))))
+             (forward-line 1)))))
 
 (defun gdb-stack-buffer-name ()
   (with-current-buffer gud-comint-buffer