emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/inspector 1bbbfb6a29: inspector-inspect-debugger-return


From: ELPA Syncer
Subject: [elpa] externals/inspector 1bbbfb6a29: inspector-inspect-debugger-return-value
Date: Tue, 17 Jan 2023 07:57:49 -0500 (EST)

branch: externals/inspector
commit 1bbbfb6a291e8dbc607a8292a0647570352b30a3
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>

    inspector-inspect-debugger-return-value
    
    Command for inspecting the return value in the debugger, when debugger is
    in the correct state.
---
 inspector.el | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/inspector.el b/inspector.el
index 27638a5299..5b26ecb953 100644
--- a/inspector.el
+++ b/inspector.el
@@ -712,6 +712,22 @@ When PRESERVE-HISTORY is T, inspector history is not 
cleared."
            (locals (backtrace--locals n)))
       (inspector-inspect (cdr (assoc (intern varname) locals))))))
 
+;;;###autoload
+(defun inspector-inspect-debugger-return-value ()
+  "Inspect the current return value in the debugger."
+  (interactive)
+  ;; Find the backtrace-frame for the function 'debug.
+  ;; When there's an 'exit arg, assume that is the return-value and inspect it.
+  (let ((debug-frame (cl-find-if (lambda (frame)
+                                   (eq (backtrace-frame-fun frame) 'debug))
+                                 (backtrace-get-frames))))
+    (when (not debug-frame)
+      (user-error "Can't read debugger status"))
+    (let ((debug-exit (cl-getf (backtrace-frame-args debug-frame) 'exit 
:_not_found_)))
+      (when (eq debug-exit :_not_found_)
+        (user-error "Debugger is not in return-value state"))
+      (inspector-inspect debug-exit))))
+
 ;;;###autoload
 (defun inspector-inspect-stack-frame ()
   "Inspect current frame and locals in debugger backtrace."



reply via email to

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