=== modified file 'lisp/progmodes/gdb-mi.el' *** lisp/progmodes/gdb-mi.el 2012-04-20 10:09:40 +0000 --- lisp/progmodes/gdb-mi.el 2012-05-11 06:21:29 +0000 *************** *** 1918,1923 **** --- 1918,1925 ---- (gdb-ignored-notification . "=[-[:alpha:]]+,?\\(.*?\\)\n") (gdb-shell . "\\(\\(?:^.+\n\\)+\\)"))) + (defvar gdb-accumulator nil) + (defun gud-gdbmi-marker-filter (string) "Filter GDB/MI output." *************** *** 1928,1954 **** (> (length gdb-debug-log) gdb-debug-log-max)) (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) ! ;; Recall the left over gud-marker-acc from last time ! (setq gud-marker-acc (concat gud-marker-acc string)) ;; Start accumulating output for the GUD buffer (setq gdb-filter-output "") - (let (output-record-list) ! ;; Process all the complete markers in this chunk. ! (dolist (gdbmi-record gdbmi-record-list) ! (while (string-match (cdr gdbmi-record) gud-marker-acc) ! (push (list (match-beginning 0) ! (car gdbmi-record) ! (match-string 1 gud-marker-acc) ! (match-string 2 gud-marker-acc) ! (match-end 0)) ! output-record-list) ! (setq gud-marker-acc ! (concat (substring gud-marker-acc 0 (match-beginning 0)) ! ;; Pad with spaces to preserve position. ! (make-string (length (match-string 0 gud-marker-acc)) 32) ! (substring gud-marker-acc (match-end 0)))))) (setq output-record-list (sort output-record-list 'gdb-car<)) --- 1930,1960 ---- (> (length gdb-debug-log) gdb-debug-log-max)) (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) ! ;; Recall the left over output from last time ! (unless gdb-accumulator ! (setq gdb-accumulator (get-buffer-create " *gdb output accumulator"))) ! ! (with-current-buffer gdb-accumulator ! (goto-char (point-max)) ! (insert string)) ;; Start accumulating output for the GUD buffer (setq gdb-filter-output "") ! ;; Process all the complete markers in this chunk. ! (let (output-record-list marker) ! (with-current-buffer gdb-accumulator ! (dolist (gdbmi-record gdbmi-record-list) ! (goto-char (point-min)) ! (while (re-search-forward (cdr gdbmi-record) nil t) ! (setq marker (make-marker)) ! (set-marker marker (match-beginning 0)) ! (push (list marker ! (car gdbmi-record) ! (match-string 1) ! (match-string 2)) ! output-record-list) ! (replace-match "\n")))) (setq output-record-list (sort output-record-list 'gdb-car<)) *************** *** 1969,1976 **** (setq gdb-output-sink 'user) ;; Remove padding. ! (string-match "^ *" gud-marker-acc) ! (setq gud-marker-acc (substring gud-marker-acc (match-end 0))) gdb-filter-output)) --- 1975,1984 ---- (setq gdb-output-sink 'user) ;; Remove padding. ! (with-current-buffer gdb-accumulator ! (goto-char (point-min)) ! (while (re-search-forward "^\n" nil t) ! (replace-match ""))) gdb-filter-output))