Function: gdb-done-or-error

gdb-done-or-error is a byte-compiled function defined in gdb-mi.el.gz.

Signature

(gdb-done-or-error TOKEN-NUMBER TYPE OUTPUT-FIELD IS-COMPLETE)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdb-done-or-error (token-number type output-field is-complete)
  (if (string-equal token-number "")
      ;; Output from command entered by user
      (progn
	(setq gdb-output-sink 'user)
	(setq token-number nil)
	;; MI error - send to minibuffer
	(when (eq type 'error)
          ;; Skip "msg=" from `output-field'
          (message "%s" (gdb-mi--c-string-from-string
                         (substring output-field 4)))
          ;; Don't send to the console twice.  (If it is a console error
          ;; it is also in the console stream.)
          (setq output-field nil)))
    ;; Output from command from frontend.
    (setq gdb-output-sink 'emacs))

  ;; The process may already be dead (e.g. C-d at the gdb prompt).
  (let* ((proc (get-buffer-process gud-comint-buffer))
	 (no-proc (or (null proc)
		      (memq (process-status proc) '(exit signal)))))

    (when (and is-complete gdb-first-done-or-error)
      (unless (or token-number gud-running no-proc)
	(setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
      (gdb-update no-proc)
      (setq gdb-first-done-or-error nil))

    (setq gdb-filter-output
	  (gdb-concat-output gdb-filter-output output-field))

    ;; We are done concatenating to the output sink.  Restore it to user sink:
    (setq gdb-output-sink 'user)

    (when (and token-number is-complete)
      (with-current-buffer
	  (gdb-get-buffer-create 'gdb-partial-output-buffer)
	(gdb-handle-reply (string-to-number token-number))))

  (when is-complete
    (gdb-clear-partial-output))))