emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c803af7: Show returned value after gdb-mi "finish"


From: Eli Zaretskii
Subject: [Emacs-diffs] master c803af7: Show returned value after gdb-mi "finish" command
Date: Fri, 10 Jun 2016 08:57:25 +0000 (UTC)

branch: master
commit c803af788d4140c7253b1d091e6f7fb63b5a214a
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 5ad101d..b2c0614 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]