summaryrefslogtreecommitdiff
path: root/lisp/progmodes/gdb-mi.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/gdb-mi.el')
-rw-r--r--lisp/progmodes/gdb-mi.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 5ad101df7bf..b2c06145187 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2488,7 +2488,9 @@ current thread and update GDB buffers."
;; 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
@@ -2514,6 +2516,15 @@ current thread and update GDB buffers."
(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