Function: gud-pdb-marker-filter
gud-pdb-marker-filter is a byte-compiled function defined in
gud.el.gz.
Signature
(gud-pdb-marker-filter STRING)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/gud.el.gz
;; There's no guarantee that Emacs will hand the filter the entire
;; marker at once; it could be broken up across several strings. We
;; might even receive a big chunk with several markers in it. If we
;; receive a chunk of text which looks like it might contain the
;; beginning of a marker, we save it here between calls to the
;; filter.
(defun gud-pdb-marker-filter (string)
(setq gud-marker-acc (concat gud-marker-acc string))
(let ((output ""))
;; Process all the complete markers in this chunk.
(while (string-match gud-pdb-marker-regexp gud-marker-acc)
(setq
;; Extract the frame position from the marker.
gud-last-frame
(let ((file (match-string gud-pdb-marker-regexp-file-group
gud-marker-acc))
(line (string-to-number
(match-string gud-pdb-marker-regexp-line-group
gud-marker-acc))))
(if (string-equal file "<string>")
gud-last-frame
(cons file line)))
;; Output everything instead of the below
output (concat output (substring gud-marker-acc 0 (match-end 0)))
;; ;; Append any text before the marker to the output we're going
;; ;; to return - we don't include the marker in this text.
;; output (concat output
;; (substring gud-marker-acc 0 (match-beginning 0)))
;; Set the accumulator to the remaining text.
gud-marker-acc (substring gud-marker-acc (match-end 0))))
;; Does the remaining text look like it might end with the
;; beginning of another marker? If it does, then keep it in
;; gud-marker-acc until we receive the rest of it. Since we
;; know the full marker regexp above failed, it's pretty simple to
;; test for marker starts.
(if (string-match gud-pdb-marker-regexp-start gud-marker-acc)
(progn
;; Everything before the potential marker start can be output.
(setq output (concat output (substring gud-marker-acc
0 (match-beginning 0))))
;; Everything after, we save, to combine with later input.
(setq gud-marker-acc
(substring gud-marker-acc (match-beginning 0))))
(setq output (concat output gud-marker-acc)
gud-marker-acc ""))
output))