Function: gdbmi-bnf-skip-unrecognized

gdbmi-bnf-skip-unrecognized is a byte-compiled function defined in gdb-mi.el.gz.

Signature

(gdbmi-bnf-skip-unrecognized)

Documentation

Skip characters until is encounters the beginning of a valid record.

Used as a protection mechanism in case something goes wrong when parsing a GDB/MI reply message.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdbmi-bnf-skip-unrecognized ()
  "Skip characters until is encounters the beginning of a valid record.
Used as a protection mechanism in case something goes wrong when parsing
a GDB/MI reply message."
  (let ((acc-length (length gud-marker-acc))
	(prefix-offset gdbmi-bnf-offset)
	(prompt "(gdb) \n"))

    (while (and (< prefix-offset acc-length)
                (gdbmi-is-number (aref gud-marker-acc prefix-offset)))
      (setq prefix-offset (1+ prefix-offset)))

    (if (and (< prefix-offset acc-length)
             (not (memq (aref gud-marker-acc prefix-offset)
                        '(?^ ?* ?+ ?= ?~ ?@ ?&)))
             (not (gdbmi-same-start gud-marker-acc gdbmi-bnf-offset prompt))
             (string-match "\\([^^*+=~@&]+\\)" gud-marker-acc
                           gdbmi-bnf-offset))
        (let ((unrecognized-str (match-string 0 gud-marker-acc)))
          (setq gdbmi-bnf-offset (match-end 0))
	  (if gdbmi-debug-mode
              (message "gdbmi-bnf-skip-unrecognized: %s" unrecognized-str))
          (gdb-shell unrecognized-str)
	  t))))