Function: gdb-thread-selected

gdb-thread-selected is a byte-compiled function defined in gdb-mi.el.gz.

Signature

(gdb-thread-selected TOKEN OUTPUT-FIELD)

Documentation

Handler for =thread-selected MI output record.

Sets gdb-thread-number to new id.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/gdb-mi.el.gz
(defun gdb-thread-selected (_token output-field)
  "Handler for =thread-selected MI output record.

Sets `gdb-thread-number' to new id."
  (let* ((result (gdb-mi--from-string output-field))
         (thread-id (gdb-mi--field result 'id)))
    (gdb-setq-thread-number thread-id)
    ;; Typing `thread N' in GUD buffer makes GDB emit `^done' followed
    ;; by `=thread-selected' notification. `^done' causes `gdb-update'
    ;; as usually. Things happen too fast and second call (from
    ;; gdb-thread-selected handler) gets cut off by our beloved
    ;; pending triggers.
    ;; Solution is `gdb-wait-for-pending': it guarantees that its
    ;; argument will get called when `gdb-handler-list' if free of
    ;; pending triggers.
    (gdb-wait-for-pending #'gdb-update)))