From c803af788d4140c7253b1d091e6f7fb63b5a214a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 10 Jun 2016 11:57:17 +0300 Subject: [PATCH] Show returned value after gdb-mi "finish" command * lisp/progmodes/gdb-mi.el (gdb-stopped): Display the expected "Value returned" message in response to "finish", when not produced by GDB/MI. (Bug#23720) --- lisp/progmodes/gdb-mi.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- 2.39.2