Function: dape--stack-trace
dape--stack-trace is a natively compiled function defined in dape.el.
Signature
(dape--stack-trace CONN THREAD NOF CB)
Documentation
Update stack trace in THREAD plist with NOF frames by adapter CONN.
See dape-request for expected CB signature.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--stack-trace (conn thread nof cb)
"Update stack trace in THREAD plist with NOF frames by adapter CONN.
See `dape-request' for expected CB signature."
(let ((current-nof (length (plist-get thread :stackFrames)))
(total-frames (plist-get thread :totalFrames))
(value-formatting-p
(dape--capable-p conn :supportsValueFormattingOptions))
(delayed-stack-trace-p
(dape--capable-p conn :supportsDelayedStackTraceLoading)))
(if (or (not (equal (plist-get thread :status) 'stopped))
(not (integerp (plist-get thread :id)))
(eql current-nof total-frames)
(and delayed-stack-trace-p (<= nof current-nof))
(and (not delayed-stack-trace-p) (> current-nof 0)))
(dape--request-continue cb)
(dape--with-request-bind
((&key stackFrames totalFrames &allow-other-keys) error)
(dape-request
conn :stackTrace
`( :threadId ,(plist-get thread :id)
,@(when delayed-stack-trace-p
`( :startFrame ,current-nof
:levels ,(- nof current-nof)))
,@(when (and dape-info-stack-buffer-modules value-formatting-p)
`(:format (:module t)))))
(cond ((not delayed-stack-trace-p)
(plist-put thread :stackFrames (append stackFrames nil)))
;; Sanity check delayed stack trace
((length= (plist-get thread :stackFrames) current-nof)
(plist-put thread :stackFrames
(append (plist-get thread :stackFrames) stackFrames
nil))))
(plist-put thread :totalFrames (and (numberp totalFrames) totalFrames))
(dape--request-continue cb error)))))