;; Reason is available with target-async only
(let* ((result (gdb-json-string output-field))
(reason (bindat-get-field result 'reason))
- (thread-id (bindat-get-field result 'thread-id)))
+ (thread-id (bindat-get-field result 'thread-id))
+ (retval (bindat-get-field result 'return-value))
+ (varnum (bindat-get-field result 'gdb-result-var)))
;; -data-list-register-names needs to be issued for any stopped
;; thread
(if (string-equal reason "exited-normally")
(setq gdb-active-process nil))
+ (when (and retval varnum
+ ;; When the user typed CLI commands, GDB/MI helpfully
+ ;; includes the "Value returned" response in the "~"
+ ;; record; here we avoid displaying it twice.
+ (not (string-match "^Value returned is " gdb-filter-output)))
+ (setq gdb-filter-output
+ (concat gdb-filter-output
+ (format "Value returned is %s = %s\n" varnum retval))))
+
;; Select new current thread.
;; Don't switch if we have no reasons selected