Function: gdbmi-bnf-incomplete-record-result
gdbmi-bnf-incomplete-record-result is a byte-compiled function defined
in gdb-mi.el.gz.
Signature
(gdbmi-bnf-incomplete-record-result TOKEN CLASS-COMMAND)
Documentation
State of the parser used to progressively parse a result-record or async-record rule from an incomplete data stream. The parser will stay in this state until the end of the current result or async record is reached.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdbmi-bnf-incomplete-record-result (token class-command)
"State of the parser used to progressively parse a result-record or async-record
rule from an incomplete data stream. The parser will stay in this state until
the end of the current result or async record is reached."
(when (< gdbmi-bnf-offset (length gud-marker-acc))
;; Search the data stream for the end of the current record:
(let* ((newline-pos (string-search "\n" gud-marker-acc gdbmi-bnf-offset))
(is-progressive (equal (cdr class-command) 'progressive))
(is-complete (not (null newline-pos)))
result-str)
(when gdbmi-debug-mode
(message "gdbmi-bnf-incomplete-record-result: %s"
(substring gud-marker-acc gdbmi-bnf-offset newline-pos)))
;; Update the gdbmi-bnf-offset only if the current chunk of data can
;; be processed by the class-command handler:
(when (or is-complete is-progressive)
(setq result-str
(substring gud-marker-acc gdbmi-bnf-offset newline-pos))
;; Move gdbmi-bnf-offset past the end of the chunk.
(setq gdbmi-bnf-offset (+ gdbmi-bnf-offset (length result-str)))
(when newline-pos
(setq gdbmi-bnf-offset (1+ gdbmi-bnf-offset))))
;; Update the parsing state before invoking the handler in class-command
;; to make sure it's not left in an invalid state if the handler was
;; to generate an error.
(if is-complete
(setq gdbmi-bnf-state 'gdbmi-bnf-output))
(if class-command
(if is-progressive
(funcall (car class-command) token result-str is-complete)
(if is-complete
(funcall (car class-command) token result-str))))
(unless is-complete
;; Incomplete gdb response: abort parsing until we receive more data.
(if gdbmi-debug-mode (message "gdbmi-bnf-incomplete-record-result, aborting: incomplete stream"))
(throw 'gdbmi-incomplete-stream nil))
is-complete)))